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 --- .../junipernetworks/junos/.gitignore | 2 + .../junipernetworks/junos/.pre-commit-config.yaml | 21 + .../junipernetworks/junos/.yamllint | 15 + .../junipernetworks/junos/FILES.json | 6739 ++++++++++++++++++ .../junipernetworks/junos/LICENSE | 674 ++ .../junipernetworks/junos/MANIFEST.json | 37 + .../junipernetworks/junos/README.md | 161 + .../junipernetworks/junos/bindep.txt | 6 + .../junipernetworks/junos/changelogs/CHANGELOG.rst | 143 + .../junos/changelogs/changelog.yaml | 222 + .../junipernetworks/junos/changelogs/config.yaml | 30 + ...rnetworks.junos.junos_acl_interfaces_module.rst | 508 ++ .../junipernetworks.junos.junos_acls_module.rst | 1257 ++++ .../junipernetworks.junos.junos_banner_module.rst | 348 + ...nipernetworks.junos.junos_bgp_global_module.rst | 7478 ++++++++++++++++++++ .../docs/junipernetworks.junos.junos_cliconf.rst | 43 + .../junipernetworks.junos.junos_command_module.rst | 455 ++ .../junipernetworks.junos.junos_config_module.rst | 638 ++ .../junipernetworks.junos.junos_facts_module.rst | 280 + ...unipernetworks.junos.junos_interface_module.rst | 841 +++ ...nipernetworks.junos.junos_interfaces_module.rst | 687 ++ ...pernetworks.junos.junos_l2_interface_module.rst | 717 ++ ...ernetworks.junos.junos_l2_interfaces_module.rst | 823 +++ ...pernetworks.junos.junos_l3_interface_module.rst | 628 ++ ...ernetworks.junos.junos_l3_interfaces_module.rst | 888 +++ ...networks.junos.junos_lacp_interfaces_module.rst | 1100 +++ .../junipernetworks.junos.junos_lacp_module.rst | 375 + ...rnetworks.junos.junos_lag_interfaces_module.rst | 966 +++ .../junipernetworks.junos.junos_linkagg_module.rst | 610 ++ ...ipernetworks.junos.junos_lldp_global_module.rst | 444 ++ ...rnetworks.junos.junos_lldp_interface_module.rst | 341 + ...networks.junos.junos_lldp_interfaces_module.rst | 427 ++ .../junipernetworks.junos.junos_lldp_module.rst | 361 + .../junipernetworks.junos.junos_logging_module.rst | 612 ++ .../docs/junipernetworks.junos.junos_netconf.rst | 76 + .../junipernetworks.junos.junos_netconf_module.rst | 282 + ...networks.junos.junos_ospf_interfaces_module.rst | 1205 ++++ .../junipernetworks.junos.junos_ospfv2_module.rst | 909 +++ .../junipernetworks.junos.junos_ospfv3_module.rst | 1231 ++++ .../junipernetworks.junos.junos_package_module.rst | 405 ++ .../junipernetworks.junos.junos_ping_module.rst | 458 ++ .../junipernetworks.junos.junos_rpc_module.rst | 355 + .../junipernetworks.junos.junos_scp_module.rst | 365 + ...pernetworks.junos.junos_static_route_module.rst | 562 ++ ...ernetworks.junos.junos_static_routes_module.rst | 476 ++ .../junipernetworks.junos.junos_system_module.rst | 364 + .../junipernetworks.junos.junos_user_module.rst | 583 ++ .../junipernetworks.junos.junos_vlan_module.rst | 611 ++ .../junipernetworks.junos.junos_vlans_module.rst | 288 + .../junipernetworks.junos.junos_vrf_module.rst | 601 ++ .../junipernetworks/junos/meta/runtime.yml | 283 + .../junos/plugins/action/__init__.py | 0 .../junipernetworks/junos/plugins/action/junos.py | 177 + .../junos/plugins/cliconf/__init__.py | 0 .../junipernetworks/junos/plugins/cliconf/junos.py | 323 + .../junos/plugins/doc_fragments/__init__.py | 0 .../junos/plugins/doc_fragments/junos.py | 78 + .../junos/plugins/module_utils/__init__.py | 0 .../junos/plugins/module_utils/network/__init__.py | 0 .../plugins/module_utils/network/junos/__init__.py | 0 .../module_utils/network/junos/argspec/__init__.py | 0 .../junos/argspec/acl_interfaces/__init__.py | 0 .../junos/argspec/acl_interfaces/acl_interfaces.py | 80 + .../network/junos/argspec/acls/__init__.py | 0 .../network/junos/argspec/acls/acls.py | 208 + .../network/junos/argspec/bgp_global/__init__.py | 0 .../network/junos/argspec/bgp_global/bgp_global.py | 685 ++ .../network/junos/argspec/facts/__init__.py | 0 .../network/junos/argspec/facts/facts.py | 29 + .../network/junos/argspec/interfaces/__init__.py | 0 .../network/junos/argspec/interfaces/interfaces.py | 78 + .../junos/argspec/l2_interfaces/__init__.py | 0 .../junos/argspec/l2_interfaces/l2_interfaces.py | 75 + .../junos/argspec/l3_interfaces/__init__.py | 0 .../junos/argspec/l3_interfaces/l3_interfaces.py | 54 + .../network/junos/argspec/lacp/__init__.py | 0 .../network/junos/argspec/lacp/lacp.py | 64 + .../junos/argspec/lacp_interfaces/__init__.py | 0 .../argspec/lacp_interfaces/lacp_interfaces.py | 79 + .../junos/argspec/lag_interfaces/__init__.py | 0 .../junos/argspec/lag_interfaces/lag_interfaces.py | 72 + .../network/junos/argspec/lldp_global/__init__.py | 0 .../junos/argspec/lldp_global/lldp_global.py | 64 + .../junos/argspec/lldp_interfaces/__init__.py | 0 .../argspec/lldp_interfaces/lldp_interfaces.py | 63 + .../network/junos/argspec/ospf/__init__.py | 0 .../network/junos/argspec/ospf/ospf.py | 125 + .../junos/argspec/ospf_interfaces/__init__.py | 0 .../argspec/ospf_interfaces/ospf_interfaces.py | 134 + .../network/junos/argspec/ospfv3/__init__.py | 0 .../network/junos/argspec/ospfv3/ospfv3.py | 125 + .../junos/argspec/static_routes/__init__.py | 0 .../junos/argspec/static_routes/static_routes.py | 90 + .../network/junos/argspec/vlans/__init__.py | 0 .../network/junos/argspec/vlans/vlans.py | 64 + .../module_utils/network/junos/config/__init__.py | 0 .../junos/config/acl_interfaces/__init__.py | 0 .../junos/config/acl_interfaces/acl_interfaces.py | 259 + .../network/junos/config/acls/__init__.py | 0 .../module_utils/network/junos/config/acls/acls.py | 401 ++ .../network/junos/config/bgp_global/__init__.py | 0 .../network/junos/config/bgp_global/bgp_global.py | 553 ++ .../network/junos/config/interfaces/__init__.py | 0 .../network/junos/config/interfaces/interfaces.py | 306 + .../network/junos/config/l2_interfaces/__init__.py | 0 .../junos/config/l2_interfaces/l2_interfaces.py | 331 + .../network/junos/config/l3_interfaces/__init__.py | 0 .../junos/config/l3_interfaces/l3_interfaces.py | 280 + .../network/junos/config/lacp/__init__.py | 0 .../module_utils/network/junos/config/lacp/lacp.py | 239 + .../junos/config/lacp_interfaces/__init__.py | 0 .../config/lacp_interfaces/lacp_interfaces.py | 305 + .../junos/config/lag_interfaces/__init__.py | 0 .../junos/config/lag_interfaces/lag_interfaces.py | 341 + .../network/junos/config/lldp_global/__init__.py | 0 .../junos/config/lldp_global/lldp_global.py | 241 + .../junos/config/lldp_interfaces/__init__.py | 0 .../config/lldp_interfaces/lldp_interfaces.py | 259 + .../network/junos/config/ospf/__init__.py | 0 .../module_utils/network/junos/config/ospf/ospf.py | 438 ++ .../junos/config/ospf_interfaces/__init__.py | 0 .../config/ospf_interfaces/ospf_interfaces.py | 340 + .../network/junos/config/ospfv3/__init__.py | 0 .../network/junos/config/ospfv3/ospfv3.py | 438 ++ .../network/junos/config/static_routes/__init__.py | 0 .../junos/config/static_routes/static_routes.py | 312 + .../network/junos/config/vlans/__init__.py | 0 .../network/junos/config/vlans/vlans.py | 246 + .../module_utils/network/junos/facts/__init__.py | 0 .../network/junos/facts/acl_interfaces/__init__.py | 0 .../junos/facts/acl_interfaces/acl_interfaces.py | 167 + .../network/junos/facts/acls/__init__.py | 0 .../module_utils/network/junos/facts/acls/acls.py | 273 + .../network/junos/facts/bgp_global/__init__.py | 0 .../network/junos/facts/bgp_global/bgp_global.py | 474 ++ .../module_utils/network/junos/facts/facts.py | 149 + .../network/junos/facts/interfaces/__init__.py | 0 .../network/junos/facts/interfaces/interfaces.py | 138 + .../network/junos/facts/l2_interfaces/__init__.py | 0 .../junos/facts/l2_interfaces/l2_interfaces.py | 157 + .../network/junos/facts/l3_interfaces/__init__.py | 0 .../junos/facts/l3_interfaces/l3_interfaces.py | 179 + .../network/junos/facts/lacp/__init__.py | 0 .../module_utils/network/junos/facts/lacp/lacp.py | 115 + .../junos/facts/lacp_interfaces/__init__.py | 0 .../junos/facts/lacp_interfaces/lacp_interfaces.py | 138 + .../network/junos/facts/lag_interfaces/__init__.py | 0 .../junos/facts/lag_interfaces/lag_interfaces.py | 160 + .../network/junos/facts/legacy/__init__.py | 0 .../network/junos/facts/legacy/base.py | 210 + .../network/junos/facts/lldp_global/__init__.py | 0 .../network/junos/facts/lldp_global/lldp_global.py | 110 + .../junos/facts/lldp_interfaces/__init__.py | 0 .../junos/facts/lldp_interfaces/lldp_interfaces.py | 114 + .../network/junos/facts/ospf/__init__.py | 0 .../module_utils/network/junos/facts/ospf/ospf.py | 288 + .../junos/facts/ospf_interfaces/__init__.py | 0 .../junos/facts/ospf_interfaces/ospf_interfaces.py | 259 + .../network/junos/facts/ospfv3/__init__.py | 0 .../network/junos/facts/ospfv3/ospfv3.py | 288 + .../network/junos/facts/static_routes/__init__.py | 0 .../junos/facts/static_routes/static_routes.py | 187 + .../network/junos/facts/vlans/__init__.py | 0 .../network/junos/facts/vlans/vlans.py | 114 + .../plugins/module_utils/network/junos/junos.py | 515 ++ .../module_utils/network/junos/utils/__init__.py | 0 .../module_utils/network/junos/utils/utils.py | 33 + .../junos/plugins/modules/__init__.py | 0 .../junos/plugins/modules/junos_acl_interfaces.py | 364 + .../junos/plugins/modules/junos_acls.py | 341 + .../junos/plugins/modules/junos_banner.py | 201 + .../junos/plugins/modules/junos_bgp_global.py | 1747 +++++ .../junos/plugins/modules/junos_command.py | 489 ++ .../junos/plugins/modules/junos_config.py | 502 ++ .../junos/plugins/modules/junos_facts.py | 147 + .../junos/plugins/modules/junos_interface.py | 545 ++ .../junos/plugins/modules/junos_interfaces.py | 542 ++ .../junos/plugins/modules/junos_l2_interface.py | 418 ++ .../junos/plugins/modules/junos_l2_interfaces.py | 695 ++ .../junos/plugins/modules/junos_l3_interface.py | 338 + .../junos/plugins/modules/junos_l3_interfaces.py | 775 ++ .../junos/plugins/modules/junos_lacp.py | 303 + .../junos/plugins/modules/junos_lacp_interfaces.py | 965 +++ .../junos/plugins/modules/junos_lag_interfaces.py | 885 +++ .../junos/plugins/modules/junos_linkagg.py | 451 ++ .../junos/plugins/modules/junos_lldp.py | 229 + .../junos/plugins/modules/junos_lldp_global.py | 329 + .../junos/plugins/modules/junos_lldp_interface.py | 186 + .../junos/plugins/modules/junos_lldp_interfaces.py | 357 + .../junos/plugins/modules/junos_logging.py | 398 ++ .../junos/plugins/modules/junos_netconf.py | 196 + .../junos/plugins/modules/junos_ospf_interfaces.py | 614 ++ .../junos/plugins/modules/junos_ospfv2.py | 345 + .../junos/plugins/modules/junos_ospfv3.py | 699 ++ .../junos/plugins/modules/junos_package.py | 221 + .../junos/plugins/modules/junos_ping.py | 253 + .../junos/plugins/modules/junos_rpc.py | 177 + .../junos/plugins/modules/junos_scp.py | 175 + .../junos/plugins/modules/junos_static_route.py | 307 + .../junos/plugins/modules/junos_static_routes.py | 306 + .../junos/plugins/modules/junos_system.py | 212 + .../junos/plugins/modules/junos_user.py | 460 ++ .../junos/plugins/modules/junos_vlan.py | 316 + .../junos/plugins/modules/junos_vlans.py | 192 + .../junos/plugins/modules/junos_vrf.py | 346 + .../junos/plugins/netconf/__init__.py | 0 .../junipernetworks/junos/plugins/netconf/junos.py | 267 + .../junos/plugins/terminal/__init__.py | 0 .../junos/plugins/terminal/junos.py | 60 + .../junipernetworks/junos/requirements.txt | 5 + .../junipernetworks/junos/test-requirements.txt | 6 + .../junipernetworks/junos/tests/.gitignore | 1 + .../tests/integration/network-integration.cfg | 4 + .../tests/integration/target-prefixes.network | 1 + .../junos_acl_interfaces/defaults/main.yaml | 3 + .../targets/junos_acl_interfaces/meta/main.yaml | 3 + .../targets/junos_acl_interfaces/tasks/main.yaml | 2 + .../junos_acl_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_initial_config.yaml | 18 + .../tests/netconf/_reset_config.yaml | 15 + .../tests/netconf/deleted.yaml | 56 + .../tests/netconf/empty_config.yaml | 49 + .../junos_acl_interfaces/tests/netconf/merged.yaml | 53 + .../tests/netconf/overridden.yaml | 44 + .../tests/netconf/replaced.yaml | 44 + .../targets/junos_acls/defaults/main.yaml | 3 + .../integration/targets/junos_acls/meta/main.yaml | 3 + .../integration/targets/junos_acls/tasks/main.yaml | 2 + .../targets/junos_acls/tasks/netconf.yaml | 17 + .../junos_acls/tests/netconf/_reset_config.yaml | 15 + .../junos_acls/tests/netconf/config_policy.yaml | 12 + .../targets/junos_acls/tests/netconf/deleted.yaml | 128 + .../junos_acls/tests/netconf/idempotent.yaml | 69 + .../targets/junos_acls/tests/netconf/merged.yaml | 96 + .../junos_acls/tests/netconf/overridden.yaml | 49 + .../targets/junos_acls/tests/netconf/replaced.yaml | 90 + .../tests/netconf/reset_policy_config.yaml | 14 + .../targets/junos_banner/defaults/main.yaml | 3 + .../integration/targets/junos_banner/meta/main.yml | 3 + .../targets/junos_banner/tasks/main.yaml | 2 + .../targets/junos_banner/tasks/netconf.yaml | 26 + .../targets/junos_banner/tests/netconf/basic.yaml | 211 + .../junos_banner/tests/netconf/net_banner.yml | 38 + .../targets/junos_bgp_global/defaults/main.yaml | 3 + .../targets/junos_bgp_global/meta/main.yml | 3 + .../targets/junos_bgp_global/tasks/main.yaml | 4 + .../targets/junos_bgp_global/tasks/netconf.yaml | 17 + .../tests/netconf/_initial_config.yaml | 32 + .../tests/netconf/_reset_config.yaml | 10 + .../junos_bgp_global/tests/netconf/deleted.yaml | 25 + .../tests/netconf/empty_config.yaml | 49 + .../tests/netconf/fixtures/parsed.cfg | 48 + .../junos_bgp_global/tests/netconf/gathered.yaml | 49 + .../junos_bgp_global/tests/netconf/merged.yaml | 81 + .../junos_bgp_global/tests/netconf/parsed.yaml | 43 + .../junos_bgp_global/tests/netconf/purged.yaml | 25 + .../junos_bgp_global/tests/netconf/rendered.yaml | 38 + .../junos_bgp_global/tests/netconf/replaced.yaml | 50 + .../targets/junos_command/defaults/main.yaml | 3 + .../targets/junos_command/meta/main.yml | 3 + .../targets/junos_command/tasks/cli.yaml | 16 + .../targets/junos_command/tasks/main.yaml | 10 + .../targets/junos_command/tasks/netconf_json.yaml | 26 + .../targets/junos_command/tasks/netconf_text.yaml | 26 + .../targets/junos_command/tasks/netconf_xml.yaml | 26 + .../junos_command/tests/cli/cli_commmand.yaml | 64 + .../tests/netconf_json/bad_operator.yaml | 23 + .../junos_command/tests/netconf_json/contains.yaml | 24 + .../junos_command/tests/netconf_json/equal.yaml | 41 + .../tests/netconf_json/greaterthan.yaml | 42 + .../tests/netconf_json/greaterthanorequal.yaml | 42 + .../junos_command/tests/netconf_json/lessthan.yaml | 42 + .../tests/netconf_json/lessthanorequal.yaml | 42 + .../junos_command/tests/netconf_json/notequal.yaml | 42 + .../junos_command/tests/netconf_json/output.yaml | 66 + .../tests/netconf_text/bad_operator.yaml | 24 + .../junos_command/tests/netconf_text/contains.yaml | 23 + .../junos_command/tests/netconf_text/invalid.yaml | 36 + .../junos_command/tests/netconf_text/output.yaml | 77 + .../junos_command/tests/netconf_text/timeout.yaml | 22 + .../tests/netconf_xml/bad_operator.yaml | 24 + .../junos_command/tests/netconf_xml/contains.yaml | 24 + .../junos_command/tests/netconf_xml/equal.yaml | 38 + .../tests/netconf_xml/greaterthan.yaml | 42 + .../tests/netconf_xml/greaterthanorequal.yaml | 42 + .../junos_command/tests/netconf_xml/invalid.yaml | 34 + .../junos_command/tests/netconf_xml/lessthan.yaml | 42 + .../tests/netconf_xml/lessthanorequal.yaml | 42 + .../junos_command/tests/netconf_xml/notequal.yaml | 40 + .../junos_command/tests/netconf_xml/output.yaml | 65 + .../junos_command/tests/netconf_xml/timeout.yaml | 20 + .../targets/junos_config/defaults/main.yaml | 2 + .../integration/targets/junos_config/meta/main.yml | 3 + .../targets/junos_config/tasks/cli_config.yaml | 16 + .../targets/junos_config/tasks/main.yaml | 9 + .../targets/junos_config/tasks/netconf.yaml | 26 + .../targets/junos_config/tasks/redirection.yaml | 16 + .../targets/junos_config/templates/basic/config.j2 | 10 + .../junos_config/templates/basic/config.set | 1 + .../junos_config/templates/basic/config.xml | 15 + .../junos_config/tests/cli_config/cli_backup.yaml | 110 + .../junos_config/tests/cli_config/cli_basic.yaml | 63 + .../junos_config/tests/cli_config/cli_replace.yaml | 62 + .../targets/junos_config/tests/netconf/backup.yaml | 121 + .../junos_config/tests/netconf/bad_action.yaml | 17 + .../junos_config/tests/netconf/invalid.yaml | 29 + .../junos_config/tests/netconf/multiple.yaml | 47 + .../targets/junos_config/tests/netconf/single.yaml | 80 + .../junos_config/tests/netconf/src_basic.yaml | 106 + .../junos_config/tests/netconf/src_invalid.yaml | 18 + .../junos_config/tests/redirection/shortname.yaml | 51 + .../targets/junos_facts/defaults/main.yaml | 3 + .../integration/targets/junos_facts/meta/main.yml | 3 + .../targets/junos_facts/tasks/main.yaml | 2 + .../targets/junos_facts/tasks/netconf.yaml | 26 + .../targets/junos_facts/tests/netconf/facts.yaml | 110 + .../integration/targets/junos_interface/aliases | 0 .../targets/junos_interface/defaults/main.yaml | 2 + .../targets/junos_interface/meta/main.yml | 3 + .../targets/junos_interface/tasks/main.yaml | 2 + .../targets/junos_interface/tasks/netconf.yaml | 26 + .../junos_interface/tests/netconf/basic.yaml | 341 + .../junos_interface/tests/netconf/intent.yaml | 98 + .../tests/netconf/net_interface.yaml | 40 + .../targets/junos_interfaces/defaults/main.yaml | 3 + .../targets/junos_interfaces/meta/main.yaml | 3 + .../targets/junos_interfaces/tasks/main.yaml | 4 + .../targets/junos_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_remove_config.yaml | 16 + .../junos_interfaces/tests/netconf/deleted.yaml | 96 + .../tests/netconf/fixtures/parsed.cfg | 53 + .../junos_interfaces/tests/netconf/gathered.yaml | 73 + .../junos_interfaces/tests/netconf/groups.yaml | 56 + .../junos_interfaces/tests/netconf/merged.yaml | 80 + .../junos_interfaces/tests/netconf/overridden.yaml | 74 + .../junos_interfaces/tests/netconf/parsed.yaml | 41 + .../junos_interfaces/tests/netconf/rendered.yaml | 29 + .../junos_interfaces/tests/netconf/replaced.yaml | 88 + .../junos_interfaces/tests/netconf/rtt.yaml | 108 + .../targets/junos_l2_interface/defaults/main.yaml | 2 + .../targets/junos_l2_interface/meta/main.yml | 3 + .../targets/junos_l2_interface/tasks/main.yaml | 2 + .../targets/junos_l2_interface/tasks/netconf.yaml | 26 + .../junos_l2_interface/tests/netconf/basic.yaml | 332 + .../tests/netconf/net_l2_interface.yaml | 55 + .../targets/junos_l2_interfaces/defaults/main.yaml | 3 + .../targets/junos_l2_interfaces/meta/main.yaml | 3 + .../targets/junos_l2_interfaces/tasks/main.yaml | 4 + .../targets/junos_l2_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_base_config.yaml | 16 + .../tests/netconf/_remove_config.yaml | 20 + .../junos_l2_interfaces/tests/netconf/deleted.yaml | 92 + .../tests/netconf/fixtures/parsed.cfg | 53 + .../tests/netconf/gathered.yaml | 63 + .../junos_l2_interfaces/tests/netconf/merged.yaml | 68 + .../tests/netconf/overridden.yaml | 73 + .../junos_l2_interfaces/tests/netconf/parsed.yaml | 37 + .../tests/netconf/rendered.yaml | 63 + .../tests/netconf/replaced.yaml | 68 + .../junos_l2_interfaces/tests/netconf/rtt.yml | 79 + .../targets/junos_l3_interface/defaults/main.yaml | 2 + .../targets/junos_l3_interface/meta/main.yml | 3 + .../targets/junos_l3_interface/tasks/main.yaml | 2 + .../targets/junos_l3_interface/tasks/netconf.yaml | 26 + .../junos_l3_interface/tests/netconf/basic.yaml | 271 + .../tests/netconf/net_l3_interface.yaml | 45 + .../targets/junos_l3_interfaces/defaults/main.yaml | 3 + .../targets/junos_l3_interfaces/meta/main.yaml | 3 + .../targets/junos_l3_interfaces/tasks/main.yaml | 4 + .../targets/junos_l3_interfaces/tasks/netconf.yaml | 16 + .../tests/netconf/fixtures/parsed.cfg | 55 + .../tests/netconf/junos_l3_interfaces.yml | 145 + .../junos_l3_interfaces/tests/netconf/parsed.yaml | 46 + .../tests/netconf/rendered.yaml | 65 + .../targets/junos_lacp/defaults/main.yaml | 3 + .../integration/targets/junos_lacp/meta/main.yml | 3 + .../integration/targets/junos_lacp/tasks/main.yaml | 4 + .../targets/junos_lacp/tasks/netconf.yaml | 17 + .../junos_lacp/tests/netconf/_remove_config.yaml | 13 + .../targets/junos_lacp/tests/netconf/deleted.yaml | 47 + .../junos_lacp/tests/netconf/fixtures/parsed.cfg | 16 + .../targets/junos_lacp/tests/netconf/gathered.yaml | 38 + .../targets/junos_lacp/tests/netconf/merged.yaml | 45 + .../targets/junos_lacp/tests/netconf/parsed.yaml | 23 + .../targets/junos_lacp/tests/netconf/rendered.yaml | 25 + .../targets/junos_lacp/tests/netconf/replaced.yaml | 50 + .../targets/junos_lacp/tests/netconf/rtt.yaml | 58 + .../junos_lacp_interfaces/defaults/main.yaml | 3 + .../targets/junos_lacp_interfaces/meta/main.yaml | 2 + .../targets/junos_lacp_interfaces/tasks/main.yaml | 4 + .../junos_lacp_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_base_config.yaml | 18 + .../tests/netconf/_remove_config.yaml | 19 + .../tests/netconf/deleted.yaml | 112 + .../tests/netconf/fixtures/parsed.cfg | 130 + .../tests/netconf/gathered.yaml | 60 + .../tests/netconf/merged.yaml | 66 + .../tests/netconf/overridden.yml | 88 + .../tests/netconf/parsed.yaml | 34 + .../tests/netconf/rendered.yaml | 34 + .../tests/netconf/replaced.yaml | 120 + .../junos_lacp_interfaces/tests/netconf/rtt.yaml | 104 + .../junos_lag_interfaces/defaults/main.yaml | 3 + .../targets/junos_lag_interfaces/meta/main.yaml | 3 + .../targets/junos_lag_interfaces/tasks/main.yaml | 4 + .../junos_lag_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_base_config.yaml | 14 + .../tests/netconf/_remove_config.yaml | 18 + .../tests/netconf/deleted.yaml | 103 + .../tests/netconf/fixtures/parsed.cfg | 135 + .../tests/netconf/gathered.yaml | 68 + .../junos_lag_interfaces/tests/netconf/merged.yaml | 80 + .../tests/netconf/overridden.yaml | 78 + .../junos_lag_interfaces/tests/netconf/parsed.yaml | 37 + .../tests/netconf/rendered.yaml | 36 + .../tests/netconf/replaced.yaml | 89 + .../targets/junos_linkagg/defaults/main.yaml | 2 + .../targets/junos_linkagg/meta/main.yml | 3 + .../targets/junos_linkagg/tasks/main.yaml | 2 + .../targets/junos_linkagg/tasks/netconf.yaml | 26 + .../targets/junos_linkagg/tests/netconf/basic.yaml | 245 + .../junos_linkagg/tests/netconf/net_linkagg.yaml | 54 + .../targets/junos_lldp/defaults/main.yaml | 2 + .../integration/targets/junos_lldp/meta/main.yml | 3 + .../integration/targets/junos_lldp/tasks/main.yaml | 2 + .../targets/junos_lldp/tasks/netconf.yaml | 26 + .../targets/junos_lldp/tests/netconf/basic.yaml | 140 + .../targets/junos_lldp/tests/netconf/net_lldp.yaml | 45 + .../targets/junos_lldp_global/defaults/main.yaml | 3 + .../targets/junos_lldp_global/meta/main.yml | 3 + .../targets/junos_lldp_global/tasks/main.yaml | 4 + .../targets/junos_lldp_global/tasks/netconf.yaml | 17 + .../tests/netconf/_remove_config.yaml | 13 + .../junos_lldp_global/tests/netconf/deleted.yaml | 65 + .../tests/netconf/fixtures/parsed.cfg | 28 + .../junos_lldp_global/tests/netconf/gathered.yaml | 57 + .../junos_lldp_global/tests/netconf/merged.yaml | 66 + .../junos_lldp_global/tests/netconf/parsed.yaml | 25 + .../junos_lldp_global/tests/netconf/rendered.yaml | 27 + .../junos_lldp_global/tests/netconf/replaced.yaml | 78 + .../junos_lldp_global/tests/netconf/rtt.yaml | 83 + .../junos_lldp_interface/defaults/main.yaml | 2 + .../targets/junos_lldp_interface/meta/main.yml | 3 + .../targets/junos_lldp_interface/tasks/main.yaml | 2 + .../junos_lldp_interface/tasks/netconf.yaml | 29 + .../junos_lldp_interface/tests/netconf/basic.yaml | 127 + .../tests/netconf/net_lldp_interface.yaml | 49 + .../junos_lldp_interfaces/defaults/main.yaml | 3 + .../targets/junos_lldp_interfaces/meta/main.yaml | 3 + .../targets/junos_lldp_interfaces/tasks/main.yaml | 4 + .../junos_lldp_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_remove_config.yaml | 13 + .../tests/netconf/deleted.yaml | 97 + .../tests/netconf/fixtures/parsed.cfg | 24 + .../tests/netconf/gathered.yaml | 60 + .../tests/netconf/merged.yaml | 67 + .../tests/netconf/overridden.yaml | 72 + .../tests/netconf/parsed.yaml | 27 + .../tests/netconf/rendered.yaml | 28 + .../tests/netconf/replaced.yaml | 76 + .../junos_lldp_interfaces/tests/netconf/rtt.yaml | 81 + .../integration/targets/junos_logging/aliases | 0 .../targets/junos_logging/defaults/main.yaml | 2 + .../targets/junos_logging/meta/main.yml | 3 + .../targets/junos_logging/tasks/main.yaml | 2 + .../targets/junos_logging/tasks/netconf.yaml | 26 + .../targets/junos_logging/tests/netconf/basic.yaml | 443 ++ .../junos_logging/tests/netconf/net_logging.yaml | 47 + .../targets/junos_netconf/defaults/main.yaml | 3 + .../targets/junos_netconf/tasks/cli.yaml | 26 + .../targets/junos_netconf/tasks/main.yaml | 2 + .../junos_netconf/tests/cli/changeport.yaml | 107 + .../targets/junos_netconf/tests/cli/netconf.yaml | 121 + .../junos_netconf/tests/utils/junos_command.yaml | 6 + .../targets/junos_ospf/defaults/main.yaml | 3 + .../integration/targets/junos_ospf/meta/main.yaml | 3 + .../integration/targets/junos_ospf/tasks/main.yaml | 2 + .../targets/junos_ospf/tasks/netconf.yaml | 17 + .../junos_ospf/tests/netconf/_initial_config.yaml | 18 + .../junos_ospf/tests/netconf/_reset_config.yaml | 11 + .../targets/junos_ospf/tests/netconf/deleted.yaml | 56 + .../targets/junos_ospf/tests/netconf/merged.yaml | 57 + .../junos_ospf/tests/netconf/overridden.yaml | 64 + .../targets/junos_ospf/tests/netconf/replaced.yaml | 41 + .../junos_ospf_interfaces/defaults/main.yaml | 3 + .../targets/junos_ospf_interfaces/meta/main.yaml | 3 + .../targets/junos_ospf_interfaces/tasks/main.yaml | 2 + .../junos_ospf_interfaces/tasks/netconf.yaml | 17 + .../tests/netconf/_initial_config.yaml | 20 + .../tests/netconf/_reset_config.yaml | 11 + .../tests/netconf/deleted.yaml | 69 + .../tests/netconf/empty_config.yaml | 49 + .../tests/netconf/fixtures/parsed.cfg | 23 + .../tests/netconf/gathered.yaml | 38 + .../tests/netconf/merged.yaml | 56 + .../tests/netconf/merged_update.yaml | 67 + .../tests/netconf/overridden.yaml | 69 + .../tests/netconf/parsed.yaml | 31 + .../tests/netconf/rendered.yaml | 31 + .../tests/netconf/replaced.yaml | 46 + .../targets/junos_ospfv3/defaults/main.yaml | 3 + .../targets/junos_ospfv3/meta/main.yaml | 3 + .../targets/junos_ospfv3/tasks/main.yaml | 2 + .../targets/junos_ospfv3/tasks/netconf.yaml | 17 + .../tests/netconf/_initial_config.yaml | 18 + .../junos_ospfv3/tests/netconf/_reset_config.yaml | 11 + .../junos_ospfv3/tests/netconf/deleted.yaml | 56 + .../junos_ospfv3/tests/netconf/empty_config.yaml | 49 + .../junos_ospfv3/tests/netconf/fixtures/parsed.cfg | 35 + .../junos_ospfv3/tests/netconf/gathered.yaml | 37 + .../targets/junos_ospfv3/tests/netconf/merged.yaml | 57 + .../junos_ospfv3/tests/netconf/overridden.yaml | 64 + .../targets/junos_ospfv3/tests/netconf/parsed.yaml | 39 + .../junos_ospfv3/tests/netconf/rendered.yaml | 38 + .../junos_ospfv3/tests/netconf/replaced.yaml | 41 + .../targets/junos_rpc/defaults/main.yaml | 3 + .../integration/targets/junos_rpc/meta/main.yml | 3 + .../integration/targets/junos_rpc/tasks/main.yaml | 2 + .../targets/junos_rpc/tasks/netconf.yaml | 26 + .../targets/junos_rpc/tests/netconf/rpc.yaml | 74 + .../targets/junos_smoke/defaults/main.yaml | 3 + .../integration/targets/junos_smoke/meta/main.yml | 3 + .../integration/targets/junos_smoke/tasks/cli.yaml | 16 + .../targets/junos_smoke/tasks/main.yaml | 3 + .../targets/junos_smoke/tasks/netconf.yaml | 22 + .../targets/junos_smoke/tests/cli/reboot.yaml | 21 + .../junos_smoke/tests/netconf/common_utils.yaml | 56 + .../tests/netconf/module_utils_junos.yaml | 99 + .../targets/junos_static_route/defaults/main.yaml | 2 + .../targets/junos_static_route/meta/main.yml | 3 + .../targets/junos_static_route/tasks/main.yaml | 2 + .../targets/junos_static_route/tasks/netconf.yaml | 26 + .../junos_static_route/tests/netconf/basic.yaml | 285 + .../tests/netconf/net_static_route.yaml | 45 + .../targets/junos_static_routes/defaults/main.yaml | 3 + .../targets/junos_static_routes/meta/main.yaml | 2 + .../targets/junos_static_routes/tasks/main.yaml | 4 + .../targets/junos_static_routes/tasks/netconf.yaml | 17 + .../tests/netconf/_base_config.yaml | 30 + .../tests/netconf/_remove_config.yaml | 19 + .../junos_static_routes/tests/netconf/deleted.yaml | 45 + .../junos_static_routes/tests/netconf/merged.yaml | 99 + .../tests/netconf/overridden.yaml | 65 + .../tests/netconf/replaced.yaml | 71 + .../tests/integration/targets/junos_system/aliases | 0 .../targets/junos_system/defaults/main.yaml | 3 + .../integration/targets/junos_system/meta/main.yml | 3 + .../targets/junos_system/tasks/main.yaml | 2 + .../targets/junos_system/tasks/netconf.yaml | 26 + .../targets/junos_system/tests/netconf/basic.yaml | 409 ++ .../junos_system/tests/netconf/net_system.yaml | 36 + .../targets/junos_user/defaults/main.yaml | 3 + .../integration/targets/junos_user/meta/main.yml | 3 + .../integration/targets/junos_user/tasks/main.yaml | 2 + .../targets/junos_user/tasks/netconf.yaml | 26 + .../targets/junos_user/tests/netconf/basic.yaml | 225 + .../targets/junos_user/tests/netconf/net_user.yaml | 40 + .../targets/junos_vlan/defaults/main.yaml | 3 + .../integration/targets/junos_vlan/meta/main.yml | 3 + .../integration/targets/junos_vlan/tasks/main.yaml | 2 + .../targets/junos_vlan/tasks/netconf.yaml | 26 + .../targets/junos_vlan/tests/netconf/basic.yaml | 213 + .../targets/junos_vlan/tests/netconf/net_vlan.yaml | 29 + .../targets/junos_vlans/defaults/main.yaml | 3 + .../integration/targets/junos_vlans/meta/main.yaml | 2 + .../targets/junos_vlans/tasks/main.yaml | 4 + .../targets/junos_vlans/tasks/netconf.yaml | 17 + .../junos_vlans/tests/netconf/_base_config.yaml | 13 + .../junos_vlans/tests/netconf/_remove_config.yaml | 12 + .../targets/junos_vlans/tests/netconf/deleted.yaml | 38 + .../targets/junos_vlans/tests/netconf/merged.yaml | 52 + .../junos_vlans/tests/netconf/overridden.yaml | 48 + .../junos_vlans/tests/netconf/replaced.yaml | 51 + .../targets/junos_vrf/defaults/main.yaml | 3 + .../integration/targets/junos_vrf/meta/main.yml | 3 + .../integration/targets/junos_vrf/tasks/main.yaml | 2 + .../targets/junos_vrf/tasks/netconf.yaml | 26 + .../targets/junos_vrf/tests/netconf/basic.yaml | 338 + .../targets/junos_vrf/tests/netconf/net_vrf.yaml | 42 + .../targets/prepare_junos_tests/tasks/main.yml | 15 + .../junos/tests/sanity/ignore-2.10.txt | 2 + .../junos/tests/sanity/ignore-2.9.txt | 17 + .../junos/tests/sanity/requirements.txt | 4 + .../junipernetworks/junos/tests/unit/__init__.py | 0 .../junos/tests/unit/compat/__init__.py | 0 .../junos/tests/unit/compat/builtins.py | 34 + .../junos/tests/unit/compat/mock.py | 128 + .../junos/tests/unit/compat/unittest.py | 39 + .../junos/tests/unit/mock/__init__.py | 0 .../junos/tests/unit/mock/loader.py | 116 + .../junipernetworks/junos/tests/unit/mock/path.py | 12 + .../junos/tests/unit/mock/procenv.py | 96 + .../junos/tests/unit/mock/vault_helper.py | 42 + .../junos/tests/unit/mock/yaml_helper.py | 167 + .../junos/tests/unit/modules/__init__.py | 0 .../junos/tests/unit/modules/conftest.py | 40 + .../junos/tests/unit/modules/network/__init__.py | 0 .../tests/unit/modules/network/junos/__init__.py | 0 .../modules/network/junos/fixtures/__init__.py | 0 .../junos/fixtures/get_configuration_rpc_reply.txt | 7 + .../fixtures/get_configuration_rpc_reply_diff.txt | 12 + .../fixtures/get_configuration_rpc_reply_json.txt | 190 + .../network/junos/fixtures/junos_bgp_global.cfg | 22 + .../junos/fixtures/junos_bgp_global_config.cfg | 38 + .../network/junos/fixtures/junos_config.json | 28 + .../network/junos/fixtures/junos_config.set | 2 + .../network/junos/fixtures/junos_config.text | 8 + .../network/junos/fixtures/junos_config.xml | 9 + .../network/junos/fixtures/junos_interfaces.cfg | 10 + .../junos/fixtures/junos_interfaces_config.xml | 53 + .../network/junos/fixtures/junos_l2_interfaces.cfg | 31 + .../network/junos/fixtures/junos_l3_interfaces.cfg | 39 + .../junos/fixtures/junos_ospf_interfaces.cfg | 7 + .../fixtures/junos_ospf_interfaces_config.cfg | 34 + .../network/junos/fixtures/junos_ospfv2.cfg | 6 + .../network/junos/fixtures/junos_ospfv2_config.cfg | 34 + .../network/junos/fixtures/junos_ospfv3.cfg | 6 + .../network/junos/fixtures/junos_ospfv3_config.cfg | 34 + .../fixtures/junos_ping_ping_10.10.10.10_count_2 | 7 + ...ng_ping_10.10.10.11_count_5_size_512_interval_2 | 11 + .../fixtures/junos_ping_ping_10.10.10.20_count_4 | 4 + .../junos/fixtures/load_configuration_xml.txt | 6 + .../junos/fixtures/show_chassis_hardware_xml.txt | 26 + .../fixtures/show_chassis_routing-engine_xml.txt | 52 + .../junos/fixtures/show_interfaces_details_xml.txt | 25 + .../junos/fixtures/show_system_memory_xml.txt | 20 + .../junos/fixtures/show_system_storage_xml.txt | 20 + .../network/junos/fixtures/show_version_json.txt | 42 + .../network/junos/fixtures/show_version_text.txt | 8 + .../network/junos/fixtures/show_version_xml.txt | 12 + .../unit/modules/network/junos/junos_module.py | 103 + .../modules/network/junos/test_junos_bgp_global.py | 316 + .../modules/network/junos/test_junos_command.py | 185 + .../modules/network/junos/test_junos_config.py | 229 + .../unit/modules/network/junos/test_junos_facts.py | 182 + .../modules/network/junos/test_junos_interfaces.py | 276 + .../network/junos/test_junos_l2_interfaces.py | 241 + .../network/junos/test_junos_l3_interfaces.py | 259 + .../modules/network/junos/test_junos_netconf.py | 131 + .../network/junos/test_junos_ospf_interfaces.py | 348 + .../modules/network/junos/test_junos_ospfv2.py | 395 ++ .../modules/network/junos/test_junos_ospfv3.py | 394 ++ .../modules/network/junos/test_junos_package.py | 85 + .../unit/modules/network/junos/test_junos_ping.py | 144 + .../unit/modules/network/junos/test_junos_rpc.py | 139 + .../unit/modules/network/junos/test_junos_scp.py | 104 + .../junos/tests/unit/modules/utils.py | 55 + .../junos/tests/unit/plugins/__init__.py | 0 .../junos/tests/unit/plugins/terminal/__init__.py | 0 .../tests/unit/plugins/terminal/test_junos.py | 58 + .../junos/tests/unit/requirements.txt | 42 + .../junipernetworks/junos/tox.ini | 34 + 652 files changed, 86682 insertions(+) create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/.gitignore create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/.pre-commit-config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/.yamllint create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/FILES.json create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/LICENSE create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/MANIFEST.json create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/README.md create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/bindep.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/CHANGELOG.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/changelog.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acl_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acls_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_banner_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_bgp_global_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_cliconf.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_command_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_config_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_facts_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interface_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interface_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interface_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lag_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_linkagg_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_global_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interface_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_logging_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospf_interfaces_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv2_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv3_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_package_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ping_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_rpc_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_scp_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_route_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_routes_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_system_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_user_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlan_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlans_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vrf_module.rst create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/meta/runtime.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/cliconf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/cliconf/junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/acls.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/bgp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/facts.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/lacp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/ospf.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/static_routes.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/vlans.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/acls.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/bgp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/lacp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/ospf.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/static_routes.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/vlans.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/bgp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/lacp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/base.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/ospf.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/static_routes.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/vlans.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/utils.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acl_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acls.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_banner.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_bgp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interface.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interface.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interface.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lag_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_linkagg.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interface.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_logging.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_netconf.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_package.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ping.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_rpc.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_scp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_route.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_routes.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_system.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_user.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlan.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlans.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vrf.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/requirements.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/test-requirements.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/.gitignore create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/network-integration.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/target-prefixes.network create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_initial_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_reset_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/_reset_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/config_policy.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/idempotent.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/reset_policy_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/net_banner.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_initial_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_reset_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/purged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_json.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_text.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_xml.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/cli/cli_commmand.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/bad_operator.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/contains.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/equal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthan.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthanorequal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthan.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthanorequal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/notequal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/output.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/bad_operator.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/contains.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/invalid.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/output.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/timeout.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/bad_operator.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/contains.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/equal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthan.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthanorequal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/invalid.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthan.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthanorequal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/notequal.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/output.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/timeout.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/cli_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/redirection.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.j2 create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.set create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.xml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_backup.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_replace.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/backup.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/bad_action.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/invalid.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/multiple.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/single.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_invalid.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/redirection/shortname.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/facts.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/aliases create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/intent.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/net_interface.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/groups.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/net_l2_interface.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_base_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/net_l3_interface.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/junos_l3_interfaces.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_base_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/overridden.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_base_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/net_linkagg.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/net_lldp.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/net_lldp_interface.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rtt.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/net_logging.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/changeport.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/utils/junos_command.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_initial_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_reset_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_initial_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged_update.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_initial_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_reset_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/empty_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/fixtures/parsed.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/gathered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/parsed.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/rendered.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tests/netconf/rpc.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/cli.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/cli/reboot.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/common_utils.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/module_utils_junos.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/net_static_route.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_base_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/aliases create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/net_system.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/net_user.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/net_vlan.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/meta/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_base_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_remove_config.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/deleted.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/merged.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/overridden.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/replaced.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/defaults/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/meta/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/main.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/netconf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/basic.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/net_vrf.yaml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.10.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.9.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/requirements.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/builtins.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/unittest.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/loader.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/path.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/vault_helper.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/yaml_helper.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/conftest.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_diff.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_json.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global_config.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.json create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.set create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.text create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.xml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces_config.xml create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l2_interfaces.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l3_interfaces.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces_config.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2_config.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3_config.cfg create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.10_count_2 create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.11_count_5_size_512_interval_2 create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.20_count_4 create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/load_configuration_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_hardware_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_routing-engine_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_interfaces_details_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_memory_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_storage_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_json.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_text.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_xml.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/junos_module.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/__init__.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/test_junos.py create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/requirements.txt create mode 100644 collections-debian-merged/ansible_collections/junipernetworks/junos/tox.ini (limited to 'collections-debian-merged/ansible_collections/junipernetworks/junos') diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/.gitignore b/collections-debian-merged/ansible_collections/junipernetworks/junos/.gitignore new file mode 100644 index 00000000..ba1431e6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/.gitignore @@ -0,0 +1,2 @@ +.tox +__pycache__ diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/.pre-commit-config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/.pre-commit-config.yaml new file mode 100644 index 00000000..4ff769f4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.1.0 + hooks: + - id: check-merge-conflict + - id: check-symlinks + - id: debug-statements + - id: end-of-file-fixer + - id: no-commit-to-branch + args: [--branch, main] + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 19.3b0 + hooks: + - id: black + args: [-l, "79"] + - repo: https://github.com/ansible-network/collection_prep + rev: master + hooks: + - id: update-docs diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/.yamllint b/collections-debian-merged/ansible_collections/junipernetworks/junos/.yamllint new file mode 100644 index 00000000..3adaf90c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/.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/junipernetworks/junos/FILES.json b/collections-debian-merged/ansible_collections/junipernetworks/junos/FILES.json new file mode 100644 index 00000000..632fa4af --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/FILES.json @@ -0,0 +1,6739 @@ +{ + "files": [ + { + "name": ".", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": ".gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "315971ad9cc5d6ada2391f0940e1800149b211a18be3c7a8f396735d7978702b", + "format": 1 + }, + { + "name": "test-requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4d5bde1e704c6a9aae483166745dc5510ca36cdcecee8e322338f960de0e77d8", + "format": 1 + }, + { + "name": ".pre-commit-config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a571fb93e577613f6f7bb86402f5caefeed26d2399211cfad69aa2354427fedd", + "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": "49690b91f2fc105f6495f7c7ddbce7d966fde562c7de9da03605df7f9114f438", + "format": 1 + }, + { + "name": "changelogs/CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d58c33666ab598369ef265a7087f99a42f50f87c33f3000f7f17f55d0efa0934", + "format": 1 + }, + { + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d2f85a377818d22e2b57af1bd8e393261c1c73436c5bdc1f717d26d72978aabc", + "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/terminal", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/terminal/junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4b533d9e8302ad429c058aa008ad395d68b8231a9e20267a0a2e1efdafd4578c", + "format": 1 + }, + { + "name": "plugins/terminal/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules/junos_system.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f050b5fa08ea97a56d24642b26a45b44b2e918c068b62ce65f7747afe59a96a8", + "format": 1 + }, + { + "name": "plugins/modules/junos_lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "06cbe74029b3eb7e9ee71c3ad6ab8ae5fc21d69d8bdf67c2c0debc09cd4bf067", + "format": 1 + }, + { + "name": "plugins/modules/junos_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "340bed9f74bd80aa18e85e55c13d2af48a99ee9362434c8c40a7cdbefb15d2d4", + "format": 1 + }, + { + "name": "plugins/modules/junos_lldp_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a018dc28dab41add66e58ffb11b755829fe0a47e147bea4256783e0261e5a3bd", + "format": 1 + }, + { + "name": "plugins/modules/junos_ping.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1401b79bc97cc5f06fb74f08e28f50c7ba6ccb4596dbdd0ce2c0031e28e7a9f9", + "format": 1 + }, + { + "name": "plugins/modules/junos_vlan.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "259397eea41d602eb4458f98668c20a326119a5a50b8817eac50b774dd5c5fca", + "format": 1 + }, + { + "name": "plugins/modules/junos_lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b291b2025a2f59ebf3a0ece64b605c916874e6369699a87b27cea7db53f20d6", + "format": 1 + }, + { + "name": "plugins/modules/junos_acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5fe429afcfd3bacafd2085d4fa60f152b3eca24b83c5b975dc863b2f000d36d1", + "format": 1 + }, + { + "name": "plugins/modules/junos_linkagg.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0ecd6fa756ceb475416168482917fbb95f9a48bd2d89f7fd0b1e625a9469b031", + "format": 1 + }, + { + "name": "plugins/modules/junos_ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c430c768953ecbc9dfae18f97739975c89c48baf99993faa00240156d963ee2c", + "format": 1 + }, + { + "name": "plugins/modules/junos_l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be24675dbb4f1823a81d1269298c3fdb7bc66e68a838263b632bd74da1a6de62", + "format": 1 + }, + { + "name": "plugins/modules/junos_ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f225f42b66102dbd02127942f7e7a6e56f8f7f0c1d4b74b3c56de390aea7d01a", + "format": 1 + }, + { + "name": "plugins/modules/junos_logging.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dcc2fa0d56a570c3c05ec4a78581d8967520d130d11279363ec7be3069d0cae5", + "format": 1 + }, + { + "name": "plugins/modules/junos_lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e96d229790f3e5de3aa8ec103f862297b3c048b459552cb0faa6642721af29a1", + "format": 1 + }, + { + "name": "plugins/modules/junos_ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "014c29bc5f19cb51dd21942d84d4eb5b7c205779329b6e1c39dbaafddaf0c966", + "format": 1 + }, + { + "name": "plugins/modules/junos_lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1e3c8679a0659077650899535709f3751fe0e167b3397b1eb9ba83ff8f5b090", + "format": 1 + }, + { + "name": "plugins/modules/junos_config.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ee82eb50358950ba283fa1b08da81349e3536380864a9a3ada6967b63338ee36", + "format": 1 + }, + { + "name": "plugins/modules/junos_vrf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1740a07f50597904a5c9215b013265a87f4a00d7e5ad67bf85234db82a2a5e19", + "format": 1 + }, + { + "name": "plugins/modules/junos_user.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7c22acf8d28ea8dd3b51c29b206575ff8206da85fce23f44e9a88fbebedffb42", + "format": 1 + }, + { + "name": "plugins/modules/junos_command.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ee35e853dcc333e3bf94d158eaa55af9ef48e23b3cce4e69440fd9d84fda515b", + "format": 1 + }, + { + "name": "plugins/modules/junos_netconf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d27e2ed1dc6ba2025d7f0ba94d4f814d26b3102fac8eddd05a9ab6dd16c99ce8", + "format": 1 + }, + { + "name": "plugins/modules/junos_banner.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "78a39428de3edd456e969d7a393e83605e86a37764b04a8544ff151b1b9e5af1", + "format": 1 + }, + { + "name": "plugins/modules/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/modules/junos_lldp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "59c349f9d92a6a319b580762938b2a9cc3cb99c4e05846f7c768e433345910d3", + "format": 1 + }, + { + "name": "plugins/modules/junos_l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92dfde29d8a13442a6574fb2b2421a895ef8837511bc40c486fbcaf50a075f44", + "format": 1 + }, + { + "name": "plugins/modules/junos_package.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d184e3be1dff54f4087e8c0ed4723542a07bab66a1e8d3af346cc3f81151be39", + "format": 1 + }, + { + "name": "plugins/modules/junos_bgp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be7637dae23db998ee5422efbea8e241cf5a4bbf6cc39b5f090fa8bf24a8981a", + "format": 1 + }, + { + "name": "plugins/modules/junos_scp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "824d2725eaa806b5ed3bf13bffb7bfa2e8d951c2a2923fc505cee8f90e157b27", + "format": 1 + }, + { + "name": "plugins/modules/junos_static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "db66925b2f7bc341a26b18a3754234458602b74037141788ddffb8422ab92c74", + "format": 1 + }, + { + "name": "plugins/modules/junos_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4363500e24f2a590b1300bcfd3bf954aa5875980eb693a19781804d142d48831", + "format": 1 + }, + { + "name": "plugins/modules/junos_static_route.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "12bade381f008f1ee9ba463e756f183be52a5b14ab5c09b1ac1c048763f9d8c2", + "format": 1 + }, + { + "name": "plugins/modules/junos_l3_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f14f468a50d3abb546a81797f441ca3d93f26b825708de86c04f86b83d896edf", + "format": 1 + }, + { + "name": "plugins/modules/junos_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0f6f918d6560d0d9568105dc3daa63a83fcb333ba4a3b13081a63834ea46dcdb", + "format": 1 + }, + { + "name": "plugins/modules/junos_lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5a7760f1630a0b6f1bbd0a8faa81b4ff3f3e4e380dee3739a94711c8274850b6", + "format": 1 + }, + { + "name": "plugins/modules/junos_vlans.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7a73a2f5f42a5a341e92d3940499c36ec0369d3f30967985f4edf65361bb7804", + "format": 1 + }, + { + "name": "plugins/modules/junos_acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3877cd7c479dcb7ec2f78e536467a789794d3a8364b21101e0c51cd53c0b413c", + "format": 1 + }, + { + "name": "plugins/modules/junos_rpc.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "04ed9c2e584ba15288776e60f1425ba5c6ac05f78197ab7c4331ee3085e2980b", + "format": 1 + }, + { + "name": "plugins/modules/junos_l2_interface.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4235341fd5c14247c45f5fd23cb66c912eaa6bb1fb0d61106bf90d4854a3e77e", + "format": 1 + }, + { + "name": "plugins/doc_fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/doc_fragments/junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6bd286f1c3b0066426baac4c6dc216d58a467318b32074fdbeafb558ef0b2388", + "format": 1 + }, + { + "name": "plugins/doc_fragments/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "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/junos", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3e04e56c74276d4493f419d1d31e85d51195d50e3a16d5350c3b5f97e88e59fb", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "913b641315b0efa6f3ec2caef85184c3645a745893b2fa4b5e8aca090f2b2012", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/acl_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3ee4a27fd2731bad1f97b87cbcedc88b0b24fb0a3e673e5c072b30783a290865", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lldp_global/lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "87ffe46d8f045a75f4aacfcc8a32229e11ac6c0624f3cd73e92af0edb5bd296b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lldp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lldp_interfaces/lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "afebec20383eedbdfa84c8925ba15cf6a9797baeea24f13b16d0af0413452595", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lldp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospf_interfaces/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba7b9cd536c7b4e75fe7fd9aaadf19fb2d1020987e2b75a240e3e5734c945c8a", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospf_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospfv3/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospfv3/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "afd76387d87e32f34de4b6e98ef7b93937e428a4f6c0fcd1ff2ca5ea73d0bf0b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/legacy", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/legacy/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/legacy/base.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8d46a57c1bbd7a2ee72e27adbed7e74278e4226ef0760c1402948a4a9f0c1edb", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/bgp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/bgp_global/bgp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "235935fa825a57f3be2c8532f8f0454f59a7b8f2f9767895938f8aacc505f683", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/bgp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/l2_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/l2_interfaces/l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "371557810fed429904cd31ca60d64694ee52f5fc5b5201338b164b00647dbfb4", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/interfaces/interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a03d729392594615e986486d6a870745427307e4da2cf07c798a3019cfdcc2e8", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lacp/lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7e2fd081cf8c8b2ef6d15907d73280a42f7dfe441d9e9965760534543b25be76", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lacp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef520556ca74b126408b3b6383c1d33ff1b4fa1e2a662c3a42e62b75ca931d94", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lacp_interfaces/lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4bc507d04761af36e31799c90a1a7be3b2e7b021d3ab7706dd0b39a342085c0b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lacp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2e8ba174150127fcfa932f8482f2894b4d8e840a086e1a32558b831e2c4842f9", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/l3_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lag_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4fa0adbb942f66b7cb0ffee76d753fc868feb29ced8c89ab8923a3d7f6ab64b3", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/static_routes/static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "34e4f99d4f7054c27c3237bd18ec93fa7c7ca4e98bf0d1f85690744ea464dc80", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/static_routes/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/ospf/ospf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "434a2525a2a84a7988fb9b8acd29cfa84ca562fd39d301ed6fd3f88124f49938", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/vlans", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/vlans/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/facts/vlans/vlans.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "128983e50b9f7156490bd9487d1af17fad8354235987606d3f7cb351b107004e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/utils/utils.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df60505e20f911f8c4f6b5188e3ce1ca6fc3f4af05f4514956ed20a2498ce6ab", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/acl_interfaces/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "366206d46b2d7c92d9ddc1942759120c218b591f9ee31407af666331b165e843", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/acl_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lldp_global/lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "74b437b026aef79d743a34df5e0a6b2c1b8e85d389322a17caeeeaf8546b4678", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lldp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lldp_interfaces/lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3dab7cd746162ec99e7607c5a55e132b3956ae650564572cfafd359f4ad663d4", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lldp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospf_interfaces/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "84946663addafc6f58e0a2c99d0b614bc9c70b98ee3179b3b745428ff5029d9b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospf_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospfv3/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospfv3/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4e7a096ba8fd34b3683ec92d8b6612e99dd87206e24433c1ff9776bce2e5aeb9", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/bgp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/bgp_global/bgp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b31e7cfcdfd5a67622bcba98696fbf8b577bca51823dc3c8ecf35d28d4c23891", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/bgp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/l2_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "62d030df56ad98919e1a12d44912b7c7a0ed38c355547d345f72ad2562189547", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/interfaces/interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6486ac7c79cd645dacd0469475b22672803cf75f18cfda5d7237f1b386db04dd", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lacp/lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c585e650bb49d0310576cf09a4905b8e4e317537bbe9ed22b6f2e7d4a4c0375", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lacp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "368627efe641bcd1ce33d4c293bb0c9ffa75ce84b193f5f727b228b8556ca0d1", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lacp_interfaces/lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c842904cb42dcd6fe8753fc4ff645cc3e78fcb39e7762d1cb431e25641548922", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lacp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/l3_interfaces/l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a5c368c4236b61daed9456b1cf7e3d76a0ca8d11e13efd2c478d9d2f676541cc", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/l3_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lag_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/lag_interfaces/lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "171e1ea7b7052f59ad33374ca1eabda63cb9f322000bbeb678d6eed03f2ab86b", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/static_routes/static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3d3d1daf6da51001a0f76fef763d0b7f67af7f8259a50ed6ca10c15868484b20", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/static_routes/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/ospf/ospf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "37c500bdde81ce53a75abb8bc2cef4c916ebfe221e384c04f5913958fd112eea", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/vlans", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/vlans/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/config/vlans/vlans.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d90b3d579fa7486a4414f30e3285e65b19008bbbfa2bcfda2b8c80561f03acb3", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/acl_interfaces/acl_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2ab600bd5bb5076fb2c0942efa145ba15072c37c11fb770da21cd808957f92dd", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/acl_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lldp_global/lldp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b46e4a2c63b433a3aee717ffa6ca5e946f5c025b89382ee036007bb9db7a95e5", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lldp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/facts/facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "88d2cdc3397acdd0f9749235dc3c6101124fb438908d8f6d5e916ae272aa7bda", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/facts/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lldp_interfaces/lldp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "38eb3416d842c1de4fdd0429f9e6bc3b7caf578ba76c78b6fcead76caa73c92f", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lldp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospf_interfaces/ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c92567ceb2d3299ef200fb01ee382d6b6a22c6348856f541cccad908ad6a9fcf", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospf_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospfv3/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospfv3/ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "910e6eca4de2c2bba3fe05d0731c83b573440f3f4d96584abd835bc3d11aad5e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/bgp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/bgp_global/bgp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "49344c76f8714d08797afb1ead8b2785c6895fa858f7a6a2b25da256add66b05", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/bgp_global/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/l2_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/l2_interfaces/l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba8a4e09c59deeeeec135bbfa37755e92d78da89e06cdfa7e57998db255a39b1", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/interfaces/interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c68be48c84e133088ea8e4049c781d7c8f96189c5a39557c197ca07e185d9364", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lacp/lacp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b8e0a996aa52ba3b662f0f67f6d314c32ab314101ecd3a399123f48bf3ea9031", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lacp/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df7d072ff40d228a7a7efcd9be5468f634055e04cbc68cf06cbd7abefed4e8a0", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lacp_interfaces/lacp_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5b8e1080db137bdff32bd17e0ae8a7224093346277d59cb1b1ecb8054562872d", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lacp_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/l3_interfaces/l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03d137289f06f26ed3af0ecb44accebb20b528954314bff6b60817dbfed9555a", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/l3_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lag_interfaces/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/lag_interfaces/lag_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d616e90ec8a33bbfe10f18976a99e4f39b03c635b23618a77a7c6c4bbd42f4f5", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/static_routes/static_routes.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a4d678c20cc95ef5501b7fff96d890bb513fe5c0a4723262cd26c765f25f9726", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/static_routes/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/ospf/ospf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ca6b85ebae4d3795bc5d2b5ea30377ef6ffb3017eaec8bcaef46339a6d98c6c4", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/vlans", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/vlans/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/junos/argspec/vlans/vlans.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "43f9c7db2e4b2f575338f11298ab5b9249bf5b55f8f66efcae24ec6712a7de89", + "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/junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f753c78c85466ad7e39b25d32d7841239202550e97c9c6824090d0a38e0ac5eb", + "format": 1 + }, + { + "name": "plugins/netconf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/cliconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/cliconf/junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3347d963772a442fe2f6eb8d9403d60136b1c8b41998a28c8241aeb84de33770", + "format": 1 + }, + { + "name": "plugins/cliconf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/action", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/action/junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d8278ea763cf7b683efae674f7d7bc401c86baa54a9af7c6a826c68b729986e7", + "format": 1 + }, + { + "name": "plugins/action/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "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": "9528951bf2174cae4721d678c389cae4b0bb984d9f997aaa3174d93b67a78750", + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.10.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e1b61f9a5f56161ecd269b8e45240bd323c8afacc3d11095b8c098ef24b5ad5d", + "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/junos", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_ospf_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "52b1abc8d2926c2330c735af10c9f12779bcf976d84977d962fbd8a907954fdf", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_ping.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "98558cb51a300862653bfbaa776306b639b5ca3a88a823d744a61ea85079c360", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_l2_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a86795d3e9687535f6e6ca74020a8f1c60776d356df8436e7bd59ffbe72278e9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_bgp_global.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1dbb7c955d8f466f15c00299cd305deafd6f79810ac6f377206717161dc32489", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_ospfv3.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dd13bd2a6909f6e7849cbdcfb048388c204ef133b84a4b11c551355d34c24c9f", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_netconf.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d695b7e85e7861432eaa66377cf7bb2d44066e3f81f4a0aaeb7cc37df639a233", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ospfv2.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0fb6b3eba75e5cf010f196a9f376f6d890508caa25726faeeec3cf0b8120579c", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_l3_interfaces.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "98490f3b9ec1e6e82897e25048eec0a74e602fba1047832f132ab97b87e3e2fa", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_interfaces.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "65df2d02ae1f7f5dca4d74f0ae59e12737cdf93eb7ea35de636b0d14ea9322c6", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_bgp_global_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fa344ae66ab231208e8b4b8e82a05ea3f6e70ecdabe2b1e7a9ff04a122d5bba2", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_config.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e9090b43021ce0a24e737cd6662a6f4eaf7ed660e5faee319b104422ce656a20", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_system_storage_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e16d998b7968ef2a27fe878bcb7b96f5192509e58fe2ace2895545864a9db29f", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_interfaces_config.xml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fea4e582c6588c84a8eea4f45e3c131995ece519cdab2fe4d1b79ec541fe3b30", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_json.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1e77d8a4c829ca72a36c925ed12e7dcb6117ab7369f1f059b4fa9dedbea7f589", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ospfv3.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4473a0f4634d65ecdf1d9ab0e02ad91ffc7a6ed9031abe91a0ef9e4e02aadd58", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "893f4dcd5f53a385e08607033796f20d5cba951f6ef75ddc97090d06fc5a2b8d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_l2_interfaces.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "baebce5d83303e9acd8cc130fc68bdf3fd4ec227443c18535977b4b1bc365d5a", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/load_configuration_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b9095b5352838f46207fca0046504e331c8d370dc85332520ccc0247028479f9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_system_memory_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ccd652c214dd6d91f86d7ef6d334541c0b9fb74b9431b5d206aba656c03215ce", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_config.xml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7f20565b1504913b40b5e6c3a181a184884847beaad0b5e9d153f4695acd6c8d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ospfv2_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "094f9fe6e43c401dc46dba7c8c6b89b022b33e32255f65ecc317c93c6b270c94", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.10_count_2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "45b8dcf26e3f693cbfd5e66a886f6c42c8427844e62cc3fee6fa02950c80e832", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.20_count_4", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bf73afa78e3abecd0fd0f9fcce47d0e8684deed25a54bccdcfce911a083e7c0c", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_config.set", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cf8987ee62c608a9bd95380ef30c8263b9ea1413d2a30829edcb501822cb3ae1", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27f68a011bf8cf31ba603d92a74ec2b14188550e379874ec6652843c2a8014a9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_chassis_hardware_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d6d686902c059632720826594a665ebdda8cfe166ec082796ae56da11d64e421", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_config.text", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "960715cdfb74bd887bbea541872eb8e57ac395891e969e1d6b0dab95eccb6afd", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_diff.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c61cfce095ac967c024d72f88f3f6fb02d8597af464fe68aed4e19ee125fa0a", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_bgp_global.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b53812c95bf7f79ce9339c7a917aaaa62802e0b89be05cb091583d55e0e5f802", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_version_json.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fbd4852a4146302cdbd46f6a5f7f9226749fab8c6d6671bd5ea3074bbd552e01", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_interfaces_details_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "14f5b7fbfa8fe9985d8412e886d6ac46cf6fc972a7078d0fa95eaf48a3be00b7", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_version_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1654c985ca104eaabe41f5d4b2b69984c7083df2797dedc8ffb05a7977311f66", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_chassis_routing-engine_xml.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a9818e113293701cc01971ed0c7edb733f81384d539c08d49af16b56356ead12", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ospfv3_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27f68a011bf8cf31ba603d92a74ec2b14188550e379874ec6652843c2a8014a9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/show_version_text.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2327f839b4523c4f2bc4da4746082bb4e58b38db4ffd0b0a7c4f81d5cbb49dee", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "850fe4783503b9b95b824d8c7b0be1a50319a7cad1d114c3711a73de85c3ec10", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.11_count_5_size_512_interval_2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2dc39ef974356df3ba62871556a0253541b5fad3cad4e3ff1ea3d69101b6ad43", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "443386d27bf1f71fb76310ff14344a5707c861be82ca1eff30e79cf8d0b550ff", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_l3_interfaces.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "de4854022e76e37fecedafd1f65057068c90041efd89457d46e627f7ce96d9a7", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_ospfv2.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "adbdcecfcfced7de1b48c3e35c897b4b4b6aa83056bc09a2c5a760707d626d6a", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_rpc.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e874acae4be68669b7b6cbb68a720244b79b74b5ded1876060120ab2e7da1c80", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_scp.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a63ea30c7ac2f0e262c1af701cfaa06001cd654ec069403fa290615bb54d8d8d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_command.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1251e6e90a8e452ceef72458c731548fd0c125318670aa506920f5b27981a697", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/junos_module.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9e59fe39276c6666ff20161b1d8f180eeb8e337055c19aa5e5f9cf409d1b8fd9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_config.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a95a13b729bce5bfe3b0631b8ecd6e93a2d95bbe2d5f23824e906a1060cec6c5", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "831eddfba5332637fe670dc35a6537a0c6fcb8ac3d283c9f5bd9a6381412d91d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/junos/test_junos_package.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d4ffab4f0a5af05d305dd1cd8e5e0aec4be15a0265df297c9627dd6bf5406fb3", + "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": "22fefe0ed77eab059ba5474b007d759c20aba8481ee3336dd779b623db061c77", + "format": 1 + }, + { + "name": "tests/unit/plugins", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/plugins/terminal", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/plugins/terminal/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/plugins/terminal/test_junos.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "65e332d2f9e5e8c83daa8e1aeaa0c2425bf596d4538c681b5602d731e17bebe7", + "format": 1 + }, + { + "name": "tests/unit/plugins/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "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": "7059dc30642beda77a00e1cde4b48b381f0dab7fcab8b055c4054d235f33868c", + "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": "803ff405071f24b2a86fa14e3f9d8e89197d7301d59b2354ee522bcf0e06fac7", + "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": "662487551126edebafa8181300fec7545150ddd479f6ca1d0fb05e4200654269", + "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": "510c644fd2afe192ceedbdc738b5c3cd4cf7bb0f0d2b266e9b0c91561edc4cd5", + "format": 1 + }, + { + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4bb639735cfc30bb4b314880b481bad9f48f149ace92dd6529dd989e6744470b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6d1916dde259ae00eab1a87ec1f6f3d747cce9666fb89cd8afa347424097b617", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c21d362e6893be1546bfb0b6d07bf1bf4bff339a7266d83d7fc15f811f576ea", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6eb35350f92a0ae0527f94e27daa5506279c181db31be1a332a9f74cee66ad8f", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bac2febf61c943a9cae6fbe76f8840c2a70f19d2664eec4180a5e51036ee51d9", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cc4903fff9341c6e6763ccd3e1d564002633562688308e87a1b97674f4afb07b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c7a7a45b14283779eccc07ecf67aecf425521bcdbde459d62455345acf68c9d7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "46d3451913337cff34f13e63fb1648a46085cc51c9fc5e80db95ba05952fa16f", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9003fb90985e1873a490d3eb6f07df37eac5b4cf483fae7cecd54572b9c39dc1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "12fd7a00e74685d43988e4df164e7d98c4db9edff06858e461fe3c3d1e864018", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/_base_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ce3366484224003b5bbd1fbc01278576a2382655e68248fc0d718da8503aad26", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9ca66807aa1bf38c511992b95941a13d5fe6a1b3b470d138fa64dc9f78d00184", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03f84e33bbe2ca0d3562da67c81d351b1e351f92a3e93d56ca0bd09b63db47ce", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "baaa7ff460ed7c06878600a982d0c5eaeee8e373de7693725e1846bab5216d80", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fea4e582c6588c84a8eea4f45e3c131995ece519cdab2fe4d1b79ec541fe3b30", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "922aca00bd6e26da79f8e97848bad7b0753579d759ef5d69af51964cffab1554", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b63bdf0fb7c2d140fd8b9207acfd450d49b4293c3b17fa48b65273cce550d28c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "65b5cf6b5a2b7a313cd5468b4def6e4e47803005909633c8e6b21c0683059cad", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ca94d91dd296c3ffc6766b541d9f7f2366316449674216333d7499b79d1fcf3c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2acc65a8ea8fa751b9a024eb6319724d22a56c3ff955b8660069d46f8fe19791", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9cd174cd981f886972fa010a4868396ac15025b1de9815cf6f358c737071cbb6", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8737a69cc9bade3a2f86eb0ebd9e6fccb65ff1ec96a94082927c805040d4cfda", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/tests/netconf/facts.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7e51cac386f22d1df61eeb18104eea60c26910f19802fe1bacafd0c560f399d2", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_facts/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "47dfcf94b28fb7de81aa723c8a7f70358e4a5bfa891b8d1a33bc0480e659260a", + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_junos_tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_junos_tests/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/prepare_junos_tests/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9f4b5e3cf2532a7e617a5caa3ab82ca89ca81b8d9c52f8d2c63125e085a4409b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests/netconf/junos_l3_interfaces.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7877cae64529814cb42697b74416baabda257272c01aec30d5686f048ed9874a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e1de14afc1f1c7fdfd493a909abb1a7750c41e523202b5f1b28b5e72697dc392", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8e6c688f8b32ced16f580fcd040e8f90c0de67b71f7e992e4116223dfc0ad805", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a08b867a1bd879ab48650defbb1a7971e732db5d690df50ee685aebaafe76f5e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2cdfc55d05a9435562dc487b2f4a9e53dbd4fd36fc048c190b0e0a93746dc5b8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba35cc25324f847e331fd964957d9082697d6b166420abaf2591bf8d205f0f53", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc00c3912adafcf82524d4f9b791217fe19619138bd046ab18cae8494ec442f", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/_reset_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6cba3431bd5eeb392d81c4eea6e9983c509615c9a15223825f152102ba9955cf", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc1260ba19ff411bbc8afe027551cf82ef154ee09278dad8693200e4c9d75601", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0b7ef2f271b14eb3d65e8ccb9ab405fd441366d3de4548e08fdf2d7c1f8f6152", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "16ccb3a77afae2d2b094ea329cda0a31917de1c01f9c3a788ca9f364a28524c1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "418350c651041a5494fa0b2a575f3b83af57cde477ff2ae65c1dccb847613293", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/_initial_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "18f0c9685f93a2e2327897b7872be0466413051a7d9674ce41e39772dd0566dd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "06eb278f2f93217d2756b94abac1d993ef3db004720a19195199da96fc3eaf6a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e47e7536231d4dcf715a8d48a1c06cdcfd84b980ec1ee1bb32c596959aa5f40d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "11f8c8f107c796569f0d60a273f2f9c008977d2d1017aed140ef8c40516d592a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9894ee154c7a39aa7a1e65d027dfc12b8643e1a3df53d3c09bbab9eeb44a1cf1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10424c95610118babd8fdbdc52672da7e4c5bfbea041001e4a12c516be2f9014", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospfv3/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc3467651622a454ffbd28b734a88a2f74115defecbfc3a52cbfb7e3205d09ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7f18f8be334f9fd7217f4b1976805bf0b6cb855a767d2f2fac732edccf68d433", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tests/netconf/net_system.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "288e6b07897c20618de8803b9599564094787f1183ad83cf79c4f1fe6c3be24a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_system/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55c4a9df9a69df56f03eb6b2646f51c14389e7b346e85955f17bf75769b6907b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be4e573bf5f37ee71429b414804bae1a23b8612d76f64ea4dbc3f4832805ef4e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tests/netconf/net_banner.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39c54a6139ea4c974e990e8c20fdd9c38a689f651a1935f57e5f291da5ffdf69", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_banner/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "47dfcf94b28fb7de81aa723c8a7f70358e4a5bfa891b8d1a33bc0480e659260a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tests/cli/changeport.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "89347c58c26d7d65cafffa8f0503ea7f466cc1bc5bbbb1c590236d95c866ff4e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tests/cli/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "739b4dd7425e82d72cea22b03435026fc187d7d50cc831b18bb364c43fe2a3cd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tests/utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tests/utils/junos_command.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c78c859a6bef7ba86c594e15e3dd9f8aed09b4b030c1258d8fffa9ad5bc31fea", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ddf85efe18296ec17d890e6539366e7ae535082e3ddb5e795f3bbb3de8e9625e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_netconf/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "78d0bbf565b2dd52bc3872aa582720905ba440f5b333b8e2dbd5665b8ab774e2", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cd2cff7e5729db6e2edd02e34b3913237f33da419afdf2dd20190668f6e8df47", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tests/netconf/net_l2_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cea31abfd8aaaa340f417071ee52daca39cff12110f2d0e15f155e9984fecb27", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l2_interface/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f6ce5c6e217d1202ce3e3f8bdbd03ced8a91a6ba806097e6b976745826fed364", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/_base_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef67ec5c72948019c2e4e781143e107ae867907e5d5b1306a98b8c001ac156c5", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "91b649f48f5a80a50a1bdf331a3b0a651b74fc885ae1ad8f7867675bb96ec50c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b1630cd07adcd5ff5e11c908e74e9923bd98e68acdcbf59b7d4ff4b9e5327b64", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "95984235ee69eae5487b4f21cb3637815be04d63b5a41fc5dd6c5778e3bde366", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/overridden.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "adc7fff6c68c0b4021e11492fe32bd27cec1ac8a63f29eb524e5d79ed062984c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c70a8049ee0b7eec0a999a6e73e803af4c67873bb59239fc2c080598fb605090", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dc9de3a5cc89817ebed78c21b04f0b84fdbf7fe2a04c47299b6226b5f807e00a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ae6987eaece294fd21b384447b15657898a06a1e69db90924180a2f408c08b75", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e247b60abd74ac8fa90bdc791abcf13ebbc4474ff9b15668c742a93bcbb7254f", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fdd61ef5afd2b877d2ca39161ee2e5ded95927fbf142b4210299727e1241dc73", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "09cd11383f0bdc42d66febf7c9cb1f537fcab19ac96df28417e9af3a44a056bd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "efb275d54a7c21fd007e1d1c8b10b65d148a9121af425a4e7fbd60abacd23fc8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dbc81f16f219a1801eb3df0254ac2d5b045aa3e701413e6a4dd392558e245814", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tests/netconf/net_logging.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0ab544949c5f830a3f454580ad73001faa9d46161da28819fbd7747210b03c11", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_logging/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55c4a9df9a69df56f03eb6b2646f51c14389e7b346e85955f17bf75769b6907b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tests/netconf/net_user.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "258dc3d3d09e384b278f14393cdc0228965ac4248fdfc9f83604d02c25136d05", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4910c19b38369fc60fe8cabb972019707a4747a8930bd428ec3877205b7208be", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "536c27a326eb67488ed4ad5c7263bf84f543e3eaa2b344e3c398892649dbf648", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_user/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a338872666b36426f8178c87c8e3e75255610b1072aad021fc4b1f914234c1d7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf/_base_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "792df847404371e10629fc7954707a77666c99fbd8d345c8967439a64c7385f1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9d764a38404cd327e9af24f1983a15741ac3af7837a0a6550c2e3b3e996baa74", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8d927358d375ca181ea58cd549d96c9d8b40b598e40b2e9caa5f435359e779eb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0dd60f0be0daa4e39f192f722559e4fb1403edcd8a2a273892dae0f2062bd150", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cc386ae1015d40f8815cc85a4352f1d98bfc087d000d1e93b2fba342fcb57818", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f48280647bad89f4ee4bc9cc78cc3acc75a9b10506663c4966ed21b5c8c9f665", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "efb275d54a7c21fd007e1d1c8b10b65d148a9121af425a4e7fbd60abacd23fc8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_routes/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tests/netconf/net_lldp_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb2dce520a0d6c9290a7a6aa957edc582da054c457c217d7e22a1e574a189a91", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "67cb92d9b922a5dbd32a8245dac0f7d6ba9de2d8ec9ca526dad6e28d69fb827b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_interface/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6f1c5f4588bedb2b1ece74694de11221ae2e97e31623c4775135601984b1c6c5", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "486eaffc7b25b7aa1cf4126354a86d4112ba92a374b8fee363fe1b35ac3e88d8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tests/netconf/net_linkagg.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "71360fe80f2576e768c07086c99896fb114bf62158275bd7ad1d0a4f89173612", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_linkagg/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55c4a9df9a69df56f03eb6b2646f51c14389e7b346e85955f17bf75769b6907b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b4ca48afeedb3a04cc1382a87aef9a1dedf5f40a101467c4417ea00434f97520", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tests/netconf/net_lldp.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7d871050b59c645646b4f9406c15039683b164e4acd6f7598bfe3242a5483882", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55c4a9df9a69df56f03eb6b2646f51c14389e7b346e85955f17bf75769b6907b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0accb9a87c55631af146d1fbe46e5c1d55b401f01609ff379b31022c18655f77", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tests/netconf/net_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cbdf43bcef1fdbe1690e7a5818a7115270e422615fa742cf1be9bcf87d9d9f58", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tests/netconf/intent.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "00f119e542cf268ac40962f570c8fc300b12484bdcb3adf5de226c451dfe754e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interface/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cd50362909950fd78c9703e904446d08d0405cadefbd072daea3c2d1a2b0911a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/templates/basic", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/templates/basic/config.set", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e55d8c57f22746493a68395134a4c07e361bf83a7f5b21a95905ef7ee40cbda1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/templates/basic/config.xml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4d6334450d173802f80b0c55ea41fa8e094afeabfe76c14d54c036b8d48a9eee", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/templates/basic/config.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bbed64106791040c7fb7bdad5635d333a88e9c7bd440efcdef103676a7c2d52b", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/single.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9d8e2611039b61c659b246cfbbf8622db2799e11d3ca59dcd8a8f731fe0fc98c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0a739c46ec8595d754ecbbda164152ec6296959aabde0ef6190477b9f75cbe5d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/src_invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "74a74de39ac3e1c09bcdd45a7e6fbd90c67d3a2f653624ecab650b467474ba19", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/src_basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7751fa91a20ac3c7171613d0035a8cb0430f436d51ad02c31923f0d3ea2442e9", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/bad_action.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5de18165cb4b7eb077798c1f21d9bcf5e67b5c3bc86721a7886d7f9f4e7423cd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/backup.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5a750abaed40e3a4a26a1b65729ab16c213eec5a8cfd16fb154fbc2527201800", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/netconf/multiple.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "49ef84e57885bd3acaa033d3bd4fd32b1f056d18d13dcd48f44fb66dd824d3cd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/cli_config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/cli_config/cli_backup.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "93e727c99c5f19efb62caa1b0116a07d6ded40523485dcbf972cde13e343aba6", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/cli_config/cli_basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9585ccc0d45c4c21a02ff6725a4fc821479479e40e90d8bed61d17b342666a27", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/cli_config/cli_replace.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d0af3280df5cd807e32d0a06df4a2a6f7aa0dfda51bf659943f2e3dbd474bf02", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/redirection", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tests/redirection/shortname.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9d920f30614b542717228e414015f8490695fcc80bd50ceff7a03d9d1eaef428", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "81f6a149d03b6185e72c240d52951d1a2a9e1967032eff78c22f091075f79db2", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "47dfcf94b28fb7de81aa723c8a7f70358e4a5bfa891b8d1a33bc0480e659260a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tasks/redirection.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0b50e4ae3f76904c5b386f3417e52a5a07cce8fb131d9b0cef2196ca1f87ed6d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_config/tasks/cli_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c3916688c6a06d407824e239f69b830eb463b710e7b17aa6306ad50c3f694757", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/tests/netconf/rpc.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "94b3ab42c2755f52769fd67c8a733eb9ac12f7fa29e92af42836b34dc26b2b7c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_rpc/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a338872666b36426f8178c87c8e3e75255610b1072aad021fc4b1f914234c1d7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/_base_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8198a473de0c62504037d1f8f6a93a0bc4f6ea304077b24c49909ba18b0f5f92", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a92110916000c3e44b58e2f63f190e4fd2a50bfff5880c7f958cad07bb75da2c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c5a688715563b7ecd1fcd2148fef0b68607dffa00ebecb57ee71534bb6ddaa8a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef993ba966209dd629081abf391b8abfcfdbf36597be6e72f79d95dc5bfd7ee4", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6362681d72bb84236c6063867d677a9c6802996a268047dc081ae4dead5345fe", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8d0b39c221c89749eb1576d66840408d1a108a49d3c541e28ccfa4bd35515403", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f9b7923a813a940176abf8d37963098acc4f21cf077758ee51831d3e3e49dd5e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f25fc69b149cb4584b3626ed9770ddd50b71b078b327488f5608e0143e3ae92c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0f82ff919705eb1b1b5b740779a3ca3e444d52c059162cc342f15e52099b9cab", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a501bf735b607e834dcaba525d825fad9bbcaae46fa81f40182e42d8e8548261", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lag_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c3aaf05270c2ead7ccda7d20c995a4fe76153b6bfd99ee89e62b507ed9e32f78", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c79f585f22d11c4235f9857b9eace9d1d9c6a5ace8f043f61d1ef127b6c162cc", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/_reset_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d5709f145f3482bf0578a85cef29cde9b0c36e99d89e9bf3c711e3e5181028e6", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/config_policy.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2f6ee47e9f2a0170279cb4490fcaebac126ff0f1a2be582a1b6f0a04d5559613", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/reset_policy_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bce1c5eb77c4a4c41024ca10c18746a119022f77b2beb4d7f00c15ae1539bdda", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3eb53b426e584f68f2479c6797a826d2c88a44cd305f5b2d1255d1d331a12d33", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/idempotent.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "80e69c5a337095f6edc5365883970b56a5fa55b14f4ea3201337888742c5e0d3", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "87423d8e5e145425c91916780472b620734b827ce2afe32332f7633d12705147", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9894ee154c7a39aa7a1e65d027dfc12b8643e1a3df53d3c09bbab9eeb44a1cf1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10424c95610118babd8fdbdc52672da7e4c5bfbea041001e4a12c516be2f9014", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acls/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc3467651622a454ffbd28b734a88a2f74115defecbfc3a52cbfb7e3205d09ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tests/netconf/net_vlan.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6562fd754d8838bc60153653497083e3ca2e2b0874723b80c661d968a4d47190", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0a0ed823e3b9825c80c3566e8accf4ddcad59fac130aa15ae981619d132c4f5e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlan/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a338872666b36426f8178c87c8e3e75255610b1072aad021fc4b1f914234c1d7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d52fd9fc0512caa7fe33cdbc47865f3e9770250aa78da953293e8f8de12829e0", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged_update.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "444a772a9efaf77faf8b058b3cde38ee0307c0fd443fb8277f8b8bb4388dcec5", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a153bf2fdfbdf3eace8db097cfff831465caacc804c53f75c8c526590d50d2b3", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "58567c9524f25513320ef9ddf61fa66a6bece77130b76d2ded6715375c55996a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1d76fa10966f6df14f252f4a4e191282738d850623a2783fa2040cb1ee451cd8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e347b2e2b15aa5bb82c925f814e7bd603a7797a68381b17783bb61be2ca9800d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a0460d8722acf4ccb04f2421ea81f55174132aec6b6f5aff0f3164a8378d7462", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2fb7f873517d63321db8061769a6bd8719d52fdfd5515530f7103af8adf28eed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/_initial_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "205ded37abe1ee93e73c26bdd131be39036d0f2e076ca7147acc03a93226f630", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b1ec21b6a6f17bc39deda418e03f807d3329e04314e719d742a5cf40046fc3a7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "de91cca6501a3533d57434c2539530357198c4584b09086f79aa97c449650665", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7a6233909d3f2a79ade552281e271effcca6b4dd33afbfeabe6a4f25a19d8ad8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9894ee154c7a39aa7a1e65d027dfc12b8643e1a3df53d3c09bbab9eeb44a1cf1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10424c95610118babd8fdbdc52672da7e4c5bfbea041001e4a12c516be2f9014", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc3467651622a454ffbd28b734a88a2f74115defecbfc3a52cbfb7e3205d09ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6e46621b03b1dde76a31b0f08a50f7e5255c0173323651c55002507ed3e46589", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "81c21e60e6b006199b01648a4b31a21fa40c82a17b3b7546958ed844b99c0eca", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dd2bd6bf5e3586c5121310490846758eeb302931b2b2a3fbce16e9405c849f67", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "84dbf099bdcb5a3dddd7084963dbc5a0cccbe1d5a1243bb62cfd779f794509ce", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f3b14e3b0985ebd4d62e4eeac1a6ff3b94884b97a2a04ee098aeff1b61e1bac9", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "be799381e0934bc14821bee85819db3bfbc8c762244233ff280905b5c2355036", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4aada5e9487ed4c1b90eb9184fb3827d3a61e2bf11658527eabade8b79b94207", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cff29ecb04b68534b8244f29d9088b3879454e1d99f6bb6833ffeb78e3e04793", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55a742d34b68fcd83cd960410e281e00023d28b81e501e23cd95ec88dc652005", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lldp_global/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "914e25ceeeef603b21af170478cc6b4e578299f3850b15156f62931f8a3555ea", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "657f458ede5cc43eb941a1e8acae780c9fe51877e3705eaf5a769884bd70851e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/groups.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "40b6f3e8d83bc219a08d27294f180b433569b4bb0f075dd1240e97257c298180", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a091a0bbad6c54ac62ac020bc122ee03f43fab0d84a440d9a7961b702bd64840", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e0dcf81fecfea2443b931ea13585c90f86328910b71285add801bda7265c3636", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0acac87402521ea0ba273555b4a0886075d2f5053d4475d9d574684923c2a44e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ff67bb15d2b968138f67a91a73261ef5b577b01c23f8d93d37a16ec3362211ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "deb856b8b3a0edb95767ee47bac0552ce62c45a76eb88203404725d1ec8ca166", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "486847f70318dcb1d9fba94d05aab08421669c3052d9191814fcbf8083639bdb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "19fc53b9cabfb53c0b41724e7e171567ed21691ff4b1f65c9e40b6b5f86f8722", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a4442da7a86305ceea11202bd41c6f795c55de1d7d3c98494833ee077dcc8897", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tests/cli/reboot.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fd75f463af6ff37d42d5f8ee6c329451132de9d25b2b6a09681f9c595db882ef", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tests/netconf/module_utils_junos.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c5a0e543b6f3ff2cd27a2118f8fe93ffebdc965bdeee278ffbbf92949fdddd42", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tests/netconf/common_utils.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "73f766aac62cd3d9144ab55935b3f731c65ffe023bb85d80cf620361802e1cda", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "665288590cd4226da42511817f09ccdfc92df36c9621583cd2c82919af295c5a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0008148b02f2d4fe731e052280b171a84f3e21b2f56d3a175d928d57e2b838ef", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ce9f4fad053783d8563921809ba42759731e99a6421830fb7d711dc39904020c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_smoke/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e6ef56c9aa51eaed3741ec28f324f6c83f111a066b8550914fb1c150acc85f70", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fe8e13fa44be091409ebabfd0b41b0686958ff308060842747c8f54a22f6931c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "95c92a43d91e4c4aad3afe29428e3a7ca6e5f7b37c45e08f3259e22ce489f71d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7206ec05e4a9670e83cc407c9ca5649eb57f01d30d3b176dece84accdeca69ae", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a4b700c2ea2a883eb933f3674bad49879df7c52855a9e1b0cee0b348e2f22872", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "83f1c92bd2cadc9f7174d1e786b28e098d3ec7a0c9f03709fd6c7c0be8b6e9ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "110a21d82511576b8ef4e54771f1535cdfe913fa4a77793aede46066115a9bf9", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "596e623409d7ead2c9c6d724c60ed7a3d43068e07d41f9c23f89487cd3de3946", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d9c6e32982b0eef3f128a000f181da8b3369a32f84ba3a0846b1a934aa2a7722", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a5c428b252bbecd53602af7e5925757c2c1d0f28ccb6c034f911a6fb026a5f50", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_lacp/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/cli/cli_commmand.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7acc91f36ebc771015efc1eb3414c2f4d51474102dc31cf94e95d0be408d9ce3", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/lessthanorequal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c9eb606ebd6d7b136b6231b7156aed910d674ebaa8e0f097aae06b03647f5e0", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/output.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a4f970a83548d69e5b407b682405bfe36a5c7cd91d98950f18a1c96fd6ec1e0a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/notequal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "323e3534759a0bcec14e256cf864c8028ea69ffd4ab9f9bb5e71cb5f679179c3", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/bad_operator.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cc82bbce989443f7caee7076f9b1025eec702231ccab82ec38360264f2fc9681", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/lessthan.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "df1d360d5fabc6c3df0ebfcece44fe4a76a6a691cc349cd693a240d7816f03bd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/equal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "186c7ae0d7e8ec258a24d13753761da497aded1f696fe405f04cfa734c6f685e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/greaterthan.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "73a2cefb434e7602231beb1c45535e4c53b1a8c1a6342868621b040bc17d0c92", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/contains.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5d813e82de32a9586c9f2a921f543cd67b48e62784b883b39518e26eceb62811", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_json/greaterthanorequal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "454f1a70db92580a1f0de192aa0209f2fb6117430cc74b66a474e1a14eb0f43c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_text", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_text/output.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "46aab8c9c31bfe8629bf51b02691f3945e8aac76fb6183dc524f5d98f14c9302", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_text/invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "85e5f3a335293a1f9535388ee3ad9bf47ce050c88ce757c77974ee54166ae4a5", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_text/timeout.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a5a325fedabf757dd5b41583d4ab6e9d873875a589fb74ce3a37e195674ff72e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_text/bad_operator.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "73d3e7b9d3b832fb1c0de8385f7cd21becd15869ab45532136f240d44529b2fe", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_text/contains.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27a9af7ecdf6e3d9173dca830c7ab0aa444ce9eda013b51daa28502183c3e115", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/lessthanorequal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c279087fbe0eee90dad2c36e4414b85a18e17629d9686b29ca31f0daf72c48d7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/output.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9e87642d6517ff975aa53d75babe308ea182de8dd6eb7bdc5b149238f18bc9d1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/notequal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39423a5eb1fdbfacd75002e4d3803940b38b926ec01cfd32e135a584d2dc3015", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3ed5904cbd3b1fcbbd9dd59c33a8e15a596a290e9ef694c8e4cdcedf6578551d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/timeout.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e481a3e06ec14cc518d4a57bdbc2347409d0716c4c25a5f15ffa687057775a49", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/bad_operator.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "007659ae2acf497b55555b91376a601353ed8c9993676355bb20b36a1f8104da", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/lessthan.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "64e0e3e82a28bfbc9a656ae5462df6a3983294f8bda558c6f17a8c2d6b640742", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/equal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6b171d836ac2617dd4f8dd6c6004f6f830f001e0f8b53c52f1ac16bbbfd5bfbb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/greaterthan.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5d1780ec8ac970d843d52088f55b0654cee688cc0944e081afc0a93b55ea584c", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/contains.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "75939f9e3ee413ea69fdb017855cc77bd56cc7a3eadbbe655fc0586731ed974d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tests/netconf_xml/greaterthanorequal.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b807adc1c36e28f33184d423e23e5936fbad9d9e993281889a3b25d5e171f9a1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tasks/netconf_text.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c627c44255ae1a8b669c83d2ef1ce9c0e6d29494b948e4a61f802e49a47aa6f", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tasks/netconf_xml.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4801df7e981a27418b43e336cee238767ab1fd93e1de1e382d74728973c333fd", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tasks/netconf_json.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "af996d1837cc9f8e14e9a7d19661cc030be9abbed5b06e6760f97041d806573a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a2d97d68a9f802d51a7b677cca0872b4061ea3c580298011a687593411cb80a6", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_command/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "03c73c1ce648bd2159b91cef3220d52324a7a5e3877f403199543c637c13d6f3", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1436b16458fa37427a22ff928796fdf87487b2adeed00e66d597b1adf638db19", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tests/netconf/net_vrf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6f0e765092f86aeb87d11d9949b7c4c22c90784a73c03be859e0acb563508e57", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vrf/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a338872666b36426f8178c87c8e3e75255610b1072aad021fc4b1f914234c1d7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "891eff3efd2c6da45ab4c6eae7a9f13844dc5388c2edbc1d7f77607185419da8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c29bf2b3ec81e4d4863f692c6b78d92839aac0fe8b2e3184a7c61157d3acc819", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/_reset_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eab40cbe0bd36c5b3bcede857987174ff293d05ba972d35d51efd1125b4112d8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f5c983a93440c30ab2b217c3ae22ba95018f7d9f4d05cd2f625536aa041eb590", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/_initial_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "024c7e8a85132618134e0b820e06732b2784b3acfe76398e9f0f9d6efe9efc74", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c7f90b061ee027119b869f2ffaae960f38edca1c018b56407b73670f76f1a755", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "473d4a04ba420bbf1802fd29096b47854243586f6d86b6e1150bbf6e0f4e0536", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9894ee154c7a39aa7a1e65d027dfc12b8643e1a3df53d3c09bbab9eeb44a1cf1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10424c95610118babd8fdbdc52672da7e4c5bfbea041001e4a12c516be2f9014", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_acl_interfaces/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc3467651622a454ffbd28b734a88a2f74115defecbfc3a52cbfb7e3205d09ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27081b3da41ea54f9afbdba678c922b70dc00cc9cac5ad1258ab8379461c59a0", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tests/netconf/net_l3_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "af00ae3b74009b9513dd5625f0873b6b40bae96a786f225797c34c935bcd74b9", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_l3_interface/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cd50362909950fd78c9703e904446d08d0405cadefbd072daea3c2d1a2b0911a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf/_base_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "02c5d5d9f5c4963798d24f7ab9ce131e4c5fd76bf25848c6643255192d7be327", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3bd734abb76908caa94e6197c6a45edb641bfdb00d85122a38ef2a47bbb0ee6d", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c4575f840f2a322adfb685e8151053800b58c2e2bce2ab355aa61dacfbabe985", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "820014f7504bd95bd62471666971025f90f534ba797550bcf72255230ac2c45e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c6f74755ef3b3d68068a81c21e1633a0aed6b1e7c9d92a253ea5d48dd9b855b1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6afdc43ecd84daa311d8627d8a67b20a1757bf6fc5924a358985ea2b41f0b109", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "efb275d54a7c21fd007e1d1c8b10b65d148a9121af425a4e7fbd60abacd23fc8", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_vlans/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f77f4c99dc8c5859f767074e5ebfc335d5f89c16d7ab6bda0819360b3d184778", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/_reset_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "37ccbb1ba682f1108159770df909dcd897cfe45c5911991d67f9a89ae9a3e452", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fd0c20fcefaf4120b637aa9a043d9cee7cb111e13943f96359ef15d51c230df1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c4b99983aa0a59957ec25e85107c2d8d7056af45e2dd62c960ec1d4c36f3fda1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/fixtures/parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "129e184759514be52b797768761f8d4e1b020b957b818ce09e399db83a17603a", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "36319f2312f79fb4bf804c4c7f14c885fbdd326ca9b4728c4b376ce0a6f70d57", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/_initial_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "388be0cd8528a952bfd42eebf50e3e15a551429e246c40c7d6fdb432d30d92f9", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cdedc16f9bb9408d8587f44f7ac03a249457d991e37d01b32a904cf76b757155", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cae688c9ad8d8e5e4b18cfda89c5b13270e48b93424444c5414721b96504b0cf", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/purged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dbe08df56a41c82490a9c8fc38f67b1e390f05bdfb1102ac8078067b562ea799", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "384c4c28442059ad5b12e52b3215a957cbd697ff2999998521b1e6fdc6982b22", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "861abea6cc6ac98e01bc313a205c5e7b8c1bfdec0afcf91bd61774befa9a551e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_bgp_global/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8744b509b0b48f0ebdffc46fe040e7bf7fac590c51fb9a2b4f53854743e85593", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "405ab245885eb3a3d3b00a42f3bcda5cecbd70f97987b2d95986ad2243f8b296", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c7b66cf4bb3939d67dca33bae6cabe2c68b50f8d87f7ffb788941bfd62f1e5ba", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf/_reset_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "82d29d85f4848a29778fb8911e9522f2b72bd78e55e7fd27d842c98f6e566287", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf/_initial_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "90569f75e0fc4c95b48976af3f0094176c1598ceae627e5acc4edb7463b48621", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6463ad5194c769ea05fe23b111ca60831e6fceb2364463cfddd8943864d30dd7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tests/netconf/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e5118b4741fbca7a7fc43bfce9b8e9f4d978945d8db009b49308ea27e1500bac", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9894ee154c7a39aa7a1e65d027dfc12b8643e1a3df53d3c09bbab9eeb44a1cf1", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10424c95610118babd8fdbdc52672da7e4c5bfbea041001e4a12c516be2f9014", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_ospf/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc3467651622a454ffbd28b734a88a2f74115defecbfc3a52cbfb7e3205d09ed", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tests/netconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tests/netconf/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "56b24ba3683bf1dc25fe331083f637b6ab288ee3bf7fff9931a7ab1dee948f83", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tests/netconf/net_static_route.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0fa3fcefa603e77396d4970f82eadd3aa433a09e0c92dd8d7061087f8c943ea7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/meta/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9bc68ec01fd23c20e3b8b8c51a032ab8839e7bb710a457f32a3627c9dd7f8591", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d7fb3a6ae0555c3d0fe2fa5882348e826f7fa2c93077008f261a0cee76b793c7", + "format": 1 + }, + { + "name": "tests/integration/targets/junos_static_route/tasks/netconf.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "55c4a9df9a69df56f03eb6b2646f51c14389e7b346e85955f17bf75769b6907b", + "format": 1 + }, + { + "name": "tox.ini", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9039261a0f29438fd967a63979a9d2dd8fadd3632bc775a7ff98ca2c6a8a7f4a", + "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": "0245f6aa7a73f59e1ae94f14978f3b282ede5e89e0876590fb46fa9696739b50", + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f4e81dbcfc94042d3098d5a74843ba74505f922b17d14e66858fe5315e637950", + "format": 1 + }, + { + "name": "requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "30cee7fcc1def8b75c62b7b7c6f3bb1cba2a08859c795df2e3f929bf5cb74a14", + "format": 1 + }, + { + "name": "docs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_acls_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b4ca643efb28a2b59a5047595943f3fdea9df9dd7df4efd712c2769bcf84e296", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_netconf_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9ecae4ee8ba770aab3ae4b2e60aa01b4d825833c29eed3455cc7e39332de2e0d", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_netconf.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6305f59a8b6033fc6fc9b5e68a6ef7a2003e802c2dc743aeb452a5c9216051ba", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_package_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "05e84b44dd5e8f0e3a81d4af1fd36633964a64245f051e6286ea3616b1d18366", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_command_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7d54b8ad4a1b448618c74f0dd2479527cb58ee554a24c183868198056f4f3d13", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_rpc_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2646bd4a31ee93ba50a83a3346a4e329a15c37f36c800b7ccf3a5f31ce2a6e65", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_system_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9dc621c273df59cd1fe3bd0c2a97cddcc545007a312592e482336885b0148751", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lacp_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "978dd55992043d3b7ec4b63970238e707c35d9385aeaac8fbef7264fb47f55dd", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_l3_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ae85306788c03d9960ab019b4099b9e034c54157bc7bf8eff0677c0d2a686673", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_scp_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7c3b8ad674d430e5199f1b0442054104f2521ea0c234e28d1d23446226b2e9a5", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_l2_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "71fe4f8945ce65c23bcd5ee588a89720da63f663dc6b4850585e785f785c519c", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_l2_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4b658f1e5257286b4b161969fbf998c7a86448aebf83e62de0d09e79d15a484a", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_bgp_global_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2ca84652b2fa5a72dfb0a633fb4177eff612eb8512735a53651ec3cc42e9301b", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_facts_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "734f6adca1e157f24fd33a986a7b6b40b1206830c328faa369551638966661bc", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_static_routes_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f1429c45b019e125d03ff552e0896bdc78ed4e12aeb621e3846546adb4a20507", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_vlan_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "85d5e96761b21710fe0725d461aeb1fec56e7c615144d5e7bad2af93ba00401a", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_acl_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e7c13238e1bb93830699e91c98d8f82a492708077f1a1038b1b57b05a828656b", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_l3_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9018fd1875b887627e1804f12655e0c6991903b0180eb1e4fa76b0aba323110b", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lag_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "36d5400e8598d86d9060d9af2caa216987bc972ad42562d11ed9196dbf771857", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_banner_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9337e9654429d65ab40858b8319a9a27080a606bd9e27cb6fd08e77f5fa1d01c", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_cliconf.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ea456cc09d913da8cf462b326e988e3125ba334d030bb83ce6f30b4710245c65", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39b4e178c76810bca645b7c90688b7029e4cfcbe71a85646df94727aa7082fd0", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_user_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "25a708c0cfcb6dcfc175c69d1f78839592cfc85ca0786d55733a0854ac26514c", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_static_route_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "aa0146dcd0aa81ec303cfbf545cca7d834e826329c2c5e6b3c98362c630a23a2", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_ping_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "167da196f60208868c19148d4b42281c4bc78240a2237f6b5de2a4563203aa93", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lldp_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6c75dd01a54844dfaefd48812717a586b0225c8a5cf9df60e9fe7ffa3185e1b4", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_vrf_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "37b960a86df55eabf9e209870f0b9913da73478f8ae47240d6f1ed5df360a914", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39c22e1e5d9c2bf2d12c0ea55aee8fdac8e0025db00947d941f3eb24741a19ad", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_ospfv3_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c1afb381787ffce1e4e008c090b26ebfe6b9c5cecdb7e7d60c97567ad459d1a", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lacp_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ffbeecae6323b644f732e52db7d332c214c506b2aa19148cf9dc0dba931a7b2f", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_ospf_interfaces_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "42cfa9ada2fa5552be6864aa4e20cf57c3089a6c7ffa5408af278dff58527446", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_linkagg_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8699e4b276802d5562659adfb565cf898727750630d183fb434efbb8536724d2", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_logging_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c18073613979e90920a9b50935b55ce50be55b27f6c5f2567120ed905d61adb0", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_ospfv2_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "255c8422b418e64d1484e147c9bcf3030ee72e72c6a053264d8de4287e17bd84", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_vlans_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "113f908b89013c835591593b261a1a83f72820d10864a782b42879d6bbf7efc1", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lldp_global_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a70269e3652b27a94dab6c442a114fed0cd552dc79ff2699c824f7b2ed354efc", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lldp_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b30c6b3a712a2a87a389ddafe71e266000c302b74c46b65b427e1658c1729423", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_config_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5386b21ef7214c5f5b015c000c5abda2f6b7c118a5f41249977a3e14be34161f", + "format": 1 + }, + { + "name": "docs/junipernetworks.junos.junos_lldp_interface_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc025d44c90db88a7d28abce174b467908cd210ff7a2d74792f527afe9986438", + "format": 1 + } + ], + "format": 1 +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/LICENSE b/collections-debian-merged/ansible_collections/junipernetworks/junos/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/MANIFEST.json b/collections-debian-merged/ansible_collections/junipernetworks/junos/MANIFEST.json new file mode 100644 index 00000000..d0317498 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/MANIFEST.json @@ -0,0 +1,37 @@ +{ + "collection_info": { + "namespace": "junipernetworks", + "name": "junos", + "version": "1.3.0", + "authors": [ + "Ansible Network Community (ansible-network)" + ], + "readme": "README.md", + "tags": [ + "juniper", + "junipernetworks", + "junos", + "networking", + "security", + "netconf" + ], + "description": "Ansible Network Collection for Junipernetworks Junos devices.", + "license": [], + "license_file": "LICENSE", + "dependencies": { + "ansible.netcommon": "*" + }, + "repository": "https://github.com/ansible-collections/junipernetworks.junos", + "documentation": null, + "homepage": null, + "issues": null + }, + "file_manifest_file": { + "name": "FILES.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f361a115b335e08936409c9d1837a03f21e1c99baef0d9230740421efc3794bf", + "format": 1 + }, + "format": 1 +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/README.md b/collections-debian-merged/ansible_collections/junipernetworks/junos/README.md new file mode 100644 index 00000000..7f7da993 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/README.md @@ -0,0 +1,161 @@ + + +# Juniper Networks Junos Collection +[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/junipernetworks.junos) + +The Ansible Juniper Networks Junos collection includes a variety of Ansible content to help automate the management of Juniper Networks Junos network appliances. + +This collection has been tested against Juniper Networks Junos OS 18.4R1. + + +## 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 Juniper Networks Junos collection supports ``network_cli`` and ``netconf`` connections. + +## Included content + + +### Cliconf plugins +Name | Description +--- | --- +[junipernetworks.junos.junos](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_cliconf.rst)|Use junos cliconf to run command on Juniper Junos OS platform + +### Netconf plugins +Name | Description +--- | --- +[junipernetworks.junos.junos](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_netconf.rst)|Use junos netconf plugin to run netconf commands on Juniper JUNOS platform + +### Modules +Name | Description +--- | --- +[junipernetworks.junos.junos_acl_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_acl_interfaces_module.rst)|ACL interfaces resource module +[junipernetworks.junos.junos_acls](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_acls_module.rst)|ACLs resource module +[junipernetworks.junos.junos_banner](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_banner_module.rst)|Manage multiline banners on Juniper JUNOS devices +[junipernetworks.junos.junos_bgp_global](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_bgp_global_module.rst)|Manages BGP Global configuration on devices running Juniper JUNOS. +[junipernetworks.junos.junos_command](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_command_module.rst)|Run arbitrary commands on an Juniper JUNOS device +[junipernetworks.junos.junos_config](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_config_module.rst)|Manage configuration on devices running Juniper JUNOS +[junipernetworks.junos.junos_facts](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_facts_module.rst)|Collect facts from remote devices running Juniper Junos +[junipernetworks.junos.junos_interface](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_interface_module.rst)|(deprecated, removed after 2022-06-01) Manage Interface on Juniper JUNOS network devices +[junipernetworks.junos.junos_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_interfaces_module.rst)|Junos Interfaces resource module +[junipernetworks.junos.junos_l2_interface](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_l2_interface_module.rst)|(deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper JUNOS network devices +[junipernetworks.junos.junos_l2_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_l2_interfaces_module.rst)|L2 interfaces resource module +[junipernetworks.junos.junos_l3_interface](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_l3_interface_module.rst)|(deprecated, removed after 2022-06-01) Manage L3 interfaces on Juniper JUNOS network devices +[junipernetworks.junos.junos_l3_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_l3_interfaces_module.rst)|L3 interfaces resource module +[junipernetworks.junos.junos_lacp](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lacp_module.rst)|Global Link Aggregation Control Protocol (LACP) Junos resource module +[junipernetworks.junos.junos_lacp_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lacp_interfaces_module.rst)|LACP interfaces resource module +[junipernetworks.junos.junos_lag_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lag_interfaces_module.rst)|Link Aggregation Juniper JUNOS resource module +[junipernetworks.junos.junos_linkagg](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_linkagg_module.rst)|(deprecated, removed after 2022-06-01) Manage link aggregation groups on Juniper JUNOS network devices +[junipernetworks.junos.junos_lldp](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lldp_module.rst)|(deprecated, removed after 2022-06-01) Manage LLDP configuration on Juniper JUNOS network devices +[junipernetworks.junos.junos_lldp_global](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lldp_global_module.rst)|LLDP resource module +[junipernetworks.junos.junos_lldp_interface](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lldp_interface_module.rst)|(deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on Juniper JUNOS network devices +[junipernetworks.junos.junos_lldp_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_lldp_interfaces_module.rst)|LLDP interfaces resource module +[junipernetworks.junos.junos_logging](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_logging_module.rst)|Manage logging on network devices +[junipernetworks.junos.junos_netconf](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_netconf_module.rst)|Configures the Junos Netconf system service +[junipernetworks.junos.junos_ospf_interfaces](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_ospf_interfaces_module.rst)|OSPF Interfaces Resource Module. +[junipernetworks.junos.junos_ospfv2](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_ospfv2_module.rst)|OSPFv2 resource module +[junipernetworks.junos.junos_ospfv3](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_ospfv3_module.rst)|OSPFv3 resource module +[junipernetworks.junos.junos_package](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_package_module.rst)|Installs packages on remote devices running Junos +[junipernetworks.junos.junos_ping](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_ping_module.rst)|Tests reachability using ping from devices running Juniper JUNOS +[junipernetworks.junos.junos_rpc](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_rpc_module.rst)|Runs an arbitrary RPC over NetConf on an Juniper JUNOS device +[junipernetworks.junos.junos_scp](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_scp_module.rst)|Transfer files from or to remote devices running Junos +[junipernetworks.junos.junos_static_route](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_static_route_module.rst)|(deprecated, removed after 2022-06-01) Manage static IP routes on Juniper JUNOS network devices +[junipernetworks.junos.junos_static_routes](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_static_routes_module.rst)|Static routes resource module +[junipernetworks.junos.junos_system](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_system_module.rst)|Manage the system attributes on Juniper JUNOS devices +[junipernetworks.junos.junos_user](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_user_module.rst)|Manage local user accounts on Juniper JUNOS devices +[junipernetworks.junos.junos_vlan](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_vlan_module.rst)|(deprecated, removed after 2022-06-01) Manage VLANs on Juniper JUNOS network devices +[junipernetworks.junos.junos_vlans](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_vlans_module.rst)|VLANs resource module +[junipernetworks.junos.junos_vrf](https://github.com/ansible-collections/junipernetworks.junos/blob/main/docs/junipernetworks.junos.junos_vrf_module.rst)|Manage the VRF definitions on Juniper JUNOS devices + + + +Click the ``Content`` button to see the list of content included in this collection. + +## Installing this collection + +You can install the Juniper Networks Junos collection with the Ansible Galaxy CLI: + + ansible-galaxy collection install junipernetworks.junos + +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: junipernetworks.junos +``` +## Using this collection + +You can call modules by their Fully Qualified Collection Namespace (FQCN), such as `junipernetworks.junos.junos_l2_interfaces`. +The following example task replaces configuration changes in the existing configuration on a Juniper Networks Junos network device, using the FQCN: + +```yaml +--- + - name: "Replace provided configuration with device configuration" + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + 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: + +* [Juniper Junos Platform options](https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.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 [Juniper Networks Junos collection repository](https://github.com/ansible-collections/junipernetworks.junos). 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/junipernetworks.junos/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/junipernetworks/junos/bindep.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/bindep.txt new file mode 100644 index 00000000..ba9c980f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/changelogs/CHANGELOG.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/CHANGELOG.rst new file mode 100644 index 00000000..56f71f2a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/CHANGELOG.rst @@ -0,0 +1,143 @@ +============================================== +Junipernetworks Junos Collection Release Notes +============================================== + +.. contents:: Topics + + +v1.3.0 +====== + +Minor Changes +------------- + +- Add junos bgp global resource module. +- Add ospf interfaces resource module. + +Bugfixes +-------- + +- changing prefix list type to list and correcting facts gathering (https://github.com/ansible-collections/junipernetworks.junos/issues/131) +- constructing the facts based on the addresses per unit (https://github.com/ansible-collections/junipernetworks.junos/issues/111) +- release version added updated to 1.3.0 for junos_ospf_interfaces and junos_bgp_global module + +New Modules +----------- + +- junos_bgp_global - Manages BGP Global configuration on devices running Juniper JUNOS. +- junos_ospf_interfaces - OSPF Interfaces Resource Module. + +v1.2.1 +====== + +Bugfixes +-------- + +- Add version key to galaxy.yaml to work around ansible-galaxy bug +- Updating unit tests for resource modules (https://github.com/ansible-collections/junipernetworks.junos/pull/127) +- allowing partial config filter for junos commands (https://github.com/ansible-collections/junipernetworks.junos/issues/112) +- checking for units and family attributes in conf dictionary (https://github.com/ansible-collections/junipernetworks.junos/issues/121) + +v1.2.0 +====== + +Minor Changes +------------- + +- Add ospfv3 resource module. + +New Modules +----------- + +- junos_ospfv3 - OSPFv3 resource module + +v1.1.1 +====== + +Minor Changes +------------- + +- Use FQCN to M() references in modules documentation (https://github.com/ansible-collections/junipernetworks.junos/pull/79) + +v1.1.0 +====== + +Minor Changes +------------- + +- Gathered state operation enabled, Parsed and rendered state operations implemented for junos_lacp. +- Gathered state operation enabled, Parsed and rendered state operations implemented for junos_lldp_global. +- Gathered state operation enabled, Parsed and rendered state operations implemented for junos_lldp_interfaces. +- Gathered state operation enabled, Parsed and rendered state operations implemented for ospfv2, acl_interfaces, vlans and static_routes RM. +- Gathered state operation enabled. Parsed and rendered state operations implemented. +- Gathered state operation enabledand Parsed and rendered state operations implemented. + +Bugfixes +-------- + +- set_config called only when state is not gathered so that gathered opeartion works fine (https://github.com/ansible-collections/junipernetworks.junos/issues/89). +- set_config called only when state is not gathered so that gathered opeartion works fine (https://github.com/ansible-collections/junipernetworks.junos/issues/93). +- set_config called only when state is not gathered so that gathered opeartion works fine for l2_interfaces resource module (https://github.com/ansible-collections/junipernetworks.junos/issues/91). + +v1.0.1 +====== + +Bugfixes +-------- + +- Make `src`, `backup` and `backup_options` in junos_config work when module alias is used (https://github.com/ansible-collections/junipernetworks.junos/pull/83). +- Update docs after sanity fixes to modules. + +v1.0.0 +====== + +New Plugins +----------- + +Cliconf +~~~~~~~ + +- junos - Use junos cliconf to run command on Juniper Junos OS platform + +Netconf +~~~~~~~ + +- junos - Use junos netconf plugin to run netconf commands on Juniper JUNOS platform + +New Modules +----------- + +- junos_acl_interfaces - ACL interfaces resource module +- junos_acls - ACLs resource module +- junos_banner - Manage multiline banners on Juniper JUNOS devices +- junos_command - Run arbitrary commands on an Juniper JUNOS device +- junos_config - Manage configuration on devices running Juniper JUNOS +- junos_facts - Collect facts from remote devices running Juniper Junos +- junos_interface - (deprecated, removed after 2022-06-01) Manage Interface on Juniper JUNOS network devices +- junos_interfaces - Junos Interfaces resource module +- junos_l2_interface - (deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper JUNOS network devices +- junos_l2_interfaces - L2 interfaces resource module +- junos_l3_interface - (deprecated, removed after 2022-06-01) Manage L3 interfaces on Juniper JUNOS network devices +- junos_l3_interfaces - L3 interfaces resource module +- junos_lacp - Global Link Aggregation Control Protocol (LACP) Junos resource module +- junos_lacp_interfaces - LACP interfaces resource module +- junos_lag_interfaces - Link Aggregation Juniper JUNOS resource module +- junos_linkagg - (deprecated, removed after 2022-06-01) Manage link aggregation groups on Juniper JUNOS network devices +- junos_lldp - (deprecated, removed after 2022-06-01) Manage LLDP configuration on Juniper JUNOS network devices +- junos_lldp_global - LLDP resource module +- junos_lldp_interface - (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on Juniper JUNOS network devices +- junos_lldp_interfaces - LLDP interfaces resource module +- junos_logging - Manage logging on network devices +- junos_netconf - Configures the Junos Netconf system service +- junos_ospfv2 - OSPFv2 resource module +- junos_package - Installs packages on remote devices running Junos +- junos_ping - Tests reachability using ping from devices running Juniper JUNOS +- junos_rpc - Runs an arbitrary RPC over NetConf on an Juniper JUNOS device +- junos_scp - Transfer files from or to remote devices running Junos +- junos_static_route - (deprecated, removed after 2022-06-01) Manage static IP routes on Juniper JUNOS network devices +- junos_static_routes - Static routes resource module +- junos_system - Manage the system attributes on Juniper JUNOS devices +- junos_user - Manage local user accounts on Juniper JUNOS devices +- junos_vlan - (deprecated, removed after 2022-06-01) Manage VLANs on Juniper JUNOS network devices +- junos_vlans - VLANs resource module +- junos_vrf - Manage the VRF definitions on Juniper JUNOS devices diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/changelog.yaml new file mode 100644 index 00000000..f382689d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/changelog.yaml @@ -0,0 +1,222 @@ +ancestor: null +releases: + 1.0.0: + modules: + - description: ACL interfaces resource module + name: junos_acl_interfaces + namespace: '' + - description: ACLs resource module + name: junos_acls + namespace: '' + - description: Manage multiline banners on Juniper JUNOS devices + name: junos_banner + namespace: '' + - description: Run arbitrary commands on an Juniper JUNOS device + name: junos_command + namespace: '' + - description: Manage configuration on devices running Juniper JUNOS + name: junos_config + namespace: '' + - description: Collect facts from remote devices running Juniper Junos + name: junos_facts + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage Interface on Juniper + JUNOS network devices + name: junos_interface + namespace: '' + - description: Junos Interfaces resource module + name: junos_interfaces + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper + JUNOS network devices + name: junos_l2_interface + namespace: '' + - description: L2 interfaces resource module + name: junos_l2_interfaces + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage L3 interfaces on + Juniper JUNOS network devices + name: junos_l3_interface + namespace: '' + - description: L3 interfaces resource module + name: junos_l3_interfaces + namespace: '' + - description: Global Link Aggregation Control Protocol (LACP) Junos resource + module + name: junos_lacp + namespace: '' + - description: LACP interfaces resource module + name: junos_lacp_interfaces + namespace: '' + - description: Link Aggregation Juniper JUNOS resource module + name: junos_lag_interfaces + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage link aggregation + groups on Juniper JUNOS network devices + name: junos_linkagg + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage LLDP configuration + on Juniper JUNOS network devices + name: junos_lldp + namespace: '' + - description: LLDP resource module + name: junos_lldp_global + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration + on Juniper JUNOS network devices + name: junos_lldp_interface + namespace: '' + - description: LLDP interfaces resource module + name: junos_lldp_interfaces + namespace: '' + - description: Manage logging on network devices + name: junos_logging + namespace: '' + - description: Configures the Junos Netconf system service + name: junos_netconf + namespace: '' + - description: OSPFv2 resource module + name: junos_ospfv2 + namespace: '' + - description: Installs packages on remote devices running Junos + name: junos_package + namespace: '' + - description: Tests reachability using ping from devices running Juniper JUNOS + name: junos_ping + namespace: '' + - description: Runs an arbitrary RPC over NetConf on an Juniper JUNOS device + name: junos_rpc + namespace: '' + - description: Transfer files from or to remote devices running Junos + name: junos_scp + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage static IP routes + on Juniper JUNOS network devices + name: junos_static_route + namespace: '' + - description: Static routes resource module + name: junos_static_routes + namespace: '' + - description: Manage the system attributes on Juniper JUNOS devices + name: junos_system + namespace: '' + - description: Manage local user accounts on Juniper JUNOS devices + name: junos_user + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage VLANs on Juniper + JUNOS network devices + name: junos_vlan + namespace: '' + - description: VLANs resource module + name: junos_vlans + namespace: '' + - description: Manage the VRF definitions on Juniper JUNOS devices + name: junos_vrf + namespace: '' + plugins: + cliconf: + - description: Use junos cliconf to run command on Juniper Junos OS platform + name: junos + namespace: null + netconf: + - description: Use junos netconf plugin to run netconf commands on Juniper JUNOS + platform + name: junos + namespace: null + release_date: '2020-06-23' + 1.0.1: + changes: + bugfixes: + - Make `src`, `backup` and `backup_options` in junos_config work when module + alias is used (https://github.com/ansible-collections/junipernetworks.junos/pull/83). + - Update docs after sanity fixes to modules. + fragments: + - fix_config_module_src_backup.yaml + - update_docs.yaml + release_date: '2020-08-07' + 1.1.0: + changes: + bugfixes: + - set_config called only when state is not gathered so that gathered opeartion + works fine (https://github.com/ansible-collections/junipernetworks.junos/issues/89). + - set_config called only when state is not gathered so that gathered opeartion + works fine (https://github.com/ansible-collections/junipernetworks.junos/issues/93). + - set_config called only when state is not gathered so that gathered opeartion + works fine for l2_interfaces resource module (https://github.com/ansible-collections/junipernetworks.junos/issues/91). + minor_changes: + - Gathered state operation enabled, Parsed and rendered state operations implemented + for junos_lacp. + - Gathered state operation enabled, Parsed and rendered state operations implemented + for junos_lldp_global. + - Gathered state operation enabled, Parsed and rendered state operations implemented + for junos_lldp_interfaces. + - Gathered state operation enabled, Parsed and rendered state operations implemented + for ospfv2, acl_interfaces, vlans and static_routes RM. + - Gathered state operation enabled. Parsed and rendered state operations implemented. + - Gathered state operation enabledand Parsed and rendered state operations implemented. + fragments: + - 89_gathered_opr_fix_junos_interfaces.yaml + - 91_gathered_opr_fix_junos_l2interfaces.yaml + - 93_gathered_opr_fix_junos_l3_interfaces.yaml + - junos_rm_state_opr_updated.yaml + - lacp_global_state_opr_updated.yaml + - lacp_interfaces_state_opr_updated.yaml + - lag_interfaces_state_opr_updated.yaml + - lldp_global_state_opr_updated.yaml + - lldp_interfaces_state_opr_added.yaml + release_date: '2020-08-31' + 1.1.1: + changes: + minor_changes: + - Use FQCN to M() references in modules documentation (https://github.com/ansible-collections/junipernetworks.junos/pull/79) + fragments: + - 79-Use-FQCN-to-M-references + release_date: '2020-10-01' + 1.2.0: + changes: + minor_changes: + - Add ospfv3 resource module. + fragments: + - add_junos_ospfv3.yaml + modules: + - description: OSPFv3 resource module + name: junos_ospfv3 + namespace: '' + release_date: '2020-10-30' + 1.2.1: + changes: + bugfixes: + - Add version key to galaxy.yaml to work around ansible-galaxy bug + - Updating unit tests for resource modules (https://github.com/ansible-collections/junipernetworks.junos/pull/127) + - allowing partial config filter for junos commands (https://github.com/ansible-collections/junipernetworks.junos/issues/112) + - checking for units and family attributes in conf dictionary (https://github.com/ansible-collections/junipernetworks.junos/issues/121) + fragments: + - 112_partial_config_fix.yaml + - 121_error_with_junos_acl_interfaces_facts.yaml + - galaxy-version.yaml + - unit_tests_updates.yaml + release_date: '2020-11-26' + 1.3.0: + changes: + bugfixes: + - changing prefix list type to list and correcting facts gathering (https://github.com/ansible-collections/junipernetworks.junos/issues/131) + - constructing the facts based on the addresses per unit (https://github.com/ansible-collections/junipernetworks.junos/issues/111) + - release version added updated to 1.3.0 for junos_ospf_interfaces and junos_bgp_global + module + minor_changes: + - Add junos bgp global resource module. + - Add ospf interfaces resource module. + fragments: + - junos_acl_prefix_list_fix.yaml + - junos_bgp_global_module.yaml + - junos_l3_interfaces_unit_fix.yaml + - junos_ospf_interfaces.yaml + - junos_version_added_updated.yaml + modules: + - description: Manages BGP Global configuration on devices running Juniper JUNOS. + name: junos_bgp_global + namespace: '' + - description: OSPF Interfaces Resource Module. + name: junos_ospf_interfaces + namespace: '' + release_date: '2021-01-28' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/changelogs/config.yaml new file mode 100644 index 00000000..952ffabb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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: Junipernetworks Junos Collection +trivial_section_name: trivial diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acl_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acl_interfaces_module.rst new file mode 100644 index 00000000..55faeffc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acl_interfaces_module.rst @@ -0,0 +1,508 @@ +.. _junipernetworks.junos.junos_acl_interfaces_module: + + +****************************************** +junipernetworks.junos.junos_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 Juniper JUNOS. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) + + +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 interface.
+
+
+ acls + +
+ list + / elements=dictionary +
+
+ +
Specifies the ACLs for the provided AFI.
+
+
+ direction + +
+ string +
+
+
    Choices: +
  • in
  • +
  • out
  • +
+
+
Specifies the direction of packets that the ACL will be applied on.
+
+
+ name + +
+ string +
+
+ +
Specifies the name of the IPv4/IPv4 ACL for the interface.
+
+
+ afi + +
+ string +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
Specifies the AFI for the ACL(s) to be configured on this interface.
+
+
+ name + +
+ string +
+
+ +
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 Junos device by executing the command show interfaces.
+
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:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using deleted + + # Before state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface with filter"; + # unit 0 { + # family inet { + # filter { + # input inbound_acl; + # output outbound_acl; + # } + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + - name: Delete JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + - name: outbound_acl + direction: out + state: deleted + + # After state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface with filter"; + # unit 0 { + # family inet { + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + + # Using merged + + # Before state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface without filter"; + # unit 0 { + # family inet { + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + - name: Merge JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + - name: outbound_acl + direction: out + state: merged + + # After state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface with filter"; + # unit 0 { + # family inet { + # filter { + # input inbound_acl; + # output outbound_acl; + # } + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + + # Using overridden + + # Before state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface without filter"; + # unit 0 { + # family inet { + # filter { + # input foo_acl; + # } + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + - name: Override JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + - name: outbound_acl + direction: out + state: overridden + + # After state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface with filter"; + # unit 0 { + # family inet { + # filter { + # input inbound_acl; + # output outbound_acl; + # } + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + + # Using replaced + + # Before state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface without filter"; + # unit 0 { + # family inet { + # filter { + # input foo_acl; + # output outbound_acl; + # } + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + - name: Replace JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + state: replaced + + # After state: + # ------------- + # + # admin# show interfaces + # ge-1/0/0 { + # description "L3 interface with filter"; + # unit 0 { + # family inet { + # filter { + # input inbound_acl; + # output outbound_acl; + # } + # address 100.64.0.1/10; + # address 100.64.0.2/10; + # } + # family inet6; + # } + + + +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:
+
['command 1', 'command 2', 'command 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Daniel Mellado (@dmellado) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acls_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acls_module.rst new file mode 100644 index 00000000..dcf64c89 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_acls_module.rst @@ -0,0 +1,1257 @@ +.. _junipernetworks.junos.junos_acls_module: + + +******************************** +junipernetworks.junos.junos_acls +******************************** + +**ACLs resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of acls/filters on Juniper JUNOS devices + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of acls options
+
+
+ acls + +
+ list + / elements=dictionary +
+
+ +
List of Access Control Lists (ACLs).
+
+
+ aces + +
+ list + / elements=dictionary +
+
+ +
List of Access Control Entries (ACEs) for this Access Control List (ACL).
+
+
+ destination + +
+ dictionary +
+
+ +
Specifies the destination for the filter
+
+
+ address + +
+ string +
+
+ +
Match IP destination address
+
+
+ port_protocol + +
+ dictionary +
+
+ +
Specify the destination port or protocol.
+
+
+ eq + +
+ string +
+
+ +
Match only packets on a given port number.
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of port numbers
+
+
+ end + +
+ integer +
+
+ +
Specify the end of the port range
+
+
+ start + +
+ integer +
+
+ +
Specify the start of the port range
+
+
+ prefix_list + +
+ list + / elements=dictionary +
+
+ +
Match IP destination prefixes in named list
+
+
+ name + +
+ string +
+
+ +
Name of the list
+
+
+ grant + +
+ string +
+
+
    Choices: +
  • permit
  • +
  • deny
  • +
+
+
Action to take after matching condition (allow, discard/reject)
+
+
+ name + +
+ string + / required +
+
+ +
Filter term name
+
+
+ protocol + +
+ string +
+
+ +
Specify the protocol to match.
+
Refer to vendor documentation for valid values.
+
+
+ protocol_options + +
+ dictionary +
+
+ +
All possible suboptions for the protocol chosen.
+
+
+ icmp + +
+ dictionary +
+
+ +
ICMP protocol options.
+
+
+ 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
+
+
+ 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
+
+
+ net_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Network redirect
+
+
+ net_tos_redirect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Net redirect for TOS
+
+
+ network_unknown + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Network unknown
+
+
+ port_unreachable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Port unreachable
+
+
+ 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_route_failed + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Source route failed
+
+
+ time_exceeded + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
All time exceeded.
+
+
+ ttl_exceeded + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
TTL exceeded
+
+
+ source + +
+ dictionary +
+
+ +
Specifies the source for the filter
+
+
+ address + +
+ string +
+
+ +
IP source address to use for the filter
+
+
+ port_protocol + +
+ dictionary +
+
+ +
Specify the source port or protocol.
+
+
+ eq + +
+ string +
+
+ +
Match only packets on a given port number.
+
+
+ range + +
+ dictionary +
+
+ +
Match only packets in the range of port numbers
+
+
+ end + +
+ integer +
+
+ +
Specify the end of the port range
+
+
+ start + +
+ integer +
+
+ +
Specify the start of the port range
+
+
+ prefix_list + +
+ list + / elements=dictionary +
+
+ +
IP source prefix list to use for the filter
+
+
+ name + +
+ string +
+
+ +
Name of the list
+
+
+ name + +
+ string + / required +
+
+ +
Name to use for the acl filter
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
Protocol family to use by the acl filter
+
+
+ state + +
+ string +
+
+
    Choices: +
  • merged ←
  • +
  • replaced
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
+
+
The state the configuration should be left in
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # admin# show firewall + + - name: Merge JUNOS acl + junipernetworks.junos.junos_acls: + config: + - afi: ipv4 + acls: + - name: allow_ssh_acl + aces: + - name: ssh_rule + source: + port_protocol: + eq: ssh + protocol: tcp + state: merged + + # After state: + # ------------- + # admin# show firewall + # family inet { + # filter allow_ssh_acl { + # term ssh_rule { + # from { + # protocol tcp; + # source-port ssh; + # } + # } + # } + # } + + + +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:
+
['command 1', 'command 2', 'command 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Daniel Mellado (@dmellado) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_banner_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_banner_module.rst new file mode 100644 index 00000000..f2fe682d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_banner_module.rst @@ -0,0 +1,348 @@ +.. _junipernetworks.junos.junos_banner_module: + + +********************************** +junipernetworks.junos.junos_banner +********************************** + +**Manage multiline banners on Juniper JUNOS devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This will configure both login and motd banners on network devices. It allows playbooks to add or remote banner text from the active running configuration. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ banner + +
+ string + / required +
+
+
    Choices: +
  • login
  • +
  • motd
  • +
+
+
Specifies which banner that should be configured on the remote device. Value login indicates system login message prior to authenticating, motd is login announcement after successful authentication.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 whether or not the configuration is present in the current devices active running configuration.
+
+
+ text + +
+ string +
+
+ +
The banner text that should be present in the remote device running configuration. This argument accepts a multiline string, with no empty lines. Requires state=present.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure the login banner + junipernetworks.junos.junos_banner: + banner: login + text: | + this is my login banner + that contains a multiline + string + state: present + + - name: remove the motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: absent + + - name: deactivate the motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: present + active: false + + - name: activate the motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: present + active: true + + - name: Configure banner from file + junipernetworks.junos.junos_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
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit system login] + message "this is my login banner";
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_bgp_global_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_bgp_global_module.rst new file mode 100644 index 00000000..2cd9affe --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_bgp_global_module.rst @@ -0,0 +1,7478 @@ +.. _junipernetworks.junos.junos_bgp_global_module: + + +************************************** +junipernetworks.junos.junos_bgp_global +************************************** + +**Manages BGP Global configuration on devices running Juniper JUNOS.** + + +Version added: 1.3.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages global bgp configuration on devices running Juniper JUNOS. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
A list of BGP process configuration.
+
+
+ accept_remote_nexthop + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Allow import policy to specify a non-directly connected next-hop.
+
+
+ add_path_display_ipv4_address + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Display add-path path-id in IPv4 address format.
+
+
+ advertise_bgp_static + +
+ dictionary +
+
+ +
Advertise bgp-static routes.
+
+
+ policy + +
+ string +
+
+ +
Specify static route advertisement policy.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Advertise bgp-static routes.
+
+
+ advertise_external + +
+ dictionary +
+
+ +
Advertise best external routes.
+
+
+ conditional + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Route matches active route upto med-comparison rule.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Advertise best external routes.
+
+
+ advertise_from_main_vpn_tables + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Advertise VPN routes from bgp.Xvpn.0 tables in master instance.
+
+
+ advertise_inactive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Advertise inactive routes.
+
+
+ advertise_peer_as + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Advertise routes received from the same autonomous system.
+
+
+ as_number + +
+ string +
+
+ +
Specify Autonomous system number.
+
+
+ authentication_algorithm + +
+ string +
+
+
    Choices: +
  • aes-128-cmac-96
  • +
  • hmac-sha-1-96
  • +
  • md5
  • +
+
+
Specify authentication algorithm name.
+
+
+ authentication_key + +
+ string +
+
+ +
Specify MD5 authentication key.
+
+
+ authentication_key_chain + +
+ string +
+
+ +
Specify authentication key chain name.
+
+
+ bfd_liveness_detection + +
+ dictionary +
+
+ +
Bidirectional Forwarding Detection (BFD) options.
+
+
+ authentication + +
+ dictionary +
+
+ +
Authentication options.
+
+
+ algorithm + +
+ string +
+
+
    Choices: +
  • keyed-md5
  • +
  • keyed-sha-1
  • +
  • meticulous-keyed-md5
  • +
  • meticulous-keyed-sha-1
  • +
  • simple-password
  • +
+
+
Specify algorithm name.
+
+
+ key_chain + +
+ string +
+
+ +
Specify Key chain name.
+
+
+ loose_check + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Verify authentication only if authentication is negotiated.
+
+
+ detection_time + +
+ dictionary +
+
+ +
Specify Detection-time optionss.
+
+
+ threshold + +
+ integer +
+
+ +
Specify high detection-time triggering a trap (milliseconds).
+
+
+ holddown_interval + +
+ integer +
+
+ +
Specify time to hold the session-UP notification to the client.
+
+
+ minimum_interval + +
+ integer +
+
+ +
Specify minimum transmit and receive interval.
+
+
+ minimum_receive_interval + +
+ integer +
+
+ +
Specify minimum receive interval.
+
+
+ multiplier + +
+ integer +
+
+ +
Specify detection time multiplier.
+
+
+ no_adaptation + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable adaptation.
+
+
+ session_mode + +
+ string +
+
+
    Choices: +
  • automatic
  • +
  • multihop
  • +
  • single-hop
  • +
+
+
BFD single-hop or multihop session-mode.
+
+
+ transmit_interval + +
+ dictionary +
+
+ +
Transmit-interval options.
+
+
+ minimum_interval + +
+ integer +
+
+ +
Specify Minimum transmit interval.
+
+
+ threshold + +
+ integer +
+
+ +
Specify high transmit interval triggering a trap.
+
+
+ version + +
+ string +
+
+
    Choices: +
  • 0
  • +
  • 1
  • +
  • automatic
  • +
+
+
Specify BFD protocol version number.
+
+
+ bgp_error_tolerance + +
+ dictionary +
+
+ +
Handle BGP malformed updates softly.
+
+
+ malformed_route_limit + +
+ integer +
+
+ +
Maximum number of malformed routes from a peer.
+
+
+ malformed_update_log_interval + +
+ integer +
+
+ +
Time used when logging malformed update.
+
+
+ no_malformed_route_limit + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify no malformed route limit.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set BGP malformed updates softly.
+
+
+ bmp + +
+ dictionary +
+
+ +
Specific settings to override the routing-options settings.
+
+
+ monitor + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable/Disable monitoring.
+
+
+ route_monitoring + +
+ dictionary +
+
+ +
Control route monitoring settings.
+
+
+ none + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send route montoring messages.
+
+
+ post_policy + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Send post policy route montoring messages.
+
+
+ post_policy_exclude_non_eligible + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Send post policy route montoring messages and exclude unresolved routes, etc.
+
+
+ post_policy_exclude_non_feasible + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Send pre policy route montoring messages and exclude looped routes, etc.
+
+
+ pre_policy + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Send pre policy route montoring messages.
+
+
+ cluster_id + +
+ string +
+
+ +
Specify cluster identifier.
+
+
+ damping + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable route flap damping.
+
+
+ description + +
+ string +
+
+ +
Specify text description.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable BGP.
+
+
+ egress_te + +
+ dictionary +
+
+ +
Use Egress Peering traffic engineering.
+
+
+ backup_path + +
+ string +
+
+ +
The 'egress-te-backup-paths template' to use for this peer.
+
+
+ egress_te_backup_paths + +
+ dictionary +
+
+ +
Backup-path for Egress-TE peer interface failure.
+
+
+ peer_addr + +
+ string +
+
+ +
Specify address of BGP peer to use as backup next-hop.
+
+
+ remote_nexthop + +
+ string +
+
+ +
Specify address of remote-nexthop to use as backup path.
+
+
+ template + +
+ dictionary +
+
+ +
Specify Backup-path template.
+
+
+ ip_forward + +
+ dictionary +
+
+ +
Use IP-forward backup path for Egress TE.
+
+
+ rti_name + +
+ string +
+
+ +
Routing-instance to use as IP forward backup-path.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set use IP-forward backup path for Egress TE.
+
+
+ path_name + +
+ string +
+
+ +
Name of Egress-TE backup path.
+
+
+ egress_te_set_segment + +
+ dictionary +
+
+ +
Configure BGP-Peer-Set segment.
+
+
+ egress_te_backup_segment_label + +
+ integer +
+
+ +
BGP-Peer-Set SID label value from static label pool.
+
+
+ label + +
+ integer +
+
+ +
Backup segment label value from static label pool.
+
+
+ name + +
+ string +
+
+ +
The BGP-Peer-Set segment name.
+
+
+ egress_te_sid_stats + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Create BGP-Peer-SID sensor.
+
+
+ enforce_first_as + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enforce neighbor AS is the first AS in AS-PATH attribute (EBGP).
+
+
+ export + +
+ string +
+
+ +
Specify export policy.
+
+
+ forwarding_context + +
+ string +
+
+ +
Specify routing-instance used for data-forwarding and transport-session.
+
+
+ graceful_restart + +
+ dictionary +
+
+ +
BGP graceful restart options.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable graceful restart.
+
+
+ dont_help_shared_fate_bfd_down + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Honor BFD-Down(C=0) if GR-restart not in progress.
+
+
+ forwarding_state_bit + +
+ dictionary +
+
+ +
Control forwarding-state flag negotiation.
+
+
+ as_rr_client + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
As for a route reflector client.
+
+
+ from_fib + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Always use state of associated FIs.
+
+
+ long_lived + +
+ dictionary +
+
+ +
Long-lived graceful restart options.
+
+
+ advertise_to_non_llgr_neighbor + +
+ dictionary +
+
+ +
Advertise stale routes to non-LLGR neighbors.
+
+
+ omit_no_export + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Advertise stale routes to non-LLGR neighbors.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Advertise stale routes to non-LLGR neighbors.
+
+
+ receiver_disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable receiver (helper) functionality.
+
+
+ restart_time + +
+ integer +
+
+ +
Restart time used when negotiating with a peer.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set BGP graceful restart options.
+
+
+ stale_routes_time + +
+ integer +
+
+ +
Maximum time for which stale routes are kept.
+
+
+ hold_time + +
+ integer +
+
+ +
Specify hold time used when negotiating with a peer.
+
+
+ holddown_all_stale_labels + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hold all BGP stale-labels, facilating make-before-break for new label advertisements.
+
+
+ idle_after_switch_over + +
+ dictionary +
+
+ +
Stop peer session from coming up after nonstop-routing switch-over.
+
+
+ forever + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Idle the peer until the user intervenes.
+
+
+ timeout + +
+ integer +
+
+ +
Specify timeout value, in seconds, for starting peer after switch over.
+
+
+ import + +
+ string +
+
+ +
Specify import policy.
+
+
+ include_mp_next_hop + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Include NEXT-HOP attribute in multiprotocol updates.
+
+
+ ipsec_sa + +
+ string +
+
+ +
Specify IPSec SA name.
+
+
+ keep + +
+ string +
+
+
    Choices: +
  • all
  • +
  • none
  • +
+
+
Specify how to retain routes in the routing table.
+
+
+ local_address + +
+ string +
+
+ +
Specify Address of local end of BGP session.
+
+
+ local_as + +
+ dictionary +
+
+ +
Local autonomous system number.
+
+
+ alias + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Treat this AS as an alias to the system AS.
+
+
+ as_num + +
+ string +
+
+ +
Autonomous system number in plain number or (asdot notation) format.
+
+
+ loops + +
+ integer +
+
+ +
Maximum number of times this AS can be in an AS path.
+
+
+ no_prepend_global_as + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Maximum number of times this AS can be in an AS path.
+
+
+ private + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Hide this local AS in paths learned from this peering.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set local autonomous system number.
+
+
+ local_interface + +
+ string +
+
+ +
Specify Local interface for IPv6 link local EBGP peering.
+
+
+ local_preference + +
+ string +
+
+ +
Specify value of LOCAL_PREF path attribute.
+
+
+ log_updown + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable log a message for peer state transitions.
+
+
+ metric_out + +
+ dictionary +
+
+ +
Specify route metric sent in MED.
+
+
+ igp + +
+ dictionary +
+
+ +
Track the IGP metric.
+
+
+ delay_med_update + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Delay updating MED when IGP metric increases.
+
+
+ metric_offset + +
+ integer +
+
+ +
Specify metric offset for MED.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set track the IGP metric.
+
+
+ metric_value + +
+ integer +
+
+ +
Specify metric value.
+
+
+ minimum_igp + +
+ dictionary +
+
+ +
Track the minimum IGP metric.
+
+
+ metric_offset + +
+ integer +
+
+ +
Specify metric offset for MED.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set track the minimum IGP metric.
+
+
+ mtu_discovery + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable TCP path MTU discovery.
+
+
+ multihop + +
+ dictionary +
+
+ +
Configure an EBGP multihop session.
+
+
+ no_nexthop_change + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not change next hop to self in advertisements.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set an EBGP multihop session.
+
+
+ ttl + +
+ integer +
+
+ +
TTL value for the session.
+
+
+ multipath + +
+ dictionary +
+
+ +
Allow load sharing among multiple BGP paths.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable Multipath.
+
+
+ multiple_as + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable Multipath.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set allow load sharing among multiple BGP paths.
+
+
+ multipath_build_priority + +
+ string +
+
+
    Choices: +
  • low
  • +
  • medium
  • +
+
+
Configure the multipath build priority.
+
+
+ no_advertise_peer_as + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Allows to not advertise routes received from the same autonomous system.
+
+
+ no_aggregator_id + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set router ID in aggregator path attribute to 0.
+
+
+ no_client_reflect + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable intracluster route redistribution.
+
+
+ no_precision_timers + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify not to use precision timers for scheduling keepalives.
+
+
+ out_delay + +
+ integer +
+
+ +
Specify how long before exporting routes from routing table.
+
+
+ outbound_route_filter + +
+ dictionary +
+
+ +
Dynamically negotiated cooperative route filtering.
+
+
+ bgp_orf_cisco_mode + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Using BGP ORF capability code 130 and Prefix ORF type 128.
+
+
+ prefix_based + +
+ dictionary +
+
+ +
Prefix-based outbound route filtering.
+
+
+ accept + +
+ dictionary +
+
+ +
Honor Prefix-based ORFs from remote peers.
+
+
+ inet + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Honor IPv4 prefix filters.
+
+
+ inet6 + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Honor IPv6 prefix filters.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set honor Prefix-based ORFs from remote peers.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set prefix-based outbound route filtering.
+
+
+ output_queue_priority + +
+ dictionary +
+
+ +
BGP output queue priority scheduler for updates.
+
+
+ defaults + +
+ dictionary +
+
+ +
Map policy's priority class and BGP output-queue.
+
+
+ high + +
+ dictionary +
+
+ +
Assign the 'high' priority class to this output-queue.
+
+
+ expedited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Expedited queue; highest priority.
+
+
+ priority + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify output queue priorit.
+
+
+ low + +
+ dictionary +
+
+ +
Assign the 'low' priority class to this output-queue.
+
+
+ expedited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Expedited queue; highest priority.
+
+
+ priority + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify output queue priorit.
+
+
+ medium + +
+ dictionary +
+
+ +
Assign the 'medium' priority class to this output-queue.
+
+
+ expedited + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Expedited queue; highest priority.
+
+
+ priority + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify output queue priorit.
+
+
+ expedited + +
+ dictionary +
+
+ +
Expedited queue; highest priority.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set expedited queue; highest priority.
+
+
+ update_tokens + +
+ integer +
+
+ +
Specify Number of tokens.
+
+
+ priority + +
+ integer +
+
+ +
Output queue priority; higher is better.
+
+
+ passive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify to not send open messages to a peer.
+
+
+ path_selection + +
+ dictionary +
+
+ +
Configure path selection strategy.
+
+
+ always_compare_med + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Compare MED on paths from different AS.
+
+
+ as_path_ignore + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Ignore AS path comparison during path selection.
+
+
+ cisco_non_deterministic + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use Cisco IOS nondeterministic path selection algorithm.
+
+
+ external_router_id + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Compare router ID on BGP externals.
+
+
+ l2vpn_use_bgp_rules + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use standard BGP rules during L2VPN path selection.
+
+
+ med_plus_igp + +
+ dictionary +
+
+ +
Add IGP cost to next-hop to MED before comparing MED values.
+
+
+ igp_multiplier + +
+ integer +
+
+ +
Specify multiplier for IGP cost to next-hop.
+
+
+ med_multiplier + +
+ integer +
+
+ +
Specify Multiplier for MED.
+
+
+ peer_as + +
+ string +
+
+ +
Specify Autonomous system number in plain number or 'higher 16bits'.'Lower 16 bits' format.
+
+
+ precision_timers + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use precision timers for scheduling keepalives.
+
+
+ preference + +
+ string +
+
+ +
Specify preference value.
+
+
+ remove_private + +
+ dictionary +
+
+ +
Remove well-known private AS numbers.
+
+
+ all + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Remove all private AS numbers and do not stop at the first public AS number.
+
+
+ no_peer_loop_check + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Remove peer loop-check.
+
+
+ replace + +
+ dictionary +
+
+ +
Specify private AS replacement.
+
+
+ nearest + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Use closest public AS number to replace a private AS number.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Replace private AS numbers with the BGP Group's local AS number.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Remove well-known private AS numbers.
+
+
+ rfc6514_compliant_safi129 + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify Compliance with RFC6514 SAFI129 format.
+
+
+ route_server_client + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable route server client behavior.
+
+
+ send_addpath_optimization + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable BGP addpath advertisement optimization.
+
+
+ snmp_options + +
+ dictionary +
+
+ +
Customize SNMP behaviors specifically for BGP MIBs.
+
+
+ backward_traps_only_from_established + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Limit traps for backward transitions to only those moving from Established state.
+
+
+ emit_inet_address_length_in_oid + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Emit Length in OID for InetAddress MIB type.
+
+
+ sr_preference_override + +
+ string +
+
+ +
Replace received segment routing traffic engineering preference value with override value.
+
+
+ stale_labels_holddown_period + +
+ integer +
+
+ +
Specify duration (sec) MPLS labels allocated by BGP are kept after they go stale.
+
+
+ tcp_aggressive_transmission + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable aggressive transmission of pure TCP ACKs and retransmissions.
+
+
+ tcp_mss + +
+ integer +
+
+ +
Specify maximum TCP segment size.
+
+
+ traceoptions + +
+ dictionary +
+
+ +
Configure trace options for BGP.
+
+
+ file + +
+ dictionary +
+
+ +
Specify trace file options.
+
+
+ file_name + +
+ string +
+
+ +
Specify name of file in which to write trace information.
+
+
+ files + +
+ integer +
+
+ +
Specify maximum number of trace files.
+
+
+ no_world_readable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Don't allow any user to read the log file.
+
+
+ size + +
+ integer +
+
+ +
Specify maximum trace file size.
+
+
+ world_readable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Allow any user to read the log file.
+
+
+ flag + +
+ dictionary +
+
+ +
Specify tracing parameters.
+
+
+ add_path + +
+ dictionary +
+
+ +
Specify trace add-path events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set trace add-path events.
+
+
+ all + +
+ dictionary +
+
+ +
Specify to trace everything.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace everything.
+
+
+ bfd + +
+ dictionary +
+
+ +
Trace BFD events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set BFD events.
+
+
+ byte_as + +
+ dictionary +
+
+ +
Specify trace 4 byte AS events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set trace 4 byte AS events.
+
+
+ damping + +
+ dictionary +
+
+ +
Trace BGP damping information.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ filter + +
+ dictionary +
+
+ +
Filter to apply to this flag.
+
+
+ match_on_prefix + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify filter based on prefix.
+
+
+ policy + +
+ string +
+
+ +
Specify filter policy.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set filter to apply to this flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace BGP damping information.
+
+
+ egress_te + +
+ dictionary +
+
+ +
Specify Egress Peering Traffic-Engineering events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Egress Peering Traffic-Engineering events.
+
+
+ general + +
+ dictionary +
+
+ +
Trace general events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set trace general events.
+
+
+ graceful_restart + +
+ dictionary +
+
+ +
Trace Graceful Restart events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace Graceful Restart events.
+
+
+ keepalive + +
+ dictionary +
+
+ +
Trace BGP keepalive packets.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace BGP keepalive packets.
+
+
+ normal + +
+ dictionary +
+
+ +
Trace normal events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace normal events.
+
+
+ nsr_synchronization + +
+ dictionary +
+
+ +
Trace NSR synchronization events.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace NSR synchronization events.
+
+
+ open + +
+ dictionary +
+
+ +
Trace BGP open packets.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace BGP open packets.
+
+
+ packets + +
+ dictionary +
+
+ +
Trace all BGP protocol packets.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace all BGP protocol packets.
+
+
+ policy + +
+ dictionary +
+
+ +
Trace policy processing.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace policy processing.
+
+
+ refresh + +
+ dictionary +
+
+ +
Trace BGP refresh packets.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace BGP refresh packets.
+
+
+ route + +
+ dictionary +
+
+ +
Trace routing information.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ filter + +
+ dictionary +
+
+ +
Filter to apply to this flag.
+
+
+ match_on_prefix + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify filter based on prefix.
+
+
+ policy + +
+ string +
+
+ +
Specify filter policy.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set filter to apply to this flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace routing information.
+
+
+ state + +
+ dictionary +
+
+ +
Trace state transitions.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace state transitions.
+
+
+ thread_io + +
+ dictionary +
+
+ +
Trace threaded I/O processing.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace threaded I/O processing.
+
+
+ thread_update_io + +
+ dictionary +
+
+ +
Trace threaded update I/O processing.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace threaded update I/O processing.
+
+
+ timer + +
+ dictionary +
+
+ +
Trace routing protocol timer processing.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set Trace routing protocol timer processing.
+
+
+ update + +
+ dictionary +
+
+ +
Trace BGP update packets.
+
+
+ detail + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace detailed information.
+
+
+ disable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Disable this trace flag.
+
+
+ receive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace received packets.
+
+
+ send + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace transmitted packets.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Trace BGP update packets.
+
+
+ traffic_statistics_labeled_path + +
+ dictionary +
+
+ +
Collect periodic ingress labeled statistics for BGP label-switched paths.
+
+
+ file + +
+ dictionary +
+
+ +
Specify statistics file options.
+
+
+ file_name + +
+ string +
+
+ +
Specify name of file in which to write trace information.
+
+
+ files + +
+ integer +
+
+ +
Specify maximum number of trace files.
+
+
+ no_world_readable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Don't allow any user to read the log file.
+
+
+ size + +
+ integer +
+
+ +
Specify maximum trace file size.
+
+
+ world_readable + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Allow any user to read the log file.
+
+
+ interval + +
+ integer +
+
+ +
Specify time interval to collect statistics.
+
+
+ ttl + +
+ integer +
+
+ +
Specify TTL value for the single-hop peer.
+
+
+ unconfigured_peer_graceful_restart + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify BGP unconfigured peer graceful restart options.
+
+
+ vpn_apply_export + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Apply BGP export policy when exporting VPN routes.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the NX-OS device by executing the command show running-config | section '^router bgp'.
+
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: +
  • purged
  • +
  • merged ←
  • +
  • replaced
  • +
  • deleted
  • +
  • gathered
  • +
  • parsed
  • +
  • rendered
  • +
+
+
The state the configuration should be left in.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # Before state + # ------------ + # + # admin# show protocols bgp + + - name: Merge Junos BGP interfaces config + junipernetworks.junos.junos_bgp_global: + config: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_bgp_static: + policy: "static-to-bgp" + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: 2 + state: merged + + # After state + # ----------- + # + # admin# show protocols bgp + # precision-timers; + # advertise-from-main-vpn-tables; + # holddown-all-stale-labels; + # description "This is configured with Junos_bgp resource module"; + # accept-remote-nexthop; + # preference 2; + # hold-time 5; + # advertise-inactive; + # no-advertise-peer-as; + # no-aggregator-id; + # out-delay 10; + # log-updown; + # damping; + # bgp-error-tolerance { + # malformed-route-limit 20000000; + # } + # authentication-algorithm md5; + # no-client-reflect; + # include-mp-next-hop; + # bmp { + # monitor enable; + # } + # advertise-bgp-static { + # policy static-to-bgp; + # } + # add-path-display-ipv4-address; + # egress-te-sid-stats; + + + # Using replaced + # + # Before state + # ------------ + # + # admin# show protocols bgp + # precision-timers; + # advertise-from-main-vpn-tables; + # holddown-all-stale-labels; + # description "This is configured with Junos_bgp resource module"; + # accept-remote-nexthop; + # preference 2; + # hold-time 5; + # advertise-inactive; + # no-advertise-peer-as; + # no-aggregator-id; + # out-delay 10; + # log-updown; + # damping; + # bgp-error-tolerance { + # malformed-route-limit 20000000; + # } + # authentication-algorithm md5; + # no-client-reflect; + # include-mp-next-hop; + # bmp { + # monitor enable; + # } + # advertise-bgp-static { + # policy static-to-bgp; + # } + # add-path-display-ipv4-address; + # egress-te-sid-stats; + + - name: Replace Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + advertise_bgp_static: + policy: "static-to-bgp" + advertise_inactive: true + authentication_algorithm: "md5" + bfd_liveness_detection: + minimum_receive_interval: 8 + multiplier: 30 + no_adaptation: true + transmit_interval: + minimum_interval: 4 + version: "automatic" + bgp_error_tolerance: + malformed_route_limit: 40000000 + description: "This is configured with Junos_bgp resource module replace" + egress_te_sid_stats: true + hold_time: 5 + out_delay: 10 + preference: "2" + state: replaced + + # After state + # ----------- + # + # admin# show protocols bgp + # description "This is configured with Junos_bgp resource module replace"; + # preference 2; + # hold-time 5; + # advertise-inactive; + # out-delay 10; + # bgp-error-tolerance { + # malformed-route-limit 40000000; + # } + # authentication-algorithm md5; + # advertise-bgp-static { + # policy static-to-bgp; + # } + # bfd-liveness-detection { + # version automatic; + # minimum-receive-interval 8; + # multiplier 30; + # no-adaptation; + # transmit-interval { + # minimum-interval 4; + # } + # } + # egress-te-sid-stats; + + + # + # Using deleted + # + # Before state + # ------------ + # + # admin# show protocols bgp + # description "This is configured with Junos_bgp resource module replace"; + # preference 2; + # hold-time 5; + # advertise-inactive; + # out-delay 10; + # bgp-error-tolerance { + # malformed-route-limit 40000000; + # } + # authentication-algorithm md5; + # advertise-bgp-static { + # policy static-to-bgp; + # } + # bfd-liveness-detection { + # version automatic; + # minimum-receive-interval 8; + # multiplier 30; + # no-adaptation; + # transmit-interval { + # minimum-interval 4; + # } + # } + # egress-te-sid-stats; + + - name: Delete Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + state: deleted + + # After state + # ----------- + + + # admin# show protocols bgp + # Using gathered + # + # Before state + # ------------ + # + # admin# show protocols bgp + # description "This is configured with Junos_bgp resource module replace"; + # preference 2; + # hold-time 5; + # advertise-inactive; + # out-delay 10; + # bgp-error-tolerance { + # malformed-route-limit 40000000; + # } + # authentication-algorithm md5; + # advertise-bgp-static { + # policy static-to-bgp; + # } + # bfd-liveness-detection { + # version automatic; + # minimum-receive-interval 8; + # multiplier 30; + # no-adaptation; + # transmit-interval { + # minimum-interval 4; + # } + # } + # egress-te-sid-stats; + + - name: Gather Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + state: gathered + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # "gathered": { + # "advertise_bgp_static": { + # "policy": "static-to-bgp" + # }, + # "advertise_inactive": true, + # "authentication_algorithm": "md5", + # "bfd_liveness_detection": { + # "minimum_receive_interval": 8, + # "multiplier": 30, + # "no_adaptation": true, + # "transmit_interval": { + # "minimum_interval": 4 + # }, + # "version": "automatic" + # }, + # "bgp_error_tolerance": { + # "malformed_route_limit": 40000000 + # }, + # "description": "This is configured with Junos_bgp resource module replace", + # "egress_te_sid_stats": true, + # "hold_time": 5, + # "out_delay": 10, + # "preference": "2" + # } + # + + # + # Using purged + # + # Before state + # ------------ + # + # admin# show protocols bgp + # description "This is configured with Junos_bgp resource module replace"; + # preference 2; + # hold-time 5; + # advertise-inactive; + # out-delay 10; + # bgp-error-tolerance { + # malformed-route-limit 40000000; + # } + # authentication-algorithm md5; + # advertise-bgp-static { + # policy static-to-bgp; + # } + # bfd-liveness-detection { + # version automatic; + # minimum-receive-interval 8; + # multiplier 30; + # no-adaptation; + # transmit-interval { + # minimum-interval 4; + # } + # } + # egress-te-sid-stats; + + - name: Purge Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + state: purged + + # After state + # ---------- + + # Using rendered + # + # + - name: Render the commands for provided configuration + junipernetworks.junos.junos_bgp_global: + config: + authentication_algorithm: "md5" + bfd_liveness_detection: + minimum_receive_interval: 4 + multiplier: 10 + no_adaptation: true + transmit_interval: + minimum_interval: 2 + version: "automatic" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + state: rendered + + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "rendered": " + # + # + # + # + # md5 + # This is configured with Junos_bgp resource module + # 5 + # + # + # 2 + # + # 4 + # 10 + # + # automatic + # + # + # 20000000 + # + # + # enable + # + # + # " + # + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # 18.4R1-S2.4 + # + # + # + # + # + # This is configured with Junos_bgp resource module + # + # 2 + # 5 + # + # + # + # 10 + # + # + # + # 20000000 + # + # md5 + # + # + # + # + # disable + # + # + # + # + # + # static-to-bgp + # + # + # + # automatic + # 4 + # 10 + # + # + # 2 + # + # + # 300000 + # + # + # + # + # internal + # 8 + # + # + # external + # 9 + # + # + # inboun + # internal + # + # + # ibgp + # internal + # 10.2.2.2 + # static-to-bgp + # + # 10.1.1.1 + # + # + # + # + # + # 0.0.0.100 + # + # 200 + # + # + # so-0/0/0.0 + # 5 + # 3 + # + # + # + # + # + # + # + # 172.16.17.0/24 + # + # + # + # 10.200.16.75 + # + # 65432 + # + # + # + # + + + - name: Parsed the device configuration to get output commands + junipernetworks.junos.junos_bgp_global: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "parsed": { + # "accept_remote_nexthop": true, + # "add_path_display_ipv4_address": true, + # "advertise_bgp_static": { + # "policy": "static-to-bgp" + # }, + # "advertise_from_main_vpn_tables": true, + # "advertise_inactive": true, + # "authentication_algorithm": "md5", + # "bfd_liveness_detection": { + # "detection_time": { + # "threshold": 300000 + # }, + # "minimum_receive_interval": 4, + # "multiplier": 10, + # "no_adaptation": true, + # "transmit_interval": { + # "minimum_interval": 2 + # }, + # "version": "automatic" + # }, + # "bgp_error_tolerance": { + # "malformed_route_limit": 20000000 + # }, + # "bmp": { + # "monitor": false, + # "route_monitoring": { + # "none": true + # } + # }, + # "damping": true, + # "description": "This is configured with Junos_bgp resource module", + # "egress_te_sid_stats": true, + # "hold_time": 5, + # "holddown_all_stale_labels": true, + # "include_mp_next_hop": true, + # "log_updown": true, + # "no_advertise_peer_as": true, + # "no_aggregator_id": true, + # "no_client_reflect": true, + # "out_delay": 10, + # "precision_timers": true, + # "preference": "2" + # } + # + + + +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:
+
[' <nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:bgp> <nc:damping/> <nc:egress-te-sid-stats/> <nc:authentication-algorithm>md5</nc:authentication-algorithm> <nc:description>This is configured with Junos_bgp resource module</nc:description> <nc:hold-time>5</nc:hold-time> <nc:bfd-liveness-detection> <nc:transmit-interval> <nc:minimum-interval>2</nc:minimum-interval> </nc:transmit-interval> <nc:minimum-receive-interval>4</nc:minimum-receive-interval> <nc:multiplier>10</nc:multiplier> <nc:no-adaptation/> <nc:version>automatic</nc:version> </nc:bfd-liveness-detection> <nc:bgp-error-tolerance> <nc:malformed-route-limit>20000000</nc:malformed-route-limit> </nc:bgp-error-tolerance> <nc:bmp> <nc:monitor>enable</nc:monitor> </nc:bmp> </nc:bgp> </nc:protocols>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Rohit Thakur (@rohitthakur) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_cliconf.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_cliconf.rst new file mode 100644 index 00000000..4f8f2bf2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_cliconf.rst @@ -0,0 +1,43 @@ +.. _junipernetworks.junos.junos_cliconf: + + +*************************** +junipernetworks.junos.junos +*************************** + +**Use junos cliconf to run command on Juniper Junos OS platform** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This junos plugin provides low level abstraction apis for sending and receiving CLI commands from Juniper Junos OS 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/junipernetworks/junos/docs/junipernetworks.junos.junos_command_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_command_module.rst new file mode 100644 index 00000000..c1674c98 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_command_module.rst @@ -0,0 +1,455 @@ +.. _junipernetworks.junos.junos_command_module: + + +*********************************** +junipernetworks.junos.junos_command +*********************************** + +**Run arbitrary commands on an Juniper JUNOS device** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Sends an arbitrary set of commands to an JUNOS 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. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- jxmlease +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ commands + +
+ list + / elements=string +
+
+ +
The commands to send to the remote junos 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 been exceeded.
+
+
+ display + +
+ string +
+
+
    Choices: +
  • text
  • +
  • json
  • +
  • xml
  • +
  • set
  • +
+
+
Encoding scheme to use when serializing output from the device. This handles how to properly understand the output and apply the conditionals path to the result set. For rpcs argument default display is xml and for commands argument default display is text. Value set is applicable only for fetching configuration from device.
+

aliases: format, output
+
+
+ interval + +
+ integer +
+
+ Default:
1
+
+
Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditional, the interval indicates how to 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 or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 be tried before it is considered failed. The command is run on the target device every retry and evaluated against the wait_for conditionals.
+
+
+ rpcs + +
+ list + / elements=string +
+
+ +
The rpcs argument accepts a list of RPCs to be executed over a netconf session and the results from the RPC execution is return to the playbook via the modules results dictionary.
+
+
+ wait_for + +
+ list + / elements=string +
+
+ +
Specifies what to evaluate from the output of the command and what conditionals to apply. This argument will cause the task to wait for a particular conditional to be true before moving forward. If the conditional is not true by the configured retries, the task fails. See examples.
+

aliases: waitfor
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``network_cli`` connections and with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: run show version on remote devices + junipernetworks.junos.junos_command: + commands: show version + + - name: run show version and check to see if output contains Juniper + junipernetworks.junos.junos_command: + commands: show version + wait_for: result[0] contains Juniper + + - name: run multiple commands on remote nodes + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces + + - name: run multiple commands and evaluate the output + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces + wait_for: + - result[0] contains Juniper + - result[1] contains Loopback0 + + - name: run commands and specify the output format + junipernetworks.junos.junos_command: + commands: show version + display: json + + - name: run rpc on the remote device + junipernetworks.junos.junos_command: + commands: show configuration + display: set + + - name: run rpc on the remote device + junipernetworks.junos.junos_command: + rpcs: get-software-information + + + +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:
+
['...', '...']
+
+
+ output + +
+ list +
+
If the display is in xml format. +
The set of transformed xml to json format from the commands responses
+
+
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 +~~~~~~~ + +- Peter Sprygada (@privateip) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_config_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_config_module.rst new file mode 100644 index 00000000..dfdb5597 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_config_module.rst @@ -0,0 +1,638 @@ +.. _junipernetworks.junos.junos_config_module: + + +********************************** +junipernetworks.junos.junos_config +********************************** + +**Manage configuration on devices running Juniper JUNOS** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides an implementation for working with the active configuration running on Juniper JUNOS devices. It provides a set of arguments for loading configuration, performing rollback operations and zeroing the active configuration on the device. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ 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>
+
+
+ check_commit + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
This argument will check correctness of syntax; do not apply changes.
+
Note that this argument can be used to confirm verified configuration done via commit confirmed operation
+
+
+ comment + +
+ string +
+
+ Default:
"configured by junos_config"
+
+
The comment argument specifies a text string to be used when committing the configuration. If the confirm argument is set to False, this argument is silently ignored.
+
+
+ confirm + +
+ integer +
+
+ Default:
0
+
+
The confirm argument will configure a time out value in minutes for the commit to be confirmed before it is automatically rolled back. If the confirm argument is set to False, this argument is silently ignored. If the value for this argument is set to 0, the commit is confirmed immediately.
+
+
+ confirm_commit + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
This argument will execute commit operation on remote device. It can be used to confirm a previous commit.
+
+
+ lines + +
+ list + / elements=string +
+
+ +
This argument takes a list of set or delete configuration lines to push into the remote device. Each line must start with either set or delete. This argument is mutually exclusive with the src argument.
+

aliases: commands
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The replace argument will instruct the remote device to replace the current configuration hierarchy with the one specified in the corresponding hierarchy of the source configuration loaded from this module.
+
Note this argument should be considered deprecated. To achieve the equivalent, set the update argument to replace. This argument will be removed in a future release. The replace and update argument is mutually exclusive.
+
+
+ rollback + +
+ integer +
+
+ +
The rollback argument instructs the module to rollback the current configuration to the identifier specified in the argument. If the specified rollback identifier does not exist on the remote device, the module will fail. To rollback to the most recent commit, set the rollback argument to 0.
+
+
+ src + +
+ path +
+
+ +
The src argument provides a path to the configuration file to load into the remote system. The path can either be a full system path to the configuration file if the value starts with / or relative to the root of the implemented role or playbook. This argument is mutually exclusive with the lines argument.
+
+
+ src_format + +
+ string +
+
+
    Choices: +
  • xml
  • +
  • set
  • +
  • text
  • +
  • json
  • +
+
+
The src_format argument specifies the format of the configuration found int src. If the src_format argument is not provided, the module will attempt to determine the format of the configuration file specified in src.
+
+
+ update + +
+ string +
+
+
    Choices: +
  • merge ←
  • +
  • override
  • +
  • replace
  • +
  • update
  • +
+
+
This argument will decide how to load the configuration data particularly when the candidate configuration and loaded configuration contain conflicting statements. Following are accepted values. merge combines the data in the loaded configuration with the candidate configuration. If statements in the loaded configuration conflict with statements in the candidate configuration, the loaded statements replace the candidate ones. override discards the entire candidate configuration and replaces it with the loaded configuration. replace substitutes each hierarchy level in the loaded configuration for the corresponding level. update is similar to the override option. The new configuration completely replaces the existing configuration. The difference comes when the configuration is later committed. This option performs a 'diff' between the new candidate configuration and the existing committed configuration. It then only notifies system processes responsible for the changed portions of the configuration, and only marks the actual configuration changes as 'changed'.
+
+
+ zeroize + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
The zeroize argument is used to completely sanitize the remote device configuration back to initial defaults. This argument will effectively remove all current configuration statements on the remote device.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Abbreviated commands are NOT idempotent, see L(Network FAQ,../network/user_guide/faq.html + - Loading JSON-formatted configuration *json* is supported starting in Junos OS Release 16.1 onwards. + - Update ``override`` not currently compatible with ``set`` notation. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: load configure file into device + junipernetworks.junos.junos_config: + src: srx.cfg + comment: update config + + - name: load configure lines into device + junipernetworks.junos.junos_config: + lines: + - set interfaces ge-0/0/1 unit 0 description "Test interface" + - set vlans vlan01 description "Test vlan" + comment: update config + + - name: Set routed VLAN interface (RVI) IPv4 address + junipernetworks.junos.junos_config: + lines: + - set vlans vlan01 vlan-id 1 + - set interfaces irb unit 10 family inet address 10.0.0.1/24 + - set vlans vlan01 l3-interface irb.10 + + - name: Check correctness of commit configuration + junipernetworks.junos.junos_config: + check_commit: yes + + - name: rollback the configuration to id 10 + junipernetworks.junos.junos_config: + rollback: 10 + + - name: zero out the current configuration + junipernetworks.junos.junos_config: + zeroize: yes + + - name: Set VLAN access and trunking + junipernetworks.junos.junos_config: + lines: + - set vlans vlan02 vlan-id 6 + - set interfaces ge-0/0/6.0 family ethernet-switching interface-mode access vlan + members vlan02 + - set interfaces ge-0/0/6.0 family ethernet-switching interface-mode trunk vlan + members vlan02 + + - name: confirm a previous commit + junipernetworks.junos.junos_config: + confirm_commit: yes + + - name: for idempotency, use full-form commands + junipernetworks.junos.junos_config: + lines: + # - set int ge-0/0/1 unit 0 desc "Test interface" + - set interfaces ge-0/0/1 unit 0 description "Test interface" + + - name: configurable backup path + junipernetworks.junos.junos_config: + src: srx.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/config.2016-07-16@22:28:34
+
+
+ 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:
+
junos01_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/junos01_config
+
+
+ time + +
+ string +
+
when backup is yes +
The time extracted from the backup file name
+
+
Sample:
+
22:28:34
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_facts_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_facts_module.rst new file mode 100644 index 00000000..9a4778bf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_facts_module.rst @@ -0,0 +1,280 @@ +.. _junipernetworks.junos.junos_facts_module: + + +********************************* +junipernetworks.junos.junos_facts +********************************* + +**Collect facts from remote devices running Juniper Junos** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Collects fact information from a remote device running the Junos operating system. By default, the module will collect basic fact information from the device to be included with the hostvars. Additional fact information can be collected based on the configured set of arguments. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config_format + +
+ string +
+
+
    Choices: +
  • xml
  • +
  • text ←
  • +
  • set
  • +
  • json
  • +
+
+
The config_format argument specifies the format of the configuration when serializing output from the device. This argument is applicable only when config value is present in gather_subset. The config_format should be supported by the junos version running on device. This value is not applicable while fetching old style facts that is when ofacts value is present in value if gather_subset value. This option is valid only for gather_subset values.
+
+
+ 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, vlans 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', 'interfaces', 'lacp', 'lacp_interfaces', 'lag_interfaces', 'l2_interfaces', 'l3_interfaces', 'lldp_global', 'lldp_interfaces', 'vlans'.
+
+
+ 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. To maintain backward compatibility old style facts can be retrieved by explicitly adding ofacts to value, this requires junos-eznc to be installed as a prerequisite. Valid value of gather_subset are default, hardware, config, interfaces, ofacts. If ofacts is present in the list it fetches the old style facts (fact keys without 'ansible_' prefix) and it requires junos-eznc library to be installed on control node and the device login credentials must be given in provider option.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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:: + - Ensure *config_format* used to retrieve configuration from device is supported by junos version running on device. + - With *config_format = json*, configuration in the results will be a dictionary(and not a JSON string) + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - Fetching old style facts requires junos-eznc library to be installed on control node and the device login credentials must be given in provider option. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: collect default set of facts + junipernetworks.junos.junos_facts: + + - name: collect default set of facts and configuration + junipernetworks.junos.junos_facts: + gather_subset: config + + - name: Gather legacy and resource facts + junipernetworks.junos.junos_facts: + gather_subset: all + gather_network_resources: all + + + + +Status +------ + + +Authors +~~~~~~~ + +- Nathaniel Case (@Qalthos) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interface_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interface_module.rst new file mode 100644 index 00000000..2c09b982 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interface_module.rst @@ -0,0 +1,841 @@ +.. _junipernetworks.junos.junos_interface_module: + + +************************************* +junipernetworks.junos.junos_interface +************************************* + +**(deprecated, removed after 2022-06-01) Manage Interface on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_interfaces ` instead. + + + +Synopsis +-------- +- This module provides declarative management of Interfaces on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of Interfaces definitions.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ 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.
+
+
+ duplex + +
+ string +
+
+
    Choices: +
  • full
  • +
  • half
  • +
  • auto
  • +
+
+
Interface link status.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure interface link status.
+
+
+ mtu + +
+ integer +
+
+ +
Maximum size of transmit packet.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the Interface.
+
+
+ neighbors + +
+ list + / elements=dictionary +
+
+ +
Check the operational state of given interface name for LLDP neighbor.
+
The following suboptions are available.
+
+
+ host + +
+ string +
+
+ +
LLDP neighbor host for given interface name.
+
+
+ port + +
+ string +
+
+ +
LLDP neighbor port to which given interface name is connected.
+
+
+ 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 +
+
+ +
Interface link speed.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
  • up
  • +
  • down
  • +
+
+
State of the Interface configuration, up indicates present and operationally up and down indicates 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.
+
+
+ duplex + +
+ string +
+
+
    Choices: +
  • full
  • +
  • half
  • +
  • auto
  • +
+
+
Interface link status.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Configure interface link status.
+
+
+ mtu + +
+ integer +
+
+ +
Maximum size of transmit packet.
+
+
+ name + +
+ string +
+
+ +
Name of the Interface.
+
+
+ neighbors + +
+ list + / elements=dictionary +
+
+ +
Check the operational state of given interface name for LLDP neighbor.
+
The following suboptions are available.
+
+
+ host + +
+ string +
+
+ +
LLDP neighbor host for given interface name.
+
+
+ port + +
+ string +
+
+ +
LLDP neighbor port to which given interface name is connected.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 +
+
+ +
Interface link speed.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
  • up
  • +
  • down
  • +
+
+
State of the Interface configuration, up indicates present and operationally up and down indicates 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 requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure interface + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + + - name: remove interface + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: absent + + - name: make interface down + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + enabled: false + + - name: make interface up + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + enabled: true + + - name: Deactivate interface config + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: present + active: false + + - name: Activate interface config + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: present + active: true + + - name: Configure interface speed, mtu, duplex + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: present + speed: 1g + mtu: 256 + duplex: full + + - name: Create interface using aggregate + junipernetworks.junos.junos_interface: + aggregate: + - name: ge-0/0/1 + description: test-interface-1 + - name: ge-0/0/2 + description: test-interface-2 + speed: 1g + duplex: full + mtu: 512 + + - name: Delete interface using aggregate + junipernetworks.junos.junos_interface: + aggregate: + - name: ge-0/0/1 + - name: ge-0/0/2 + state: absent + + - name: Check intent arguments + junipernetworks.junos.junos_interface: + name: '{{ name }}' + state: up + tx_rate: ge(0) + rx_rate: le(0) + + - name: Check neighbor intent + junipernetworks.junos.junos_interface: + name: xe-0/1/1 + neighbors: + - port: Ethernet1/0/1 + host: netdev + + - name: Config + intent + junipernetworks.junos.junos_interface: + name: '{{ name }}' + enabled: false + state: down + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit interfaces] + ge-0/0/1 { + description test-interface; + }
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interfaces_module.rst new file mode 100644 index 00000000..19dd4771 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_interfaces_module.rst @@ -0,0 +1,687 @@ +.. _junipernetworks.junos.junos_interfaces_module: + + +************************************** +junipernetworks.junos.junos_interfaces +************************************** + +**Junos Interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages the interfaces on Juniper Junos OS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
The provided configuration
+
+
+ description + +
+ string +
+
+ +
Interface description.
+
+
+ duplex + +
+ string +
+
+
    Choices: +
  • automatic
  • +
  • full-duplex
  • +
  • half-duplex
  • +
+
+
Interface link status. Applicable for Ethernet interfaces only, either in half duplex, full duplex or in automatic state which negotiates the duplex automatically.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Administrative state of the interface.
+
Set the value to true to administratively enabled the interface or false to disable it.
+
+
+ hold_time + +
+ dictionary +
+
+ +
The hold time for given interface name.
+
+
+ down + +
+ integer +
+
+ +
The link down hold time in milliseconds.
+
+
+ up + +
+ integer +
+
+ +
The link up hold time in milliseconds.
+
+
+ mtu + +
+ integer +
+
+ +
MTU for a specific interface.
+
Applicable for Ethernet interfaces only.
+
+
+ name + +
+ string + / required +
+
+ +
Full name of interface, e.g. ge-0/0/0.
+
+
+ speed + +
+ string +
+
+ +
Interface link speed. Applicable for Ethernet interfaces only.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show interfaces.
+
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 of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 18.4R1. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using deleted + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible-1"; + # speed 1g; + # mtu 1800 + # } + # ge-0/0/2 { + # description "Configured by Ansible-2"; + # ether-options { + # auto-negotiation; + # } + # } + + - name: "Delete given options for the interface (Note: This won't delete the interface itself if any other values are configured for interface)" + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/1 + description: Configured by Ansible-1 + speed: 1g + mtu: 1800 + - name: ge-0/0/2 + description: Configured by Ansible -2 + state: deleted + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # auto-negotiation; + # } + # } + + + # Using merged + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "test interface"; + # speed 1g; + # } + + - name: Merge provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/1 + description: Configured by Ansible-1 + enabled: true + mtu: 1800 + - name: ge-0/0/2 + description: Configured by Ansible-2 + enabled: false + state: merged + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible-1"; + # speed 1g; + # mtu 1800 + # } + # ge-0/0/2 { + # disable; + # description "Configured by Ansible-2"; + # } + + + # Using overridden + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible-1"; + # speed 1g; + # mtu 1800 + # } + # ge-0/0/2 { + # disable; + # description "Configured by Ansible-2"; + # ether-options { + # auto-negotiation; + # } + # } + # ge-0/0/11 { + # description "Configured by Ansible-11"; + # } + + - name: Override device configuration of all interfaces with provided configuration + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansible-2 + enabled: false + mtu: 2800 + - name: ge-0/0/3 + description: Configured by Ansible-3 + state: overridden + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/2 { + # disable; + # description "Configured by Ansible-2"; + # mtu 2800 + # } + # ge-0/0/3 { + # description "Configured by Ansible-3"; + # } + + + # Using replaced + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible-1"; + # speed 1g; + # mtu 1800 + # } + # ge-0/0/2 { + # disable; + # mtu 1800; + # speed 1g; + # description "Configured by Ansible-2"; + # ether-options { + # auto-negotiation; + # } + # } + # ge-0/0/11 { + # description "Configured by Ansible-11"; + # } + + - name: Replaces device configuration of listed interfaces with provided configuration + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansible-2 + enabled: false + mtu: 2800 + - name: ge-0/0/3 + description: Configured by Ansible-3 + state: replaced + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible-1"; + # speed 1g; + # mtu 1800 + # } + # ge-0/0/2 { + # disable; + # description "Configured by Ansible-2"; + # mtu 2800 + # } + # ge-0/0/3 { + # description "Configured by Ansible-3"; + # } + # ge-0/0/11 { + # description "Configured by Ansible-11"; + # } + # Using gathered + # Before state: + # ------------ + # + # user@junos01# show interfaces + # gr-0/0/0 { + # description "test gre interface"; + # } + # fxp0 { + # unit 0 { + # family inet { + # dhcp; + # } + # } + # } + # pp0 { + # unit 0 { + # pppoe-options { + # idle-timeout 100; + # access-concentrator ispl.com; + # service-name "video@ispl.com"; + # auto-reconnect 100; + # client; + # ## Warning: missing mandatory statement(s): 'underlying-interface' + # } + # } + # } + # + - name: Gather junos interfaces as in given arguments + junipernetworks.junos.junos_interfaces: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "description": "test gre interface", + # "enabled": true, + # "name": "gr-0/0/0" + # }, + # { + # "enabled": true, + # "name": "fxp0" + # }, + # { + # "enabled": true, + # "name": "pp0" + # } + # ] + # After state: + # ------------ + # + # user@junos01# show interfaces + # gr-0/0/0 { + # description "test gre interface"; + # } + # fxp0 { + # unit 0 { + # family inet { + # dhcp; + # } + # } + # } + # pp0 { + # unit 0 { + # pppoe-options { + # idle-timeout 100; + # access-concentrator ispl.com; + # service-name "video@ispl.com"; + # auto-reconnect 100; + # client; + # ## Warning: missing mandatory statement(s): 'underlying-interface' + # } + # } + # } + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # ge-0/0/1 + # Configured by Ansible + # + # 100m + # 1024 + # + # 2000 + # 2200 + # + # full-duplex + # + # 0 + # + # + # access + # + # vlan100 + # + # + # + # + # + # + # + # + # - name: Convert interfaces config to argspec without connecting to the appliance + # junipernetworks.junos.junos_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "description": "Configured by Ansible", + # "duplex": "full-duplex", + # "enabled": false, + # "hold_time": { + # "down": 2200, + # "up": 2000 + # }, + # "mtu": 1024, + # "name": "ge-0/0/1", + # "speed": "100m" + # } + # ] + # + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansibull + mtu: 2048 + speed: 20m + hold_time: + up: 3200 + down: 3200 + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": + # + # ge-0/0/2 + # Configured by Ansibull + # 20m + # 2048 + # + # 3200 + # 3200 + # + # + # " + + + +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.
+
+
+ xml + +
+ list +
+
always +
The set of xml rpc payload pushed to the remote device.
+
+
Sample:
+
['<?xml version="1.0" encoding="UTF-8"?> <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f"> <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC"> <interfaces> <interface> <name>ge-0/0/1</name> <description>Configured by Ansible</description> <disable/> <speed>100m</speed> <mtu>1024</mtu> <hold-time> <up>2000</up> <down>2200</down> </hold-time> <link-mode>full-duplex</link-mode> <unit> <name>0</name> <family> <ethernet-switching> <interface-mode>access</interface-mode> <vlan> <members>vlan100</members> </vlan> </ethernet-switching> </family> </unit> </interface> </interfaces> </configuration> </rpc-reply>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interface_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interface_module.rst new file mode 100644 index 00000000..0cf6519b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interface_module.rst @@ -0,0 +1,717 @@ +.. _junipernetworks.junos.junos_l2_interface_module: + + +**************************************** +junipernetworks.junos.junos_l2_interface +**************************************** + +**(deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_l2_interfaces ` instead. + + + +Synopsis +-------- +- This module provides declarative management of Layer-2 interface on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ access_vlan + +
+ string +
+
+ +
Configure given VLAN in access port. The value of access_vlan should be vlan name.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of Layer-2 interface definitions.
+
+
+ access_vlan + +
+ string +
+
+ +
Configure given VLAN in access port. The value of access_vlan should be vlan name.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ description + +
+ string +
+
+ +
Description of Interface.
+
+
+ enhanced_layer + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
True if your device has Enhanced Layer 2 Software (ELS).
+
+
+ filter_input + +
+ string +
+
+ +
The name of input filter of ethernet-switching.
+
+
+ filter_output + +
+ string +
+
+ +
The name of output filter of ethernet-switching.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • access
  • +
  • trunk
  • +
+
+
Mode in which interface needs to be configured.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the interface excluding any logical unit number.
+
+
+ native_vlan + +
+ integer +
+
+ +
Native VLAN to be configured in trunk port. The value of native_vlan should be vlan id.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
State of the Layer-2 Interface configuration.
+
+
+ trunk_vlans + +
+ list + / elements=string +
+
+ +
List of VLAN names to be configured in trunk port. The value of trunk_vlans should be list of vlan names.
+
+
+ unit + +
+ integer +
+
+ +
Logical interface number. Value of unit should be of type integer.
+
+
+ description + +
+ string +
+
+ +
Description of Interface.
+
+
+ enhanced_layer + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
True if your device has Enhanced Layer 2 Software (ELS).
+
+
+ filter_input + +
+ string +
+
+ +
The name of input filter of ethernet-switching.
+
+
+ filter_output + +
+ string +
+
+ +
The name of output filter of ethernet-switching.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • access
  • +
  • trunk
  • +
+
+
Mode in which interface needs to be configured.
+
+
+ name + +
+ string +
+
+ +
Name of the interface excluding any logical unit number.
+
+
+ native_vlan + +
+ integer +
+
+ +
Native VLAN to be configured in trunk port. The value of native_vlan should be vlan id.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 Layer-2 Interface configuration.
+
+
+ trunk_vlans + +
+ list + / elements=string +
+
+ +
List of VLAN names to be configured in trunk port. The value of trunk_vlans should be list of vlan names.
+
+
+ unit + +
+ integer +
+
+ Default:
0
+
+
Logical interface number. Value of unit should be of type integer.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: Configure interface in access mode + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: interface-access + mode: access + access_vlan: red + active: true + state: present + + - name: Configure interface in trunk mode + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + + - name: Configure interface in access and trunk mode using aggregate + junipernetworks.junos.junos_l2_interface: + aggregate: + - name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + - name: ge-0/0/2 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit interfaces] + ge-0/0/1 { + description "l2 interface configured by Ansible"; + unit 0 { + family ethernet-switching { + interface-mode access; + vlan { + members red; + } + } + } + }
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interfaces_module.rst new file mode 100644 index 00000000..c39d2b55 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l2_interfaces_module.rst @@ -0,0 +1,823 @@ +.. _junipernetworks.junos.junos_l2_interfaces_module: + + +***************************************** +junipernetworks.junos.junos_l2_interfaces +***************************************** + +**L2 interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of a Layer-2 interface on Juniper JUNOS devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of Layer-2 interface options
+
+
+ access + +
+ dictionary +
+
+ +
Configure the interface as a Layer 2 access mode.
+
+
+ vlan + +
+ string +
+
+ +
Configure the access VLAN ID.
+
+
+ enhanced_layer + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
True if your device has Enhanced Layer 2 Software (ELS). If the l2 configuration is under interface-mode the value is True else if the l2 configuration is under port-mode value is False
+
+
+ name + +
+ string + / required +
+
+ +
Full name of interface, e.g. ge-0/0/1.
+
+
+ trunk + +
+ dictionary +
+
+ +
Configure the interface as a Layer 2 trunk mode.
+
+
+ allowed_vlans + +
+ list + / elements=string +
+
+ +
List of VLANs to be configured in trunk port. It's used as the VLAN range to ADD or REMOVE from the trunk.
+
+
+ native_vlan + +
+ string +
+
+ +
Native VLAN to be configured in trunk port. It is used as the trunk native VLAN ID.
+
+
+ unit + +
+ integer +
+
+ +
Logical interface number. Value of unit should be of type integer.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show interfaces.
+
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 of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 18.4R1. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using deleted + + # Before state: + # ------------- + # + # ansible@junos01# show interfaces + # ge-0/0/1 { + # description "L2 interface"; + # speed 1g; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members vlan30; + # } + # } + # } + #} + #ge-0/0/2 { + # description "non L2 interface"; + # unit 0 { + # family inet { + # address 192.168.56.14/24; + # } + # } + + - name: "Delete L2 attributes of given interfaces (Note: This won't delete the + interface itself)." + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + state: deleted + + # After state: + # ------------ + # + # ansible@junos01# show interfaces + # ge-0/0/1 { + # description "L2 interface"; + # speed 1g; + # } + #ge-0/0/2 { + # description "non L2 interface"; + # unit 0 { + # family inet { + # address 192.168.56.14/24; + # } + # } + + + # Using merged + + # Before state: + # ------------- + # ansible@junos01# show interfaces + # ge-0/0/3 { + # description "test interface"; + # speed 1g; + #} + # ge-0/0/4 { + # description interface-trunk; + # native-vlan-id 100; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan40 ]; + # } + # } + # } + # } + + - name: Merge provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + state: merged + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/3 { + # description "test interface"; + # speed 1g; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members v101; + # } + # } + # } + # } + # ge-0/0/4 { + # description interface-trunk; + # native-vlan-id 50; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan40 vlan30 ]; + # } + # } + # } + # } + + + # Using overridden + + # Before state: + # ------------- + # ansible@junos01# show interfaces + # ge-0/0/3 { + # description "test interface"; + # speed 1g; + #} + # ge-0/0/4 { + # description interface-trunk; + # native-vlan-id 100; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan40 ]; + # } + # } + # } + # } + # ge-0/0/5 { + # description "Configured by Ansible-11"; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members v101; + # } + # } + # } + # } + + - name: Override provided configuration with device configuration + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + state: overridden + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/3 { + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members v101; + # } + # } + # } + # } + # ge-0/0/4 { + # description interface-trunk; + # native-vlan-id 50; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan30 ]; + # } + # } + # } + # } + + + # Using replaced + + # Before state: + # ------------- + # ansible@junos01# show interfaces + # ge-0/0/3 { + # description "test interface"; + # speed 1g; + #} + # ge-0/0/4 { + # description interface-trunk; + # native-vlan-id 100; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan40 ]; + # } + # } + # } + # } + + - name: Replace provided configuration with device configuration + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + state: replaced + + # After state: + # ------------ + # user@junos01# show interfaces + # ge-0/0/3 { + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members v101; + # } + # } + # } + # } + # ge-0/0/4 { + # description interface-trunk; + # native-vlan-id 50; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan30 ]; + # } + # } + # } + # } + # Using gathered + # Before state: + # ------------ + # + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible"; + # disable; + # speed 100m; + # mtu 1024; + # hold-time up 2000 down 2200; + # link-mode full-duplex; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members vlan100; + # } + # } + # } + # } + # ge-0/0/2 { + # description "Configured by Ansible"; + # native-vlan-id 400; + # speed 10m; + # mtu 2048; + # hold-time up 3000 down 3200; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan200 vlan300 ]; + # } + # } + # } + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + - name: Gather junos layer 2 interfaces as in given arguments + junipernetworks.junos.junos_l2_interfaces: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "access": { + # "vlan": "vlan100" + # }, + # "enhanced_layer": true, + # "name": "ge-0/0/1", + # "unit": 0 + # }, + # { + # "enhanced_layer": true, + # "name": "ge-0/0/2", + # "trunk": { + # "allowed_vlans": [ + # "vlan200", + # "vlan300" + # ], + # "native_vlan": "400" + # }, + # "unit": 0 + # } + # ] + # After state: + # ------------ + # + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible"; + # disable; + # speed 100m; + # mtu 1024; + # hold-time up 2000 down 2200; + # link-mode full-duplex; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members vlan100; + # } + # } + # } + # } + # ge-0/0/2 { + # description "Configured by Ansible"; + # native-vlan-id 400; + # speed 10m; + # mtu 2048; + # hold-time up 3000 down 3200; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan200 vlan300 ]; + # } + # } + # } + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # ge-0/0/1 + # Configured by Ansible + # + # 100m + # 1024 + # + # 2000 + # 2200 + # + # full-duplex + # + # 0 + # + # + # access + # + # vlan100 + # + # + # + # + # + # + # + # + # - name: Convert interfaces config to argspec without connecting to the appliance + # junipernetworks.junos.junos_l2_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "access": { + # "vlan": "vlan100" + # }, + # "enhanced_layer": true, + # "name": "ge-0/0/1", + # "unit": 0 + # }, + # { + # "enhanced_layer": true, + # "name": "ge-0/0/2", + # "trunk": { + # "allowed_vlans": [ + # "vlan200", + # "vlan300" + # ], + # "native_vlan": "400" + # }, + # "unit": 0 + # } + # ] + # + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/1 + access: + vlan: vlan100 + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # ge-0/0/1 + # + # 0 + # + # + # access + # + # vlan100 + # + # + # + # + # + # + # ge-0/0/2 + # + # 0 + # + # + # trunk + # + # vlan200 + # vlan300 + # + # + # + # + # 400 + # + # " + + + +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:
+
['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:unit> <nc:name>0</nc:name> <nc:family> <nc:ethernet-switching> <nc:interface-mode>access</nc:interface-mode> <nc:vlan> <nc:members>vlan100</nc:members> </nc:vlan> </nc:ethernet-switching> </nc:family> </nc:unit> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:unit> <nc:name>0</nc:name> <nc:family> <nc:ethernet-switching> <nc:interface-mode>trunk</nc:interface-mode> <nc:vlan> <nc:members>vlan200</nc:members> <nc:members>vlan300</nc:members> </nc:vlan> </nc:ethernet-switching> </nc:family> </nc:unit> <nc:native-vlan-id>400</nc:native-vlan-id> </nc:interface> </nc:interfaces>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interface_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interface_module.rst new file mode 100644 index 00000000..f8f25514 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interface_module.rst @@ -0,0 +1,628 @@ +.. _junipernetworks.junos.junos_l3_interface_module: + + +**************************************** +junipernetworks.junos.junos_l3_interface +**************************************** + +**(deprecated, removed after 2022-06-01) Manage L3 interfaces on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_l3_interfaces ` instead. + + + +Synopsis +-------- +- This module provides declarative management of L3 interfaces on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of L3 interfaces definitions
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ filter6_input + +
+ string +
+
+ +
The name of input filter for ipv6.
+
+
+ filter6_output + +
+ string +
+
+ +
The name of output filter for ipv6.
+
+
+ filter_input + +
+ string +
+
+ +
The name of input filter.
+
+
+ filter_output + +
+ string +
+
+ +
The name of output filter.
+
+
+ ipv4 + +
+ string +
+
+ +
IPv4 of the L3 interface.
+
+
+ ipv6 + +
+ string +
+
+ +
IPv6 of the L3 interface.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the L3 interface.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
State of the L3 interface configuration.
+
+
+ unit + +
+ integer +
+
+ Default:
0
+
+
Logical interface number.
+
+
+ filter6_input + +
+ string +
+
+ +
The name of input filter for ipv6.
+
+
+ filter6_output + +
+ string +
+
+ +
The name of output filter for ipv6.
+
+
+ filter_input + +
+ string +
+
+ +
The name of input filter.
+
+
+ filter_output + +
+ string +
+
+ +
The name of output filter.
+
+
+ ipv4 + +
+ string +
+
+ +
IPv4 of the L3 interface.
+
+
+ ipv6 + +
+ string +
+
+ +
IPv6 of the L3 interface.
+
+
+ name + +
+ string +
+
+ +
Name of the L3 interface.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 L3 interface configuration.
+
+
+ unit + +
+ integer +
+
+ Default:
0
+
+
Logical interface number.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: Set ge-0/0/1 IPv4 address + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.168.0.1 + + - name: Remove ge-0/0/1 IPv4 address + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + state: absent + + - name: Set ipv4 address using aggregate + junipernetworks.junos.junos_l3_interface: + aggregate: + - name: ge-0/0/1 + ipv4: 192.0.2.1 + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + + - name: Delete ipv4 address using aggregate + junipernetworks.junos.junos_l3_interface: + aggregate: + - name: ge-0/0/1 + ipv4: 192.0.2.1 + - name: ge-0/0/2 + ipv4: 192.0.2.2 + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit interfaces ge-0/0/1 unit 0 family inet] + address 192.0.2.1/32; [edit interfaces ge-0/0/1 unit 0 family inet6] + address fd5d:12c9:2201:1::1/128;
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interfaces_module.rst new file mode 100644 index 00000000..3ec94094 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_l3_interfaces_module.rst @@ -0,0 +1,888 @@ +.. _junipernetworks.junos.junos_l3_interfaces_module: + + +***************************************** +junipernetworks.junos.junos_l3_interfaces +***************************************** + +**L3 interfaces resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of a Layer 3 interface on Juniper JUNOS devices + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of Layer 3 interface options
+
+
+ ipv4 + +
+ list + / elements=dictionary +
+
+ +
IPv4 addresses to be set for the Layer 3 logical interface mentioned in name option. The address format is <ipv4 address>/<mask>. The mask is number in range 0-32 for example, 192.0.2.1/24, or dhcp to query DHCP for an IP address
+
+
+ address + +
+ string +
+
+ +
IPv4 address to be set for the specific interface
+
+
+ ipv6 + +
+ list + / elements=dictionary +
+
+ +
IPv6 addresses to be set for the Layer 3 logical interface mentioned in name option. The address format is <ipv6 address>/<mask>, the mask is number in range 0-128 for example, 2001:db8:2201:1::1/64 or auto-config to use SLAAC
+
+
+ address + +
+ string +
+
+ +
IPv6 address to be set for the specific interface
+
+
+ name + +
+ string + / required +
+
+ +
Full name of interface, e.g. ge-0/0/1
+
+
+ unit + +
+ integer +
+
+ Default:
0
+
+
Logical interface number. Value of unit should be of type integer
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show interfaces.
+
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 of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using deleted + + # Before state: + # ------------- + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 10.200.16.10/24; + # } + # } + # } + # ge-0/0/2 { + # description "non L3 interface"; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members 2; + # } + # } + # } + # } + + - name: Delete JUNOS L3 logical interface + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + state: deleted + + # After state: + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "deleted L3 interface"; + # } + # ge-0/0/2 { + # description "non L3 interface"; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members 2; + # } + # } + # } + # } + # Using merged + # Before state + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 10.200.16.10/24; + # } + # } + # } + # ge-0/0/2 { + # description "non configured interface"; + # unit 0; + # } + - name: Merge provided configuration with device configuration (default operation is merge) + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + ipv4: + - address: 192.168.1.10/24 + ipv6: + - address: 8d8d:8d01::1/64 + - name: ge-0/0/2 + ipv4: + - address: dhcp + state: merged + + # After state: + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 10.200.16.10/24; + # address 192.168.1.10/24; + # } + # family inet6 { + # address 8d8d:8d01::1/64; + # } + # } + # } + # ge-0/0/2 { + # description "L3 interface with dhcp"; + # unit 0 { + # family inet { + # dhcp; + # } + # } + # } + + + # Using overridden + + # Before state + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 10.200.16.10/24; + # } + # } + # } + # ge-0/0/2 { + # description "L3 interface with dhcp"; + # unit 0 { + # family inet { + # dhcp; + # } + # } + # } + # ge-0/0/3 { + # description "another L3 interface"; + # unit 0 { + # family inet { + # address 192.168.1.10/24; + # } + # } + # } + + - name: Override provided configuration with device configuration + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + ipv4: + - address: 192.168.1.10/24 + ipv6: + - address: 8d8d:8d01::1/64 + - name: ge-0/0/2 + ipv6: + - address: 2001:db8:3000::/64 + state: overridden + + # After state: + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 192.168.1.10/24; + # } + # family inet6 { + # address 8d8d:8d01::1/64; + # } + # } + # } + # ge-0/0/2 { + # description "L3 interface with ipv6"; + # unit 0 { + # family inet6 { + # address 2001:db8:3000::/64; + # } + # } + # } + # ge-0/0/3 { + # description "overridden L3 interface"; + # unit 0; + # } + + + # Using replaced + + # Before state + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 10.200.16.10/24; + # } + # } + # } + # ge-0/0/2 { + # description "non configured interface"; + # unit 0; + # } + # ge-0/0/3 { + # description "another L3 interface"; + # unit 0 { + # family inet { + # address 192.168.1.10/24; + # } + # } + # } + + - name: Replace provided configuration with device configuration + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + ipv4: + - address: 192.168.1.10/24 + ipv6: + - address: 8d8d:8d01::1/64 + - name: ge-0/0/2 + ipv4: + - address: dhcp + state: replaced + + # After state: + # ------------ + # + # admin# show interfaces + # ge-0/0/1 { + # description "L3 interface"; + # unit 0 { + # family inet { + # address 192.168.1.10/24; + # } + # family inet6 { + # address 8d8d:8d01::1/64; + # } + # } + # } + # ge-0/0/2 { + # description "L3 interface with dhcp"; + # unit 0 { + # family inet { + # dhcp; + # } + # } + # } + # ge-0/0/3 { + # description "another L3 interface"; + # unit 0 { + # family inet { + # address 192.168.1.10/24; + # } + # } + # } + # Using gathered + # Before state: + # ------------ + # + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible"; + # disable; + # speed 100m; + # mtu 1024; + # hold-time up 2000 down 2200; + # link-mode full-duplex; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members vlan100; + # } + # } + # } + # } + # ge-0/0/2 { + # description "Configured by Ansible"; + # native-vlan-id 400; + # speed 10m; + # mtu 2048; + # hold-time up 3000 down 3200; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan200 vlan300 ]; + # } + # } + # } + # } + # ge-1/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.1/24; + # address 10.200.16.20/24; + # } + # family inet6; + # } + # } + # ge-2/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.2/24; + # address 10.200.16.21/24; + # } + # family inet6; + # } + # } + # ge-3/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.3/24; + # address 10.200.16.22/24; + # } + # family inet6; + # } + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + - name: Gather junos layer3 interfaces as in given arguments + junipernetworks.junos.junos_l3_interfaces: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "ipv4": [ + # { + # "address": "192.168.100.1/24" + # }, + # { + # "address": "10.200.16.20/24" + # } + # ], + # "name": "ge-1/0/0", + # "unit": "0" + # }, + # { + # "ipv4": [ + # { + # "address": "192.168.100.2/24" + # }, + # { + # "address": "10.200.16.21/24" + # } + # ], + # "name": "ge-2/0/0", + # "unit": "0" + # }, + # { + # "ipv4": [ + # { + # "address": "192.168.100.3/24" + # }, + # { + # "address": "10.200.16.22/24" + # } + # ], + # "name": "ge-3/0/0", + # "unit": "0" + # }, + # { + # "ipv4": [ + # { + # "address": "10.8.38.38/24" + # } + # ], + # "name": "fxp0", + # "unit": "0" + # } + # ] + # After state: + # ------------ + # + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Configured by Ansible"; + # disable; + # speed 100m; + # mtu 1024; + # hold-time up 2000 down 2200; + # link-mode full-duplex; + # unit 0 { + # family ethernet-switching { + # interface-mode access; + # vlan { + # members vlan100; + # } + # } + # } + # } + # ge-0/0/2 { + # description "Configured by Ansible"; + # native-vlan-id 400; + # speed 10m; + # mtu 2048; + # hold-time up 3000 down 3200; + # unit 0 { + # family ethernet-switching { + # interface-mode trunk; + # vlan { + # members [ vlan200 vlan300 ]; + # } + # } + # } + # } + # ge-1/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.1/24; + # address 10.200.16.20/24; + # } + # family inet6; + # } + # } + # ge-2/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.2/24; + # address 10.200.16.21/24; + # } + # family inet6; + # } + # } + # ge-3/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.3/24; + # address 10.200.16.22/24; + # } + # family inet6; + # } + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # ge-1/0/0 + # + # 0 + # + # + #
+ # 192.168.100.1/24 + #
+ #
+ # 10.200.16.20/24 + #
+ #
+ # + #
+ #
+ #
+ # + # ge-2/0/0 + # + # 0 + # + # + #
+ # 192.168.100.2/24 + #
+ #
+ # 10.200.16.21/24 + #
+ #
+ # + #
+ #
+ #
+ #
+ #
+ #
+ # - name: Convert interfaces config to argspec without connecting to the appliance + # junipernetworks.junos.junos_l3_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "ipv4": [ + # { + # "address": "192.168.100.1/24" + # }, + # { + # "address": "10.200.16.20/24" + # } + # ], + # "name": "ge-1/0/0", + # "unit": "0" + # }, + # { + # "ipv4": [ + # { + # "address": "192.168.100.2/24" + # }, + # { + # "address": "10.200.16.21/24" + # } + # ], + # "name": "ge-2/0/0", + # "unit": "0" + # } + # ] + # + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-1/0/0 + ipv4: + - address: 192.168.100.1/24 + - address: 10.200.16.20/24 + unit: 0 + + - name: ge-2/0/0 + ipv4: + - address: 192.168.100.2/24 + - address: 10.200.16.21/24 + unit: 0 + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # ge-1/0/0 + # + # 0 + # + # + # + # 192.168.100.1/24 + # + # + # 10.200.16.20/24 + # + # + # + # + # + # + # ge-2/0/0 + # + # 0 + # + # + # + # 192.168.100.2/24 + # + # + # 10.200.16.21/24 + # + # + # + # + # + # " + + + +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:
+
['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ge-1/0/0</nc:name> <nc:unit> <nc:name>0</nc:name> <nc:family> <nc:inet> <nc:address> <nc:name>192.168.100.1/24</nc:name> </nc:address> <nc:address> <nc:name>10.200.16.20/24</nc:name> </nc:address> </nc:inet> </nc:family> </nc:unit> </nc:interfaces>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Daniel Mellado (@dmellado) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_interfaces_module.rst new file mode 100644 index 00000000..a1af096a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_interfaces_module.rst @@ -0,0 +1,1100 @@ +.. _junipernetworks.junos.junos_lacp_interfaces_module: + + +******************************************* +junipernetworks.junos.junos_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 Juniper JUNOS devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
The list of dictionaries of LACP interfaces options.
+
+
+ force_up + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
This is a boolean argument to control if the port should be up in absence of received link Aggregation Control Protocol Data Unit (LACPDUS). This value is applicable for member interfaces only.
+
+
+ name + +
+ string +
+
+ +
Name Identifier of the interface or link aggregation group.
+
+
+ period + +
+ string +
+
+
    Choices: +
  • fast
  • +
  • slow
  • +
+
+
Timer interval for periodic transmission of LACP packets. If the value is set to fast the packets are received every second and if the value is slow the packets are received every 30 seconds. This value is applicable for aggregate interface only.
+
+
+ port_priority + +
+ integer +
+
+ +
Priority of the member port. This value is applicable for member interfaces only.
+
Refer to vendor documentation for valid values.
+
+
+ sync_reset + +
+ string +
+
+
    Choices: +
  • disable
  • +
  • enable
  • +
+
+
The argument notifies minimum-link failure out of sync to peer. If the value is disable it disables minimum-link failure handling at LACP level and if value is enable it enables minimum-link failure handling at LACP level. This value is applicable for aggregate interface only.
+
+
+ system + +
+ dictionary +
+
+ +
This dict object contains configurable options related to LACP system parameters for the link aggregation group. This value is applicable for aggregate interface only.
+
+
+ mac + +
+ dictionary +
+
+ +
Specifies the system ID to use in LACP negotiations for the bundle, encoded as a MAC address.
+
+
+ address + +
+ string +
+
+ +
The system ID to use in LACP negotiations.
+
+
+ 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 Junos device by executing the command show 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 of the configuration after module completion.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad ae4; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad ae0; + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + - name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + - name: ge-0/0/3 + port_priority: 100 + force_up: true + state: merged + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad ae4; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae0; + # } + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # periodic fast; + # sync-reset enable; + # system-priority 100; + # system-id 00:00:00:00:00:02; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + # Using replaced + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad ae4; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae0; + # } + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # periodic fast; + # sync-reset enable; + # system-priority 100; + # system-id 00:00:00:00:00:02; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + - name: Replace device LACP interfaces configuration with provided configuration + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + period: slow + state: replaced + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad ae4; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae0; + # } + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # periodic slow; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + # Using overridden + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad ae4; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae0; + # } + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # periodic slow; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + - name: Overrides all device LACP interfaces configuration with provided configuration + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + system: + priority: 300 + mac: + address: 00:00:00:00:00:03 + - name: ge-0/0/2 + port_priority: 200 + force_up: false + state: overridden + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad { + # lacp { + # port-priority 200; + # } + # ae4; + # } + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae0; + # } + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # system-priority 300; + # system-id 00:00:00:00:00:03; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + # Using deleted + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad { + # lacp { + # port-priority 200; + # } + # ae4; + # } + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae0; + # } + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # system-priority 300; + # system-id 00:00:00:00:00:03; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + + - name: "Delete LACP interfaces attributes of given interfaces (Note: This won't delete the interface itself)" + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + - name: ge-0/0/3 + - name: ge-0/0/2 + state: deleted + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/2 { + # ether-options { + # 802.3ad ae4; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad ae0; + # } + # } + # ae0 { + # description "lag interface merged"; + # aggregated-ether-options { + # lacp { + # passive; + # } + # } + # } + # ae4 { + # description "test aggregate interface"; + # aggregated-ether-options { + # lacp { + # passive; + # link-protection; + # } + # } + # } + # Using gathered + # Before state: + # ------------ + # + # user@junos01# show interfaces + # ansible@cm123456tr21# show interfaces + # ge-0/0/1 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae1; + # } + # } + # } + # ge-0/0/2 { + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad ae2; + # } + # } + # ge-0/0/4 { + # ether-options { + # 802.3ad ae2; + # } + # } + # ge-1/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.1/24; + # address 10.200.16.20/24; + # } + # family inet6; + # } + # } + # ge-2/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.2/24; + # address 10.200.16.21/24; + # } + # family inet6; + # } + # } + # ge-3/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.3/24; + # address 10.200.16.22/24; + # } + # family inet6; + # } + # } + # ae1 { + # description "Configured by Ansible"; + # aggregated-ether-options { + # lacp { + # periodic fast; + # sync-reset enable; + # system-priority 100; + # system-id 00:00:00:00:00:02; + # } + # } + # } + # ae2 { + # description "Configured by Ansible"; + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + - name: Gather junos lacp interfaces as in given arguments + junipernetworks.junos.junos_lacp_interfaces: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "force_up": true, + # "name": "ge-0/0/1", + # "port_priority": 100 + # }, + # { + # "name": "ae1", + # "period": "fast", + # "sync_reset": "enable", + # "system": { + # "mac": { + # "address": "00:00:00:00:00:02" + # }, + # "priority": 100 + # } + # } + # ] + # After state: + # ------------ + # + # ansible@cm123456tr21# show interfaces + # ge-0/0/1 { + # ether-options { + # 802.3ad { + # lacp { + # force-up; + # port-priority 100; + # } + # ae1; + # } + # } + # } + # ge-0/0/2 { + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad ae2; + # } + # } + # ge-0/0/4 { + # ether-options { + # 802.3ad ae2; + # } + # } + # ge-1/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.1/24; + # address 10.200.16.20/24; + # } + # family inet6; + # } + # } + # ge-2/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.2/24; + # address 10.200.16.21/24; + # } + # family inet6; + # } + # } + # ge-3/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.3/24; + # address 10.200.16.22/24; + # } + # family inet6; + # } + # } + # ae1 { + # description "Configured by Ansible"; + # aggregated-ether-options { + # lacp { + # periodic fast; + # sync-reset enable; + # system-priority 100; + # system-id 00:00:00:00:00:02; + # } + # } + # } + # ae2 { + # description "Configured by Ansible"; + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # ge-0/0/1 + # + # + # + # + # 100 + # + # ae1 + # + # + # + # + # ge-0/0/2 + # + # + # ae1 + # + # + # + # + # ge-0/0/3 + # + # + # ae2 + # + # + # + # + # ge-0/0/4 + # + # + # ae2 + # + # + # + # + # ge-1/0/0 + # + # 0 + # + # + #
+ # 192.168.100.1/24 + #
+ #
+ # 10.200.16.20/24 + #
+ #
+ # + # + #
+ #
+ #
+ # + # ge-2/0/0 + # + # 0 + # + # + #
+ # 192.168.100.2/24 + #
+ #
+ # 10.200.16.21/24 + #
+ #
+ # + # + #
+ #
+ #
+ # + # ge-3/0/0 + # + # 0 + # + # + #
+ # 192.168.100.3/24 + #
+ #
+ # 10.200.16.22/24 + #
+ #
+ # + # + #
+ #
+ #
+ # + # ae1 + # Configured by Ansible + # + # + # fast + # enable + # 100 + # 00:00:00:00:00:02 + # + # + # + # + # ae2 + # Configured by Ansible + # + # + # em1 + # TEST + # + # + # fxp0 + # ANSIBLE + # 1g + # automatic + # + # 0 + # + # + #
+ # 10.8.38.38/24 + #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ # - name: Convert interfaces config to argspec without connecting to the appliance + # junipernetworks.junos.junos_lacp_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "force_up": true, + # "name": "ge-0/0/1", + # "port_priority": 100 + # }, + # { + # "name": "ae1", + # "period": "fast", + # "sync_reset": "enable", + # "system": { + # "mac": { + # "address": "00:00:00:00:00:02" + # }, + # "priority": 100 + # } + # } + # ] + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # ae1 + # + # + # fast + # enable + # 00:00:00:00:00:02 + # 100 + # + # + # + # + # ge-0/0/1 + # + # + # + # 100 + # + # + # + # + # + # " + + + +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:
+
['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ae1</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:periodic>fast</nc:periodic> <nc:sync-reset>enable</nc:sync-reset> <nc:system-id>00:00:00:00:00:02</nc:system-id> <nc:system-priority>100</nc:system-priority> </nc:lacp> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:lacp> <nc:port-priority>100</nc:port-priority> <nc:force-up/> </nc:lacp> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> </nc:interfaces>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_module.rst new file mode 100644 index 00000000..d805b73a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lacp_module.rst @@ -0,0 +1,375 @@ +.. _junipernetworks.junos.junos_lacp_module: + + +******************************** +junipernetworks.junos.junos_lacp +******************************** + +**Global Link Aggregation Control Protocol (LACP) Junos resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of global LACP on Juniper Junos network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
A dictionary of LACP global options
+
+
+ link_protection + +
+ string +
+
+
    Choices: +
  • revertive
  • +
  • non-revertive
  • +
+
+
Enable LACP link-protection for the system. If the value is set to non-revertive it will not revert links when a better priority link comes up. By default the link will be reverted.
+
+
+ system_priority + +
+ integer +
+
+ +
LACP priority for the system.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show chassis aggregated-devices ethernet 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
  • +
  • gathered
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 18.1R1. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using deleted + + # Before state: + # ------------- + # user@junos01# show chassis aggregated-devices ethernet lacp + # system-priority 63; + # link-protection { + # non-revertive; + # } + + - name: Delete global LACP attributes + junipernetworks.junos.junos_lacp: + state: deleted + + # After state: + # ------------ + # user@junos01# show chassis aggregated-devices ethernet lacp + # + + + # Using merged + + # Before state: + # ------------- + # user@junos01# show chassis aggregated-devices ethernet lacp + # + + - name: Merge global LACP attributes + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: revertive + state: merged + + # After state: + # ------------ + # user@junos01# show chassis aggregated-devices ethernet lacp + # system-priority 63; + # link-protection { + # non-revertive; + # } + + + # Using replaced + + # Before state: + # ------------- + # user@junos01# show chassis aggregated-devices ethernet lacp + # system-priority 63; + # link-protection { + # non-revertive; + # } + + - name: Replace global LACP attributes + junipernetworks.junos.junos_lacp: + config: + system_priority: 30 + link_protection: non-revertive + state: replaced + + # After state: + # ------------ + # user@junos01# show chassis aggregated-devices ethernet lacp + # system-priority 30; + # link-protection; + # + # Using gathered + # Before state: + # ------------ + # + # ansible@cm123456tr21# show chassis aggregated-devices ethernet lacp + # system-priority 63; + # link-protection; + + - name: Gather junos lacp as in given arguments + junipernetworks.junos.junos_lacp: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": { + # "link_protection": "revertive", + # "system_priority": 63 + # } + # After state: + # ------------ + # + # ansible@cm123456tr21# show chassis aggregated-devices ethernet lacp + # system-priority 63; + # link-protection; + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: revertive + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # + # + # 63 + # + # + # + # + # + # + # + # + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # + # + # 63 + # + # + # + # + # + # + # + # + # - name: Convert lacp config to argspec without connecting to the appliance + # junipernetworks.junos.junos_lacp: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": { + # "link_protection": "revertive", + # "system_priority": 63 + # } + + + +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.
+
+
+ xml + +
+ list +
+
always +
The set of xml rpc payload pushed to the remote device.
+
+
Sample:
+
['<nc:chassis xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:aggregated-devices> <nc:ethernet> <nc:lacp> <nc:system-priority>63</nc:system-priority> <nc:link-protection> <nc:non-revertive delete="delete"/> </nc:link-protection> </nc:lacp> </nc:ethernet> </nc:aggregated-devices> </nc:chassis>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lag_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lag_interfaces_module.rst new file mode 100644 index 00000000..d3ab7e89 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lag_interfaces_module.rst @@ -0,0 +1,966 @@ +.. _junipernetworks.junos.junos_lag_interfaces_module: + + +****************************************** +junipernetworks.junos.junos_lag_interfaces +****************************************** + +**Link Aggregation Juniper JUNOS resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages properties of Link Aggregation Group on Juniper JUNOS devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A list of link aggregation group configurations.
+
+
+ link_protection + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
This boolean option indicates if link protection should be enabled for the LAG interface. If value is True link protection is enabled on LAG and if value is False link protection is disabled.
+
+
+ members + +
+ list + / elements=dictionary +
+
+ +
List of member interfaces of the link aggregation group. The value can be single interface or list of interfaces.
+
+
+ link_type + +
+ string +
+
+
    Choices: +
  • primary
  • +
  • backup
  • +
+
+
The value of this options configures the member link as either primary or backup. Value primary configures primary interface for link-protection mode and backup configures backup interface for link-protection mode.
+
+
+ member + +
+ string +
+
+ +
Name of the member interface.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • active
  • +
  • passive
  • +
+
+
LAG mode. A value of passive will enable LACP in passive mode that is it will respond to LACP packets and active configures the link to initiate transmission of LACP packets.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the link aggregation group (LAG).
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show interfaces.
+
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 of the configuration after module completion
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 18.4R1. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # ether-options { + # 802.3ad ae0; + # } + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # ether-options { + # 802.3ad ae0; + # } + # } + # ae0 { + # description "lag interface"; + # } + # ae1 { + # description "lag interface 1"; + # } + + - name: "Delete LAG attributes of given interfaces (Note: This won't delete the interface itself)" + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + - name: ae1 + state: deleted + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # } + + + # Using merged + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # } + + - name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + members: + - member: ge-0/0/1 + link_type: primary + - member: ge-0/0/2 + link_type: backup + state: merged + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # ether-options { + # 802.3ad { + # ae0; + # primary; + # } + # } + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # ether-options { + # 802.3ad { + # ae0; + # backup; + # } + # } + # } + + + # Using merged + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # ether-options { + # 802.3ad ae0; + # } + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # ether-options { + # 802.3ad ae0; + # } + # } + # ae0 { + # description "lag interface"; + # } + # ae3 { + # description "lag interface 3"; + # } + + - name: Overrides all device LAG configuration with provided configuration + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + members: + - member: ge-0/0/2 + - name: ae1 + members: + - member: ge-0/0/1 + mode: passive + state: overridden + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # ether-options { + # 802.3ad ae0; + # } + # } + # ae0 { + # description "lag interface"; + # } + # ae1 { + # aggregated-ether-options { + # lacp { + # active; + # } + # } + # } + + + # Using merged + + # Before state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # } + # ge-0/0/3 { + # description "Ansible configured interface 3"; + # } + + - name: Replace device LAG configuration with provided configuration + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + members: + - member: ge-0/0/1 + mode: active + state: replaced + + # After state: + # ------------- + # user@junos01# show interfaces + # ge-0/0/1 { + # description "Ansible configured interface 1"; + # ether-options { + # 802.3ad ae0; + # } + # } + # ge-0/0/2 { + # description "Ansible configured interface 2"; + # } + # ae0 { + # aggregated-ether-options { + # lacp { + # active; + # } + # } + # } + # ge-0/0/3 { + # description "Ansible configured interface 3"; + # } + # Using gathered + # Before state: + # ------------ + # + # ansible@cm123456tr21# show interfaces + # ge-0/0/1 { + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/2 { + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # ae2; + # primary; + # } + # } + # } + # ge-0/0/4 { + # ether-options { + # 802.3ad { + # ae2; + # backup; + # } + # } + # } + # ge-1/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.1/24; + # address 10.200.16.20/24; + # } + # family inet6; + # } + # } + # ge-2/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.2/24; + # address 10.200.16.21/24; + # } + # family inet6; + # } + # } + # ge-3/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.3/24; + # address 10.200.16.22/24; + # } + # family inet6; + # } + # } + # ae1 { + # description "Configured by Ansible"; + # aggregated-ether-options { + # lacp { + # active; + # } + # } + # } + # ae2 { + # description "Configured by Ansible"; + # aggregated-ether-options { + # link-protection; + # lacp { + # passive; + # } + # } + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + - name: Gather junos lag interfaces as in given arguments + junipernetworks.junos.junos_lag_interfaces: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "members": [ + # { + # "member": "ge-0/0/1" + # }, + # { + # "member": "ge-0/0/2" + # } + # ], + # "mode": "active", + # "name": "ae1" + # }, + # { + # "link_protection": true, + # "members": [ + # { + # "link_type": "primary", + # "member": "ge-0/0/3" + # }, + # { + # "link_type": "backup", + # "member": "ge-0/0/4" + # } + # ], + # "mode": "passive", + # "name": "ae2" + # } + # ] + # After state: + # ------------ + # + # ansible@cm123456tr21# show interfaces + # ge-0/0/1 { + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/2 { + # ether-options { + # 802.3ad ae1; + # } + # } + # ge-0/0/3 { + # ether-options { + # 802.3ad { + # ae2; + # primary; + # } + # } + # } + # ge-0/0/4 { + # ether-options { + # 802.3ad { + # ae2; + # backup; + # } + # } + # } + # ge-1/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.1/24; + # address 10.200.16.20/24; + # } + # family inet6; + # } + # } + # ge-2/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.2/24; + # address 10.200.16.21/24; + # } + # family inet6; + # } + # } + # ge-3/0/0 { + # unit 0 { + # family inet { + # address 192.168.100.3/24; + # address 10.200.16.22/24; + # } + # family inet6; + # } + # } + # ae1 { + # description "Configured by Ansible"; + # aggregated-ether-options { + # lacp { + # active; + # } + # } + # } + # ae2 { + # description "Configured by Ansible"; + # aggregated-ether-options { + # link-protection; + # lacp { + # passive; + # } + # } + # } + # em1 { + # description TEST; + # } + # fxp0 { + # description ANSIBLE; + # speed 1g; + # link-mode automatic; + # unit 0 { + # family inet { + # address 10.8.38.38/24; + # } + # } + # } + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # ge-0/0/1 + # + # + # ae1 + # + # + # + # + # ge-0/0/2 + # + # + # ae1 + # + # + # + # + # ge-0/0/3 + # + # + # ae2 + # + # + # + # + # + # ge-0/0/4 + # + # + # ae2 + # + # + # + # + # + # ge-1/0/0 + # + # 0 + # + # + #
+ # 192.168.100.1/24 + #
+ #
+ # 10.200.16.20/24 + #
+ #
+ # + # + #
+ #
+ #
+ # + # ge-2/0/0 + # + # 0 + # + # + #
+ # 192.168.100.2/24 + #
+ #
+ # 10.200.16.21/24 + #
+ #
+ # + # + #
+ #
+ #
+ # + # ge-3/0/0 + # + # 0 + # + # + #
+ # 192.168.100.3/24 + #
+ #
+ # 10.200.16.22/24 + #
+ #
+ # + # + #
+ #
+ #
+ # + # ae1 + # Configured by Ansible + # + # + # + # + # + # + # + # ae2 + # Configured by Ansible + # + # + # + # + # + # + # + # + # + # em1 + # TEST + # + # + # fxp0 + # ANSIBLE + # 1g + # automatic + # + # 0 + # + # + #
+ # 10.8.38.38/24 + #
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ # - name: Convert interfaces config to argspec without connecting to the appliance + # junipernetworks.junos.junos_lag_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "members": [ + # { + # "member": "ge-0/0/1" + # }, + # { + # "member": "ge-0/0/2" + # } + # ], + # "mode": "active", + # "name": "ae1" + # }, + # { + # "link_protection": true, + # "members": [ + # { + # "link_type": "primary", + # "member": "ge-0/0/3" + # }, + # { + # "link_type": "backup", + # "member": "ge-0/0/4" + # } + # ], + # "mode": "passive", + # "name": "ae2" + # } + # ] + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae1 + members: + - member: ge-0/0/1 + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + - member: ge-0/0/3 + link_type: primary + - member: ge-0/0/4 + link_type: backup + mode: passive + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # ae1 + # + # + # + # + # + # + # + # ge-0/0/1 + # + # + # ae1 + # + # + # + # + # ge-0/0/2 + # + # + # ae1 + # + # + # + # + # ae2 + # + # + # + # + # + # + # + # + # ge-0/0/3 + # + # + # ae2 + # + # + # + # + # + # ge-0/0/4 + # + # + # ae2 + # + # + # + # + # " + + + +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.
+
+
+ xml + +
+ list +
+
always +
The set of xml rpc payload pushed to the remote device.
+
+
Sample:
+
['<nc:interfaces xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:interface> <nc:name>ae1</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:active/> </nc:lacp> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae1</nc:bundle> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae1</nc:bundle> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ae2</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:passive/> </nc:lacp> <nc:link-protection/> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/3</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae2</nc:bundle> <nc:primary/> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/4</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae2</nc:bundle> <nc:backup/> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> </nc:interfaces>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_linkagg_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_linkagg_module.rst new file mode 100644 index 00000000..728c72fa --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_linkagg_module.rst @@ -0,0 +1,610 @@ +.. _junipernetworks.junos.junos_linkagg_module: + + +*********************************** +junipernetworks.junos.junos_linkagg +*********************************** + +**(deprecated, removed after 2022-06-01) Manage link aggregation groups on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_lag_interfaces ` instead. + + + +Synopsis +-------- +- This module provides declarative management of link aggregation groups on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of link aggregation definitions.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ description + +
+ string +
+
+ +
Description of Interface.
+
+
+ device_count + +
+ integer +
+
+ +
Number of aggregated ethernet devices that can be configured. Acceptable integer value is between 1 and 128.
+
+
+ members + +
+ list + / elements=string +
+
+ +
List of members interfaces of the link aggregation group. The value can be single interface or list of interfaces.
+
+
+ min_links + +
+ integer +
+
+ +
Minimum members that should be up before bringing up the link aggregation group.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • on
  • +
  • off
  • +
  • active
  • +
  • passive
  • +
+
+
Mode of the link aggregation group. A value of on will enable LACP in passive mode. active configures the link to actively information about the state of the link, or it can be configured in passive mode ie. send link state information only when received them from another link. A value of off will disable LACP.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the link aggregation group.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
  • up
  • +
  • down
  • +
+
+
State of the link aggregation group.
+
+
+ description + +
+ string +
+
+ +
Description of Interface.
+
+
+ device_count + +
+ integer +
+
+ +
Number of aggregated ethernet devices that can be configured. Acceptable integer value is between 1 and 128.
+
+
+ members + +
+ list + / elements=string +
+
+ +
List of members interfaces of the link aggregation group. The value can be single interface or list of interfaces.
+
+
+ min_links + +
+ integer +
+
+ +
Minimum members that should be up before bringing up the link aggregation group.
+
+
+ mode + +
+ string +
+
+
    Choices: +
  • on ←
  • +
  • off
  • +
  • active
  • +
  • passive
  • +
+
+
Mode of the link aggregation group. A value of on will enable LACP in passive mode. active configures the link to actively information about the state of the link, or it can be configured in passive mode ie. send link state information only when received them from another link. A value of off will disable LACP.
+
+
+ name + +
+ string +
+
+ +
Name of the link aggregation group.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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
  • +
  • up
  • +
  • down
  • +
+
+
State of the link aggregation group.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: present + + - name: delete link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: delete + + - name: deactivate link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: present + active: false + + - name: Activate link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: present + active: true + + - name: Disable link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + state: down + + - name: Enable link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + state: up + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit interfaces] + ge-0/0/6 { + ether-options { + 802.3ad ae0; + } + } [edit interfaces ge-0/0/7] + ether-options { + 802.3ad ae0; + } [edit interfaces] + ae0 { + description "configured by junos_linkagg"; + aggregated-ether-options { + lacp { + active; + } + } + }
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_global_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_global_module.rst new file mode 100644 index 00000000..28e9a7d8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_global_module.rst @@ -0,0 +1,444 @@ +.. _junipernetworks.junos.junos_lldp_global_module: + + +*************************************** +junipernetworks.junos.junos_lldp_global +*************************************** + +**LLDP resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages link layer discovery protocol (LLDP) attributes on Juniper JUNOS devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ dictionary +
+
+ +
The list of link layer discovery protocol attribute configurations
+
+
+ address + +
+ string +
+
+ +
This argument sets the management address from LLDP.
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
This argument is a boolean value to enabled or disable LLDP.
+
+
+ hold_multiplier + +
+ integer +
+
+ +
Specify the number of seconds that LLDP information is held before it is discarded. The multiplier value is used in combination with the interval value.
+
+
+ interval + +
+ integer +
+
+ +
Frequency at which LLDP advertisements are sent (in seconds).
+
+
+ transmit_delay + +
+ integer +
+
+ +
Specify the number of seconds the device waits before sending advertisements to neighbors after a change is made in local system.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show protocols 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
  • +
  • gathered
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 18.4R1. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # Before state: + # ------------- + # user@junos01# # show protocols lldp + # + - name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + + # After state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # transmit-delay 400; + # hold-multiplier 10; + + # Using replaced + # Before state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # transmit-delay 400; + # hold-multiplier 10; + + - name: Replace provided configuration with device configuration + junipernetworks.junos.junos_lldp_global: + config: + address: 20.2.2.2 + hold_multiplier: 30 + enabled: false + state: replaced + + # After state: + # ------------- + # user@junos01# show protocols lldp + # disable; + # management-address 20.2.2.2; + # hold-multiplier 30; + + # Using deleted + # Before state: + # ------------- + # user@junos01# show protocols lldp + # management-address 20.2.2.2; + # hold-multiplier 30; + + - name: Delete lldp configuration (this will by default remove all lldp configuration) + junipernetworks.junos.junos_lldp_global: + state: deleted + + # After state: + # ------------- + # user@junos01# # show protocols lldp + # + # + # Using gathered + # Before state: + # ------------ + # + # ansible@cm123456tr21# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # transmit-delay 400; + # hold-multiplier 10; + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + - name: Gather junos lldp_global as in given arguments + junipernetworks.junos.junos_lldp_global: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": { + # "address": "10.1.1.1", + # "hold_multiplier": 10, + # "interval": 10000, + # "transmit_delay": 400 + # } + # After state: + # ------------ + # + # ansible@cm123456tr21# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # transmit-delay 400; + # hold-multiplier 10; + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # 10.1.1.1 + # 10000 + # 400 + # 10 + # + # + # " + # + # parsed.cfg + # ------------ + # + # + # + # + # + # + # + # 0.0.0.0 + # + # ge-0/0/0.0 + # + # + # + # + # 10.1.1.1 + # 10000 + # 400 + # 10 + # + # ge-0/0/1 + # + # + # ge-0/0/2 + # + # + # + # + # + # + # - name: Convert lldp global config to argspec without connecting to the appliance + # junipernetworks.junos.junos_lldp_global: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": { + # "address": "10.1.1.1", + # "hold_multiplier": 10, + # "interval": 10000, + # "transmit_delay": 400 + # } + + + +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:
+
['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:lldp> <nc:management-address>10.1.1.1</nc:management-address> <nc:advertisement-interval>10000</nc:advertisement-interval> <nc:transmit-delay>400</nc:transmit-delay> <nc:hold-multiplier>10</nc:hold-multiplier> <nc:disable delete="delete"/> </nc:lldp> </nc:protocols>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interface_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interface_module.rst new file mode 100644 index 00000000..c0af861e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interface_module.rst @@ -0,0 +1,341 @@ +.. _junipernetworks.junos.junos_lldp_interface_module: + + +****************************************** +junipernetworks.junos.junos_lldp_interface +****************************************** + +**(deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_lldp_interfaces ` instead. + + + +Synopsis +-------- +- This module provides declarative management of LLDP interfaces configuration on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ name + +
+ string +
+
+ +
Name of the interface LLDP should be configured on.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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
  • +
  • enabled
  • +
  • disabled
  • +
+
+
Value of present ensures given LLDP configured on given interfaces and is enabled, for value of absent LLDP configuration on given interfaces deleted. Value enabled ensures LLDP protocol is enabled on given interfaces and for value of disabled it ensures LLDP is disabled on given interfaces.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: Configure LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + + - name: Disable LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: disabled + + - name: Enable LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: enabled + + - name: Delete LLDP configuration on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + + - name: Deactivate LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + active: false + + - name: Activate LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + active: true + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit protocols lldp] + interface ge-0/0/5;
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interfaces_module.rst new file mode 100644 index 00000000..8b673840 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_interfaces_module.rst @@ -0,0 +1,427 @@ +.. _junipernetworks.junos.junos_lldp_interfaces_module: + + +******************************************* +junipernetworks.junos.junos_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 Juniper JUNOS devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
The list of link layer discovery protocol interface attribute configurations
+
+
+ enabled + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
This is a boolean value to control disabling of LLDP on the interface name
+
+
+ name + +
+ string + / required +
+
+ +
Name of the interface LLDP needs to be configured on.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show protocols 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
  • +
  • overridden
  • +
  • deleted
  • +
  • gathered
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state of the configuration after module completion.
+
+
+ + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # Before state: + # ------------- + # user@junos01# # show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + + - name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + enabled: false + state: merged + + # After state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + + # Using replaced + # Before state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + + - name: Replace provided configuration with device configuration + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/2 + disable: false + - name: ge-0/0/3 + enabled: false + state: replaced + + # After state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/1; + # interface ge-0/0/2; + # interface ge-0/0/3 { + # disable; + # } + + # Using overridden + # Before state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + + - name: Override provided configuration with device configuration + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/2 + enabled: false + state: overridden + + # After state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/2 { + # disable; + # } + + # Using deleted + # Before state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/1; + # interface ge-0/0/2; + # interface ge-0/0/3 { + # disable; + # } + - name: Delete lldp interface configuration (this will not delete other lldp configuration) + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/3 + state: deleted + + # After state: + # ------------- + # user@junos01# show protocols lldp + # management-address 10.1.1.1; + # advertisement-interval 10000; + # interface ge-0/0/2; + # interface ge-0/0/1; + # Using gathered + # Before state: + # ------------ + # + #ansible@cm123456tr21# show protocols lldp + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + - name: Gather junos lldp interfaces as in given arguments + junipernetworks.junos.junos_lldp_interfaces: + state: gathered + # Task Output (redacted) + # ----------------------- + # + # "gathered": [ + # { + # "name": "ge-0/0/1" + # }, + # { + # "enabled": false, + # "name": "ge-0/0/2" + # } + # ] + # After state: + # ------------ + # + #ansible@cm123456tr21# show protocols lldp + # interface ge-0/0/1; + # interface ge-0/0/2 { + # disable; + # } + # Using rendered + - name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + enabled: false + state: rendered + # Task Output (redacted) + # ----------------------- + # "rendered": " + # + # + # ge-0/0/1 + # + # + # + # ge-0/0/2 + # + # + # + # " + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # + # 0.0.0.0 + # + # ge-0/0/0.0 + # + # + # + # + # + # ge-0/0/1 + # + # + # ge-0/0/2 + # + # + # + # + # + # + # - name: Convert lldp interfaces config to argspec without connecting to the appliance + # junipernetworks.junos.junos_lldp_interfaces: + # running_config: "{{ lookup('file', './parsed.cfg') }}" + # state: parsed + # Task Output (redacted) + # ----------------------- + # "parsed": [ + # { + # "name": "ge-0/0/1" + # }, + # { + # "enabled": false, + # "name": "ge-0/0/2" + # } + # ] + + + +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:
+
['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:lldp> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:disable delete="delete"/> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:disable/> </nc:interface> </nc:lldp> </nc:protocols>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_module.rst new file mode 100644 index 00000000..7548f275 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_lldp_module.rst @@ -0,0 +1,361 @@ +.. _junipernetworks.junos.junos_lldp_module: + + +******************************** +junipernetworks.junos.junos_lldp +******************************** + +**(deprecated, removed after 2022-06-01) Manage LLDP configuration on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_lldp_global ` instead. + + + +Synopsis +-------- +- This module provides declarative management of LLDP service on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ hold_multiplier + +
+ integer +
+
+ +
Specify the number of seconds that LLDP information is held before it is discarded. The multiplier value is used in combination with the interval value.
+
+
+ interval + +
+ integer +
+
+ +
Frequency at which LLDP advertisements are sent (in seconds).
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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
  • +
  • enabled
  • +
  • disabled
  • +
+
+
Value of present ensures given LLDP configuration is present on device and LLDP is enabled, for value of absent LLDP configuration is deleted and LLDP is in disabled state. Value enabled ensures LLDP protocol is enabled and LLDP configuration if any is configured on remote device, for value of disabled it ensures LLDP protocol is disabled any LLDP configuration if any is still present.
+
+
+ transmit_delay + +
+ integer +
+
+ +
Specify the number of seconds the device waits before sending advertisements to neighbors after a change is made in local system.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: Enable LLDP service + junipernetworks.junos.junos_lldp: + state: enabled + + - name: Disable LLDP service + junipernetworks.junos.junos_lldp: + state: disabled + + - name: Set LLDP parameters + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 30 + state: present + + - name: Delete LLDP parameters + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 30 + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit] + protocols { + lldp { + disable; + } + }
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_logging_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_logging_module.rst new file mode 100644 index 00000000..b02f2814 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_logging_module.rst @@ -0,0 +1,612 @@ +.. _junipernetworks.junos.junos_logging_module: + + +*********************************** +junipernetworks.junos.junos_logging +*********************************** + +**Manage logging on network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of logging on Juniper JUNOS devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of logging definitions.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ dest + +
+ string +
+
+
    Choices: +
  • console
  • +
  • host
  • +
  • file
  • +
  • user
  • +
+
+
Destination of the logs.
+
+
+ facility + +
+ string +
+
+ +
Set logging facility.
+
+
+ files + +
+ integer +
+
+ +
Number of files to be archived, this is applicable if value of dest is file. The acceptable value is in range from 1 to 1000.
+
+
+ level + +
+ string +
+
+ +
Set logging severity levels.
+
+
+ name + +
+ string +
+
+ +
If value of dest is file it indicates file-name, for user it indicates username and for host indicates the host name to be notified.
+
+
+ rotate_frequency + +
+ integer +
+
+ +
Rotate log frequency in minutes, this is applicable if value of dest is file. The acceptable value is in range of 1 to 59. This controls the frequency after which log file is rotated.
+
+
+ size + +
+ integer +
+
+ +
Size of the file in archive, this is applicable if value of dest is file. The acceptable value is in range from 65536 to 1073741824 bytes.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
State of the logging configuration.
+
+
+ dest + +
+ string +
+
+
    Choices: +
  • console
  • +
  • host
  • +
  • file
  • +
  • user
  • +
+
+
Destination of the logs.
+
+
+ facility + +
+ string +
+
+ +
Set logging facility.
+
+
+ files + +
+ integer +
+
+ +
Number of files to be archived, this is applicable if value of dest is file. The acceptable value is in range from 1 to 1000.
+
+
+ level + +
+ string +
+
+ +
Set logging severity levels.
+
+
+ name + +
+ string +
+
+ +
If value of dest is file it indicates file-name, for user it indicates username and for host indicates the host name to be notified.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ rotate_frequency + +
+ integer +
+
+ +
Rotate log frequency in minutes, this is applicable if value of dest is file. The acceptable value is in range of 1 to 59. This controls the frequency after which log file is rotated.
+
+
+ size + +
+ integer +
+
+ +
Size of the file in archive, this is applicable if value of dest is file. The acceptable value is in range from 65536 to 1073741824 bytes.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
State of the logging configuration.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure console logging + junipernetworks.junos.junos_logging: + dest: console + facility: any + level: critical + + - name: remove console logging configuration + junipernetworks.junos.junos_logging: + dest: console + state: absent + + - name: configure file logging + junipernetworks.junos.junos_logging: + dest: file + name: test + facility: pfe + level: error + + - name: configure logging parameter + junipernetworks.junos.junos_logging: + files: 30 + size: 65536 + rotate_frequency: 10 + + - name: Configure file logging using aggregate + junipernetworks.junos.junos_logging: + dest: file + aggregate: + - name: test-1 + facility: pfe + level: critical + - name: test-2 + facility: kernel + level: emergency + active: true + + - name: Delete file logging using aggregate + junipernetworks.junos.junos_logging: + aggregate: + - {dest: file, name: test-1, facility: pfe, level: critical} + - {dest: file, name: test-2, facility: kernel, level: emergency} + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit system syslog] + [edit system syslog] + file interactive-commands { ... } + + file test { + pfe critical; + }
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf.rst new file mode 100644 index 00000000..0bba0a2e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf.rst @@ -0,0 +1,76 @@ +.. _junipernetworks.junos.junos_netconf: + + +*************************** +junipernetworks.junos.junos +*************************** + +**Use junos netconf plugin to run netconf commands on Juniper JUNOS platform** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This junos plugin provides low level abstraction apis for sending and receiving netconf commands from Juniper JUNOS network devices. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + +
ParameterChoices/DefaultsConfigurationComments
+
+ ncclient_device_handler + +
+ string +
+
+ Default:
"junos"
+
+ +
Specifies the ncclient device handler name for Juniper junos 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/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf_module.rst new file mode 100644 index 00000000..7656512e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_netconf_module.rst @@ -0,0 +1,282 @@ +.. _junipernetworks.junos.junos_netconf_module: + + +*********************************** +junipernetworks.junos.junos_netconf +*********************************** + +**Configures the Junos Netconf system service** + + +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 Junos devices. 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. If the ``netconf_port`` is not mentioned in the task by default netconf will be enabled on port 830 only. + + + + +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
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 junos_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:: + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``network_cli``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - If ``netconf_port`` value is not mentioned in task by default it will be enabled on port 830 only. Although ``netconf_port`` value can be from 1 through 65535, avoid configuring access on a port that is normally assigned for another service. This practice avoids potential resource conflicts. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: enable netconf service on port 830 + junipernetworks.junos.junos_netconf: + listens_on: 830 + state: present + + - name: disable netconf service + junipernetworks.junos.junos_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:
+
set system services netconf ssh port 830
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospf_interfaces_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospf_interfaces_module.rst new file mode 100644 index 00000000..f5557623 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospf_interfaces_module.rst @@ -0,0 +1,1205 @@ +.. _junipernetworks.junos.junos_ospf_interfaces_module: + + +******************************************* +junipernetworks.junos.junos_ospf_interfaces +******************************************* + +**OSPF Interfaces Resource Module.** + + +Version added: 1.3.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages OSPF(v2/v3) configuration of interfaces on devices running Juniper JUNOS. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) + + +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.
+
+
+ processes + +
+ dictionary +
+
+ +
Interfaces configuration for an OSPF process.
+
+
+ area + +
+ dictionary +
+
+ +
Specify the area-id
+
+
+ area_id + +
+ string +
+
+ +
Specify area id.
+
+
+ authentication + +
+ dictionary +
+
+ +
Specify authentication type
+
+
+ md5 + +
+ dictionary +
+
+ +
Specify md5 based authentication.
+
+
+ key_id + +
+ string +
+
+ +
Specify md5 key-id
+
+
+ key_value + +
+ string +
+
+ +
Specify key value
+
+
+ start_time + +
+ string +
+
+ +
Specify start time for key transmission
+
+
+ simple_password + +
+ string +
+
+ +
Specify password for authentication.
+
+
+ bandwidth_based_metrics + +
+ list + / elements=dictionary +
+
+ +
Specify list of bandwidth based metrics
+
+
+ bandwidth + +
+ string +
+
+
    Choices: +
  • 1g
  • +
  • 10g
  • +
+
+
BW to apply metric to.
+
+
+ metric + +
+ integer +
+
+ +
Specify metric
+
+
+ dead_interval + +
+ integer +
+
+ +
Dead interval (seconds).
+
+
+ demand_circuit + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Interface functions as a demand circuit.
+
+
+ flood_reduction + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable flood reduction.
+
+
+ hello_interval + +
+ integer +
+
+ +
Hello interval (seconds).
+
+
+ interface_type + +
+ string +
+
+
    Choices: +
  • nbma
  • +
  • p2mp
  • +
  • p2p
  • +
+
+
Specify type of interface
+
+
+ ipsec_sa + +
+ string +
+
+ +
IPSec security association name
+
+
+ metric + +
+ integer +
+
+ +
Metric applied to the interface.
+
+
+ mtu + +
+ integer +
+
+ +
Maximum OSPF packet size
+
+
+ no_advertise_adjacency_segment + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not advertise an adjacency segment for this interface.
+
+
+ no_eligible_backup + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Not eligible to backup traffic from protected interfaces.
+
+
+ no_eligible_remote_backup + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Not eligible for Remote-LFA backup traffic from protected interfaces.
+
+
+ no_interface_state_traps + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Do not send interface state change traps.
+
+
+ no_neighbor_down_notification + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Don't inform other protocols about neighbor down events.
+
+
+ node_link_protection + +
+ string +
+
+ +
Protect interface from both link and node faults.
+
+
+ poll_interval + +
+ integer +
+
+ +
Poll interval (seconds).
+
+
+ priority + +
+ integer +
+
+ +
Priority for the interface.
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Retransmit interval (seconds).
+
+
+ secondary + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Treat interface as secondary
+
+
+ te_metric + +
+ integer +
+
+ +
Traffic engineering metric applied to the interface.
+
+
+ transit_delay + +
+ integer +
+
+ +
Transit delay (seconds).
+
+
+ name + +
+ string + / required +
+
+ +
Name/Identifier of the interface.
+
+
+ router_id + +
+ string + / required +
+
+ +
The OSPFv3 router id.
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show protocols 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
  • +
  • parsed
  • +
  • gathered
  • +
  • rendered
  • +
+
+
The state the configuration should be left in.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # Before state + # ------------ + # + # admin# show protocols ospf + + - name: Merge Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: merged + + # After state + # ----------- + # + # admin# show protocols ospf + # area 0.0.0.2 { + # interface ge-0/0/2.0 { + # metric 5; + # priority 3; + # } + # } + + # Using replaced + # + # Before state + # ------------ + # + # admin# show protocols ospf + # area 0.0.0.2 { + # interface ge-0/0/2.0 { + # metric 5; + # priority 3; + # } + # } + - name: Replace Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 6 + metric: 6 + state: replaced + + # After state + # ----------- + # + # admin# show protocols ospf + # area 0.0.0.1 { + # interface ge-0/0/2.0 { + # metric 6; + # priority 6; + # } + # } + + # Using overridden + # + # Before state + # ------------ + # + # admin# show protocols ospf + # area 0.0.0.3 { + # interface ge-0/0/3.0 { + # metric 5; + # priority 3; + # } + # } + # area 0.0.0.2 { + # interface ge-0/0/2.0 { + # metric 5; + # priority 3; + # } + # } + + - name: Override Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/1.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 3 + metric: 5 + state: overridden + + # After state + # ----------- + # + # admin# show protocols ospf + # area 0.0.0.1 { + # interface ge-0/0/1.0 { + # metric 5; + # priority 3; + # } + # } + + # + # Using deleted + # + # Before state + # ------------ + # + # admin# show protocols ospf + # area 0.0.0.1 { + # interface ge-0/0/1.0 { + # metric 5; + # priority 3; + # } + # } + + - name: Delete Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/1.0' + state: deleted + + # After state + # ----------- + # + # admin# show protocols ospf + # Using gathered + # + # Before state + # ------------ + # + # admin# show protocols ospf + # area 0.0.0.3 { + # interface ge-0/0/3.0 { + # metric 5; + # priority 3; + # } + # } + # area 0.0.0.2 { + # interface ge-0/0/2.0 { + # metric 5; + # priority 3; + # } + # } + + - name: Gather Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + state: gathered + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # "gathered": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "processes": { + # "area": { + # "area_id": "0.0.0.3" + # }, + # "metric": 5, + # "priority": 3 + # } + # } + # ], + # "name": "ge-0/0/3.0", + # "router_id": "10.200.16.75" + # }, + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "processes": { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "metric": 5, + # "priority": 3 + # } + # } + # ], + # "name": "ge-0/0/2.0", + # "router_id": "10.200.16.75" + # } + # ] + # + # Using rendered + # + # + - name: Render the commands for provided configuration + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: rendered + + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "rendered": " + # + # + # + # 0.0.0.2 + # + # ge-0/0/2.0 + # 3 + # 5 + # + # + # + # " + # + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # + # + # + # 0.0.0.2 + # + # 200 + # + # + # ge-0/0/2.0 + # 5 + # 3 + # + # + # + # + # + # 10.200.16.75 + # + # + # + + + - name: Parsed the device configuration to get output commands + junipernetworks.junos.junos_ospf_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "parsed": [ + # { + # "address_family": [ + # { + # "afi": "ipv4", + # "processes": { + # "area": { + # "area_id": "0.0.0.2" + # }, + # "metric": 5, + # "priority": 3 + # } + # } + # ], + # "name": "ge-0/0/2.0", + # "router_id": "10.200.16.75" + # } + # ] + # + + + +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:
+
['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:ospf> <nc:area> <nc:name>0.0.0.3</nc:name> <nc:interface> <nc:name>ge-0/0/3.0</nc:name> <nc:priority>3</nc:priority> <nc:metric>5</nc:metric> </nc:interface> </nc:area> <nc:area> <nc:name>0.0.0.2</nc:name> <nc:interface> <nc:name>ge-0/0/2.0</nc:name> <nc:priority>3</nc:priority> <nc:metric>5</nc:metric> </nc:interface> </nc:area> </nc:ospf> </nc:protocols>", " <nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:router-id>10.200.16.75</nc:router-id> <nc:router-id>10.200.16.75</nc:router-id> </nc:routing-options>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv2_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv2_module.rst new file mode 100644 index 00000000..ef18543c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv2_module.rst @@ -0,0 +1,909 @@ +.. _junipernetworks.junos.junos_ospfv2_module: + + +********************************** +junipernetworks.junos.junos_ospfv2 +********************************** + +**OSPFv2 resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages global OSPFv2 configuration on devices running Juniper JUNOS. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A list of OSPFv2 process configuration.
+
+
+ areas + +
+ list + / elements=dictionary +
+
+ +
A list of OSPFv2 areas' configuration.
+
+
+ area_id + +
+ string + / required +
+
+ +
The Area ID as an integer or IP Address.
+
+
+ area_range + +
+ string +
+
+ +
Configure an address range for the area.
+
+
+ interfaces + +
+ list + / elements=dictionary +
+
+ +
List of interfaces in this area.
+
+
+ authentication + +
+ dictionary +
+
+ +
Specify authentication type
+
+
+ type + +
+ dictionary +
+
+ +
Type of authentication to use.
+
+
+ bandwidth_based_metrics + +
+ list + / elements=dictionary +
+
+ +
Specify list of bandwidth based metrics
+
+
+ bandwidth + +
+ string +
+
+
    Choices: +
  • 1g
  • +
  • 10g
  • +
+
+
BW to apply metric to.
+
+
+ metric + +
+ integer +
+
+ +
Specify metric
+
+
+ flood_reduction + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable flood reduction.
+
+
+ metric + +
+ integer +
+
+ +
Metric applied to the interface.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the interface.
+
+
+ passive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify passive
+
+
+ priority + +
+ integer +
+
+ +
Priority for the interface.
+
+
+ timers + +
+ dictionary +
+
+ +
Specify timers
+
+
+ dead_interval + +
+ integer +
+
+ +
Dead interval (seconds).
+
+
+ hello_interval + +
+ integer +
+
+ +
Hello interval (seconds).
+
+
+ poll_interval + +
+ integer +
+
+ +
Poll interval (seconds).
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Retransmit interval (seconds).
+
+
+ transit_delay + +
+ integer +
+
+ +
Transit delay (seconds).
+
+
+ stub + +
+ dictionary +
+
+ +
Settings for configuring the area as a stub.
+
+
+ default_metric + +
+ integer +
+
+ +
Metric for the default route in this area.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure the area as a stub.
+
+
+ external_preference + +
+ integer +
+
+ +
Preference of external routes.
+
+
+ overload + +
+ dictionary +
+
+ +
Specify time for overload mode reset
+
+
+ timeout + +
+ integer +
+
+ +
Time after which overload mode is reset (seconds).
+
+
+ preference + +
+ integer +
+
+ +
Preference of internal routes.
+
+
+ prefix_export_limit + +
+ integer +
+
+ +
Maximum number of external prefixes that can be exported.
+
+
+ reference_bandwidth + +
+ string +
+
+
    Choices: +
  • 1g
  • +
  • 10g
  • +
+
+
Bandwidth for calculating metric defaults.
+
+
+ rfc1583compatibility + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set RFC1583 compatibility
+
+
+ router_id + +
+ string + / required +
+
+ +
The OSPFv2 router id.
+
+
+ spf_options + +
+ dictionary +
+
+ +
Configure options for SPF.
+
+
+ delay + +
+ integer +
+
+ +
Time to wait before running an SPF (seconds).
+
+
+ holddown + +
+ integer +
+
+ +
Time to hold down before running an SPF (seconds).
+
+
+ rapid_runs + +
+ integer +
+
+ +
Number of maximum rapid SPF runs before holddown (seconds).
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command B(show protocols 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
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state the configuration should be left in.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # Before state + # ------------ + # + # admin# show protocols ospf + + - name: Merge Junos OSPFv2 config + junipernetworks.junos.junos_ospfv2: + config: + - router_id: 10.200.16.75 + reference_bandwidth: 10g + areas: + - area_id: 0.0.0.100 + area_range: 10.200.16.0/24 + stub: + default_metric: 100 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: false + passive: true + bandwidth_based_metrics: + - bandwidth: 1g + metric: 5 + - bandwidth: 10g + metric: 40 + timers: + dead_interval: 4 + hello_interval: 2 + poll_interval: 2 + retransmit_interval: 2 + rfc1583compatibility: false + state: merged + + # After state + # ----------- + # + # admin# show protocols ospf + # reference-bandwidth 10g; + # no-rfc-1583; + # area 0.0.0.100 { + # stub default-metric 100; + # area-range 10.200.16.0/24; + # interface so-0/0/0.0 { + # passive; + # bandwidth-based-metrics { + # bandwidth 1g metric 5; + # bandwidth 10g metric 40; + # } + # metric 5; + # priority 3; + # retransmit-interval 2; + # hello-interval 2; + # dead-interval 4; + # poll-interval 2; + # } + # } + + + +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:
+
['command 1', 'command 2', 'command 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Daniel Mellado (@dmellado) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv3_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv3_module.rst new file mode 100644 index 00000000..1dfad70f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ospfv3_module.rst @@ -0,0 +1,1231 @@ +.. _junipernetworks.junos.junos_ospfv3_module: + + +********************************** +junipernetworks.junos.junos_ospfv3 +********************************** + +**OSPFv3 resource module** + + +Version added: 1.2.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages global OSPFv3 configuration on devices running Juniper JUNOS. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A list of OSPFv3 process configuration.
+
+
+ areas + +
+ list + / elements=dictionary +
+
+ +
A list of OSPFv3 areas' configuration.
+
+
+ area_id + +
+ string + / required +
+
+ +
The Area ID as an integer or IP Address.
+
+
+ area_range + +
+ string +
+
+ +
Configure an address range for the area.
+
+
+ interfaces + +
+ list + / elements=dictionary +
+
+ +
List of interfaces in this area.
+
+
+ authentication + +
+ dictionary +
+
+ +
Specify authentication type
+
+
+ type + +
+ dictionary +
+
+ +
Type of authentication to use.
+
+
+ bandwidth_based_metrics + +
+ list + / elements=dictionary +
+
+ +
Specify list of bandwidth based metrics
+
+
+ bandwidth + +
+ string +
+
+
    Choices: +
  • 1g
  • +
  • 10g
  • +
+
+
BW to apply metric to.
+
+
+ metric + +
+ integer +
+
+ +
Specify metric
+
+
+ flood_reduction + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Enable flood reduction.
+
+
+ metric + +
+ integer +
+
+ +
Metric applied to the interface.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the interface.
+
+
+ passive + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specify passive
+
+
+ priority + +
+ integer +
+
+ +
Priority for the interface.
+
+
+ timers + +
+ dictionary +
+
+ +
Specify timers
+
+
+ dead_interval + +
+ integer +
+
+ +
Dead interval (seconds).
+
+
+ hello_interval + +
+ integer +
+
+ +
Hello interval (seconds).
+
+
+ poll_interval + +
+ integer +
+
+ +
Poll interval (seconds).
+
+
+ retransmit_interval + +
+ integer +
+
+ +
Retransmit interval (seconds).
+
+
+ transit_delay + +
+ integer +
+
+ +
Transit delay (seconds).
+
+
+ stub + +
+ dictionary +
+
+ +
Settings for configuring the area as a stub.
+
+
+ default_metric + +
+ integer +
+
+ +
Metric for the default route in this area.
+
+
+ set + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Configure the area as a stub.
+
+
+ external_preference + +
+ integer +
+
+ +
Preference of external routes.
+
+
+ overload + +
+ dictionary +
+
+ +
Specify time for overload mode reset
+
+
+ timeout + +
+ integer +
+
+ +
Time after which overload mode is reset (seconds).
+
+
+ preference + +
+ integer +
+
+ +
Preference of internal routes.
+
+
+ prefix_export_limit + +
+ integer +
+
+ +
Maximum number of external prefixes that can be exported.
+
+
+ reference_bandwidth + +
+ string +
+
+
    Choices: +
  • 1g
  • +
  • 10g
  • +
+
+
Bandwidth for calculating metric defaults.
+
+
+ rfc1583compatibility + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Set RFC1583 compatibility
+
+
+ router_id + +
+ string + / required +
+
+ +
The OSPFv3 router id.
+
+
+ spf_options + +
+ dictionary +
+
+ +
Configure options for SPF.
+
+
+ delay + +
+ integer +
+
+ +
Time to wait before running an SPF (seconds).
+
+
+ holddown + +
+ integer +
+
+ +
Time to hold down before running an SPF (seconds).
+
+
+ rapid_runs + +
+ integer +
+
+ +
Number of maximum rapid SPF runs before holddown (seconds).
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command B(show protocols 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
  • +
  • rendered
  • +
  • parsed
  • +
+
+
The state the configuration should be left in.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # + # Before state + # ------------ + # + # admin# show protocols ospf3 + + - name: Merge Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + state: merged + + # After state + # ----------- + # + # adimn# show protocols ospf3 + # area 0.0.0.100 { + # stub default-metric 200; + # interface so-0/0/0.0 { + # metric 5; + # priority 3; + # } + # } + # Using replaced + # + # Before state + # ------------ + # + # adimn# show protocols ospf3 + # area 0.0.0.100 { + # stub default-metric 200; + # interface so-0/0/0.0 { + # metric 5; + # priority 3; + # } + # } + - name: Replace Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: replaced + + # After state + # ----------- + # + # admin# show protocols ospf3 + # area 0.0.0.100 { + # interface so-0/0/0.0; + # } + # Using overridden + # + # Before state + # ------------ + # + # admin# show protocols ospf3 + # area 0.0.0.100 { + # interface so-0/0/0.0; + # } + - name: Override Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: overridden + + # After state + # ----------- + # + # admin# show protocols ospf3 + # area 0.0.0.100 { + # stub default-metric 200; + # interface so-0/0/0.0 { + # passive; + # metric 5; + # priority 3; + # flood-reduction; + # } + # } + # area 0.0.0.200 { + # interface ge-1/1/0.0; + # interface ge-2/2/0.0; + # } + # + # Using deleted + # + # Before state + # ------------ + # + # adimn# show protocols ospf3 + # area 0.0.0.100 { + # stub default-metric 200; + # interface so-0/0/0.0 { + # metric 5; + # priority 3; + # } + # } + + - name: Delete Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: deleted + + # After state + # ----------- + # + # admin# show protocols ospf3 + # Using gathered + # + # Before state + # ------------ + # + # adimn# show protocols ospf3 + # area 0.0.0.100 { + # stub default-metric 200; + # interface so-0/0/0.0 { + # passive; + # metric 5; + # priority 3; + # flood-reduction; + # } + # } + # area 0.0.0.200 { + # interface ge-1/1/0.0; + # interface ge-2/2/0.0; + # } + + - name: Gather Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + state: gathered + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # "gathered": { + # "areas": [ + # { + # "area_id": "0.0.0.100", + # "interfaces": [ + # { + # "flood_reduction": true, + # "metric": 5, + # "name": "so-0/0/0.0", + # "passive": true, + # "priority": 3 + # } + # ], + # "stub": { + # "default_metric": 200, + # "set": true + # } + # }, + # { + # "area_id": "0.0.0.200", + # "interfaces": [ + # { + # "name": "ge-1/1/0.0" + # }, + # { + # "name": "ge-2/2/0.0" + # } + # ] + # } + # ], + # "router_id": "10.200.16.75" + # } + # + # Using rendered + # + # + - name: Render the commands for provided configuration + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: rendered + + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "rendered": " + # + # + # + # 0.0.0.100 + # + # so-0/0/0.0 + # 3 + # + # 5 + # + # + # + # 200 + # + # + # + # 0.0.0.200 + # + # ge-1/1/0.0 + # + # + # ge-2/2/0.0 + # + # + # + # " + # + # Using parsed + # parsed.cfg + # ------------ + # + # + # + # 18.4R1-S2.4 + # + # + # ge-0/0/0 + # Configured by Ansi-Team + # + # + # gr-0/0/0 + # Configured Manually + # + # + # fxp0 + # + # 0 + # + # + # + # + # + # + # + # + # + # + # + # + # 0.0.0.100 + # + # 200 + # + # + # so-0/0/0.0 + # + # + # 5 + # 3 + # + # + # + # + # 0.0.0.200 + # + # ge-1/1/0.0 + # + # + # ge-2/2/0.0 + # + # + # + # + # + # 10.200.16.75 + # + # + # + # + # rohit + # pts/0 + # 38210 + # 2020-09-29 04:49:37 UTC + # 00:09:06 + # [edit] + # + # + # + # + + - name: Parsed the device configuration to get output commands + junipernetworks.junos.junos_ospfv3: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed + # + # + # ------------------------- + # Module Execution Result + # ------------------------- + # + # + # "parsed": [ + # { + # "areas": [ + # { + # "area_id": "0.0.0.100", + # "interfaces": [ + # { + # "flood_reduction": true, + # "metric": 5, + # "name": "so-0/0/0.0", + # "passive": true, + # "priority": 3 + # } + # ], + # "stub": { + # "default_metric": 200, + # "set": true + # } + # }, + # { + # "area_id": "0.0.0.200", + # "interfaces": [ + # { + # "name": "ge-1/1/0.0" + # }, + # { + # "name": "ge-2/2/0.0" + # } + # ] + # } + # ], + # "router_id": "10.200.16.75" + # } + # ] + # + + + +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:
+
['<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:ospf3 delete="delete"/> <nc:ospf3> <nc:area> <nc:name>0.0.0.100</nc:name> <nc:interface> <nc:name>so-0/0/0.0</nc:name> <nc:priority>3</nc:priority> <nc:flood-reduction/> <nc:metric>5</nc:metric> <nc:passive/> </nc:interface> <nc:stub> <nc:default-metric>200</nc:default-metric> </nc:stub> </nc:area> <nc:area> <nc:name>0.0.0.200</nc:name> <nc:interface> <nc:name>ge-1/1/0.0</nc:name> </nc:interface> <nc:interface> <nc:name>ge-2/2/0.0</nc:name> </nc:interface> </nc:area> </nc:ospf3> </nc:protocols>", " <nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:router-id delete="delete"/> <nc:router-id>10.200.16.75</nc:router-id> </nc:routing-options>', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Rohit Thakur (@rohitthakur2590) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_package_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_package_module.rst new file mode 100644 index 00000000..fd2e278a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_package_module.rst @@ -0,0 +1,405 @@ +.. _junipernetworks.junos.junos_package_module: + + +*********************************** +junipernetworks.junos.junos_package +*********************************** + +**Installs packages on remote devices running Junos** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module can install new and updated packages on remote devices running Junos. The module will compare the specified package with the one running on the remote device and install the specified version if there is a mismatch + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- junos-eznc +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ force + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The force argument instructs the module to bypass the package version check and install the packaged identified in src on the remote device.
+
+
+ force_host + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The force_host argument controls the way software package or bundle is added on remote JUNOS host and is applicable for JUNOS QFX5100 device. If the value is set to True it will ignore any warnings while adding the host software package or bundle.
+
+
+ issu + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The issu argument is a boolean flag when set to True allows unified in-service software upgrade (ISSU) feature which enables you to upgrade between two different Junos OS releases with no disruption on the control plane and with minimal disruption of traffic.
+
+
+ no_copy + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The no_copy argument is responsible for instructing the remote device on where to install the package from. When enabled, the package is transferred to the remote device prior to installing.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ reboot + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
In order for a package to take effect, the remote device must be restarted. When enabled, this argument will instruct the module to reboot the device once the updated package has been installed. If disabled or the remote package does not need to be changed, the device will not be started.
+
+
+ src + +
+ path + / required +
+
+ +
The src argument specifies the path to the source package to be installed on the remote device in the advent of a version mismatch. The src argument can be either a localized path or a full path to the package file to install.
+

aliases: package
+
+
+ ssh_config + +
+ path +
+
+ +
The ssh_config argument is path to the SSH configuration file. This can be used to load SSH information from a configuration file. If this option is not given by default ~/.ssh/config is queried.
+
+
+ ssh_private_key_file + +
+ path +
+
+ +
The ssh_private_key_file argument is path to the SSH private key file. This can be used if you need to provide a private key rather than loading the key into the ssh-key-ring/environment
+
+
+ validate + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
The validate argument is responsible for instructing the remote device to skip checking the current device configuration compatibility with the package being installed. When set to false validation is not performed.
+
+
+ version + +
+ string +
+
+ +
The version argument can be used to explicitly specify the version of the package that should be installed on the remote device. If the version argument is not specified, then the version is extracts from the src filename.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Works with ``local`` connections only. + - Since this module uses junos-eznc to establish connection with junos device the netconf configuration parameters needs to be passed using module options for example ``ssh_config`` unlike other junos modules that uses ``netconf`` connection type. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + # the required set of connection arguments have been purposely left off + # the examples for brevity + + - name: install local package on remote device + junipernetworks.junos.junos_package: + src: junos-vsrx-12.1X46-D10.2-domestic.tgz + + - name: install local package on remote device without rebooting + junipernetworks.junos.junos_package: + src: junos-vsrx-12.1X46-D10.2-domestic.tgz + reboot: no + + - name: install local package on remote device with jumpost + junipernetworks.junos.junos_package: + src: junos-vsrx-12.1X46-D10.2-domestic.tgz + ssh_config: /home/user/customsshconfig + + + + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ping_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ping_module.rst new file mode 100644 index 00000000..95fb763b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_ping_module.rst @@ -0,0 +1,458 @@ +.. _junipernetworks.junos.junos_ping_module: + + +******************************** +junipernetworks.junos.junos_ping +******************************** + +**Tests reachability using ping from devices running Juniper JUNOS** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Tests reachability using ping from devices running Juniper JUNOS to a remote destination. +- Tested against Junos (17.3R1.10) +- For a general purpose network module, see the :ref:`ansible.netcommon.net_ping ` module. +- For Windows targets, use the :ref:`ansible.windows.win_ping ` module instead. +- For targets running Python, use the :ref:`ansible.builtin.ping ` module instead. + + + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ count + +
+ integer +
+
+ Default:
5
+
+
Number of packets to send to check reachability.
+
+
+ dest + +
+ string + / required +
+
+ +
The IP Address or hostname (resolvable by the device) of the remote node.
+
+
+ interface + +
+ string +
+
+ +
The source interface to use while sending the ping packet(s).
+
+
+ interval + +
+ integer +
+
+ +
Determines the interval (in seconds) between consecutive pings.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 +
+
+ +
Determines the size (in bytes) of the ping packet(s).
+
+
+ source + +
+ string +
+
+ +
The IP Address to use while sending the ping packet(s).
+
+
+ state + +
+ string +
+
+
    Choices: +
  • absent
  • +
  • present ←
  • +
+
+
Determines if the expected result is success or fail.
+
+
+ ttl + +
+ integer +
+
+ +
The time-to-live value for the ICMP packet(s).
+
+
+ + +Notes +----- + +.. note:: + - For a general purpose network module, see the :ref:`ansible.netcommon..net_ping ` module. + - For Windows targets, use the :ref:`ansible.windows.win_ping ` module instead. + - For targets running Python, use the :ref:`ansible.builtin.ping ` module instead. + - This module works only with connection ``network_cli``. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: Test reachability to 10.10.10.10 + junipernetworks.junos.junos_ping: + dest: 10.10.10.10 + + - name: Test reachability to 10.20.20.20 using source and size set + junipernetworks.junos.junos_ping: + dest: 10.20.20.20 + size: 1024 + ttl: 128 + + - name: Test unreachability to 10.30.30.30 using interval + junipernetworks.junos.junos_ping: + dest: 10.30.30.30 + interval: 3 + state: absent + + - name: Test reachability to 10.40.40.40 setting count and interface + junipernetworks.junos.junos_ping: + dest: 10.40.40.40 + interface: fxp0 + count: 20 + size: 512 + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ commands + +
+ list +
+
always +
List of commands sent.
+
+
Sample:
+
['ping 10.8.38.44 count 10 source 10.8.38.38 ttl 128']
+
+
+ packet_loss + +
+ string +
+
always +
Percentage of packets lost.
+
+
Sample:
+
0%
+
+
+ packets_rx + +
+ integer +
+
always +
Packets successfully received.
+
+
Sample:
+
20
+
+
+ packets_tx + +
+ integer +
+
always +
Packets successfully transmitted.
+
+
Sample:
+
20
+
+
+ rtt + +
+ dictionary +
+
when ping succeeds +
The round trip time (RTT) stats.
+
+
Sample:
+
{'avg': 2, 'max': 8, 'min': 1, 'stddev': 24}
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Nilashish Chakraborty (@NilashishC) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_rpc_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_rpc_module.rst new file mode 100644 index 00000000..c6c23b54 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_rpc_module.rst @@ -0,0 +1,355 @@ +.. _junipernetworks.junos.junos_rpc_module: + + +******************************* +junipernetworks.junos.junos_rpc +******************************* + +**Runs an arbitrary RPC over NetConf on an Juniper JUNOS device** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Sends a request to the remote device running JUNOS to execute the specified RPC using the NetConf transport. The reply is then returned to the playbook in the ``xml`` key. If an alternate output format is requested, the reply is transformed to the requested output. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ args + +
+ dictionary +
+
+ +
The args argument provides a set of arguments for the RPC call and are encoded in the request message. This argument accepts a set of key=value arguments.
+
+
+ attrs + +
+ dictionary +
+
+ +
The attrs arguments defines a list of attributes and their values to set for the RPC call. This accepts a dictionary of key-values.
+
+
+ output + +
+ string +
+
+
    Choices: +
  • xml ←
  • +
  • json
  • +
  • text
  • +
+
+
The output argument specifies the desired output of the return data. This argument accepts one of xml, text, or json. For json, the JUNOS device must be running a version of software that supports native JSON output.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ rpc + +
+ string + / required +
+
+ +
The rpc argument specifies the RPC call to send to the remote devices to be executed. The RPC Reply message is parsed and the contents are returned to the playbook.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: collect interface information using rpc + junipernetworks.junos.junos_rpc: + rpc: get-interface-information + args: + interface-name: em0 + media: true + + - name: get system information + junipernetworks.junos.junos_rpc: + rpc: get-system-information + + - name: load configuration + junipernetworks.junos.junos_rpc: + rpc: load-configuration + attrs: + action: override + url: /tmp/config.conf + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ output + +
+ string +
+
always +
The rpc rely converted to the output format.
+
+
+
+ output_lines + +
+ list +
+
always +
The text output split into lines for readability.
+
+
+
+ xml + +
+ string +
+
always +
The xml return string from the rpc request.
+
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_scp_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_scp_module.rst new file mode 100644 index 00000000..9d671f3d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_scp_module.rst @@ -0,0 +1,365 @@ +.. _junipernetworks.junos.junos_scp_module: + + +******************************* +junipernetworks.junos.junos_scp +******************************* + +**Transfer files from or to remote devices running Junos** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module transfers files via SCP from or to remote devices running Junos. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- junos-eznc +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ dest + +
+ path +
+
+ Default:
"."
+
+
The dest argument specifies the path in which to receive the files.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ recursive + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The recursive argument enables recursive transfer of files and directories.
+
+
+ remote_src + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The remote_src argument enables the download of files (scp get) from the remote device. The default behavior is to upload files (scp put) to the remote device.
+
+
+ src + +
+ list + / elements=string + / required +
+
+ +
The src argument takes a single path, or a list of paths to be transferred. The argument recursive must be true to transfer directories.
+
+
+ ssh_config + +
+ path +
+
+ +
The ssh_config argument is path to the SSH configuration file. This can be used to load SSH information from a configuration file. If this option is not given by default ~/.ssh/config is queried.
+
+
+ ssh_private_key_file + +
+ path +
+
+ +
The ssh_private_key_file argument is path to the SSH private key file. This can be used if you need to provide a private key rather than loading the key into the ssh-key-ring/environment
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vMX JUNOS version 17.3R1.10. + - Works with ``local`` connections only. + - Since this module uses junos-eznc to establish connection with junos device the netconf configuration parameters needs to be passed using module options for example ``ssh_config`` unlike other junos modules that uses ``netconf`` connection type. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + # the required set of connection arguments have been purposely left off + # the examples for brevity + - name: upload local file to home directory on remote device + junipernetworks.junos.junos_scp: + src: test.tgz + + - name: upload local file to tmp directory on remote device + junipernetworks.junos.junos_scp: + src: test.tgz + dest: /tmp/ + + - name: download file from remote device + junipernetworks.junos.junos_scp: + src: test.tgz + remote_src: true + + - name: ssh config file path for jumphost config + junipernetworks.junos.junos_scp: + src: test.tgz + remote_src: true + ssh_config: /home/user/customsshconfig + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ changed + +
+ boolean +
+
always +
always true
+
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Christian Giese (@GIC-de) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_route_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_route_module.rst new file mode 100644 index 00000000..4e893d82 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_route_module.rst @@ -0,0 +1,562 @@ +.. _junipernetworks.junos.junos_static_route_module: + + +**************************************** +junipernetworks.junos.junos_static_route +**************************************** + +**(deprecated, removed after 2022-06-01) Manage static IP routes on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_static_routes ` instead. + + + +Synopsis +-------- +- This module provides declarative management of static IP routes on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ address + +
+ string +
+
+ +
Network address with prefix of the static route.
+

aliases: prefix
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of static route definitions
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ address + +
+ string +
+
+ +
Network address with prefix of the static route.
+
+
+ next_hop + +
+ string +
+
+ +
Next hop IP of the static route.
+
+
+ preference + +
+ integer +
+
+ +
Global admin preference of the static route.
+

aliases: admin_distance
+
+
+ qualified_next_hop + +
+ string +
+
+ +
Qualified next hop IP of the static route. Qualified next hops allow to associate preference with a particular next-hop address.
+
+
+ qualified_preference + +
+ integer +
+
+ +
Assign preference for qualified next hop.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
State of the static route configuration.
+
+
+ next_hop + +
+ string +
+
+ +
Next hop IP of the static route.
+
+
+ preference + +
+ integer +
+
+ +
Global admin preference of the static route.
+

aliases: admin_distance
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ qualified_next_hop + +
+ string +
+
+ +
Qualified next hop IP of the static route. Qualified next hops allow to associate preference with a particular next-hop address.
+
+
+ qualified_preference + +
+ integer +
+
+ +
Assign preference for qualified next hop.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
State of the static route configuration.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure static route + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + next_hop: 10.0.0.1 + preference: 10 + qualified_next_hop: 10.0.0.2 + qualified_preference: 3 + state: present + + - name: delete static route + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + state: absent + + - name: deactivate static route configuration + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + next_hop: 10.0.0.1 + preference: 10 + qualified_next_hop: 10.0.0.2 + qualified_preference: 3 + state: present + active: false + + - name: activate static route configuration + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + next_hop: 10.0.0.1 + preference: 10 + qualified_next_hop: 10.0.0.2 + qualified_preference: 3 + state: present + active: true + + - name: Configure static route using aggregate + junipernetworks.junos.junos_static_route: + aggregate: + - {address: 4.4.4.0/24, next_hop: 3.3.3.3, qualified_next_hop: 5.5.5.5, qualified_preference: 30} + - {address: 5.5.5.0/24, next_hop: 6.6.6.6, qualified_next_hop: 7.7.7.7, qualified_preference: 12} + preference: 10 + + - name: Delete static route using aggregate + junipernetworks.junos.junos_static_route: + aggregate: + - address: 4.4.4.0/24 + - address: 5.5.5.0/24 + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit routing-options static] + route 2.2.2.0/24 { ... } + + route 4.4.4.0/24 { + next-hop 3.3.3.3; + qualified-next-hop 5.5.5.5 { + + preference 30; + } + + preference 10; + }
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_routes_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_routes_module.rst new file mode 100644 index 00000000..debb94cc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_static_routes_module.rst @@ -0,0 +1,476 @@ +.. _junipernetworks.junos.junos_static_routes_module: + + +***************************************** +junipernetworks.junos.junos_static_routes +***************************************** + +**Static routes resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of static routes on Juniper JUNOS devices + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) +- xmltodict (>=0.12) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of static routes options
+
+
+ address_families + +
+ list + / elements=dictionary +
+
+ +
Address family to use for the static routes
+
+
+ afi + +
+ string + / required +
+
+
    Choices: +
  • ipv4
  • +
  • ipv6
  • +
+
+
afi to use for the static routes
+
+
+ routes + +
+ list + / elements=dictionary +
+
+ +
Static route configuration
+
+
+ dest + +
+ string +
+
+ +
Static route destination including prefix
+
+
+ metric + +
+ integer +
+
+ +
Metric value for the static route
+
+
+ next_hop + +
+ list + / elements=dictionary +
+
+ +
Next hop to destination
+
+
+ forward_router_address + +
+ string +
+
+ +
List of next hops
+
+
+ vrf + +
+ string +
+
+ +
Virtual Routing and Forwarding (VRF) name
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show routing-options.
+
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:: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - Tested against JunOS v18.4R1 + + + +Examples +-------- + +.. code-block:: yaml + + # Using deleted + + # Before state + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 172.16.1.2; + # route 192.168.16.0/24 next-hop 172.16.1.2; + # route 10.200.16.75/24 next-hop 10.200.16.2; + # } + + - name: Delete provided configuration (default operation is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 10.200.16.75/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: deleted + + # After state: + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 172.16.1.2; + # route 192.168.16.0/24 next-hop 172.16.1.2; + # } + + # Using merged + + # Before state + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 172.16.1.2; + # route 192.168.16.0/24 next-hop 172.16.1.2; + # } + + - name: Merge provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 10.200.16.75/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: merged + + # After state: + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 172.16.1.2; + # route 192.168.16.0/24 next-hop 172.16.1.2; + # route 10.200.16.75/24 next-hop 10.200.16.2; + # } + + # Using overridden + + # Before state + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 172.16.1.2; + # route 192.168.16.0/24 next-hop 172.16.0.1; + # } + + - name: Override provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 10.200.16.75/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: overridden + + # After state: + # ------------ + # + # admin# show routing-options + # static { + # route 10.200.16.75/24 next-hop 10.200.16.2; + # } + + # Using replaced + + # Before state + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 172.16.1.2; + # route 192.168.16.0/24 next-hop 172.16.1.2; + # } + + - name: Replace provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 192.168.47.0/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: replaced + + # After state: + # ------------ + # + # admin# show routing-options + # static { + # route 192.168.47.0/24 next-hop 10.200.16.2; + # route 192.168.16.0/24 next-hop 172.16.1.2; + # } + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ string +
+
when changed +
The resulting configuration model invocation.
+
+
Sample:
+
The configuration returned will always be in the same format + of the parameters above.
+
+
+ before + +
+ string +
+
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:
+
['command 1', 'command 2', 'command 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Daniel Mellado (@dmellado) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_system_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_system_module.rst new file mode 100644 index 00000000..0a6a558e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_system_module.rst @@ -0,0 +1,364 @@ +.. _junipernetworks.junos.junos_system_module: + + +********************************** +junipernetworks.junos.junos_system +********************************** + +**Manage the system attributes on Juniper JUNOS devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of node system attributes on Juniper JUNOS 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 (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ 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.
+
+
+ name_servers + +
+ list + / elements=string +
+
+ +
List of DNS name servers by IP address to use to perform name resolution lookups. This argument accepts either a list of DNS servers See examples.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure hostname and domain name + junipernetworks.junos.junos_system: + hostname: junos01 + domain_name: test.example.com + domain-search: + - ansible.com + - redhat.com + - juniper.net + + - name: remove configuration + junipernetworks.junos.junos_system: + state: absent + + - name: configure name servers + junipernetworks.junos.junos_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
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit system] + host-name test; + domain-name ansible.com; + domain-search redhat.com; [edit system name-server] + 172.26.1.1 { ... } + + 8.8.8.8;
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_user_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_user_module.rst new file mode 100644 index 00000000..3e748cf5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_user_module.rst @@ -0,0 +1,583 @@ +.. _junipernetworks.junos.junos_user_module: + + +******************************** +junipernetworks.junos.junos_user +******************************** + +**Manage local user accounts on Juniper JUNOS devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module manages locally configured user accounts on remote network devices running the JUNOS operating system. It provides a set of arguments for creating, removing and updating locally defined accounts + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
The aggregate argument defines a list of users to be configured on the remote device. The list of users will be compared against the current users and only changes will be added or removed from the device configuration. This argument is mutually exclusive with the name argument.
+

aliases: users, collection
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ encrypted_password + +
+ string +
+
+ +
The encrypted_password argument set already hashed password for the user account on the remote system.
+
+
+ full_name + +
+ string +
+
+ +
The full_name argument provides the full name of the user account to be created on the remote device. This argument accepts any text string value.
+
+
+ name + +
+ string + / required +
+
+ +
The name argument defines the username of the user to be created on the system. This argument must follow appropriate usernaming conventions for the target device running JUNOS. This argument is mutually exclusive with the aggregate argument.
+
+
+ purge + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The purge argument instructs the module to consider the users definition absolute. It will remove any previously configured users on the device with the exception of the current defined set of aggregate.
+
+
+ role + +
+ string +
+
+
    Choices: +
  • operator
  • +
  • read-only
  • +
  • super-user
  • +
  • unauthorized
  • +
+
+
The role argument defines the role of the user account on the remote system. User accounts can have more than one role configured.
+
+
+ sshkey + +
+ string +
+
+ +
The sshkey argument defines the public SSH key to be configured for the user account on the remote system. This argument must be a valid SSH key
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
The state argument configures the state of the user definitions as it relates to the device operational configuration. When set to present, the user should be configured in the device active configuration and when set to absent the user should not be in the device active configuration
+
+
+ encrypted_password + +
+ string +
+
+ +
The encrypted_password argument set already hashed password for the user account on the remote system.
+
+
+ full_name + +
+ string +
+
+ +
The full_name argument provides the full name of the user account to be created on the remote device. This argument accepts any text string value.
+
+
+ name + +
+ string +
+
+ +
The name argument defines the username of the user to be created on the system. This argument must follow appropriate usernaming conventions for the target device running JUNOS. This argument is mutually exclusive with the aggregate argument.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ purge + +
+ boolean +
+
+
    Choices: +
  • no ←
  • +
  • yes
  • +
+
+
The purge argument instructs the module to consider the users definition absolute. It will remove any previously configured users on the device with the exception of the current defined set of aggregate.
+
+
+ role + +
+ string +
+
+
    Choices: +
  • operator
  • +
  • read-only
  • +
  • super-user
  • +
  • unauthorized
  • +
+
+
The role argument defines the role of the user account on the remote system. User accounts can have more than one role configured.
+
+
+ sshkey + +
+ string +
+
+ +
The sshkey argument defines the public SSH key to be configured for the user account on the remote system. This argument must be a valid SSH key
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
The state argument configures the state of the user definitions as it relates to the device operational configuration. When set to present, the user should be configured in the device active configuration and when set to absent the user should not be in the device active configuration
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: create new user account + junipernetworks.junos.junos_user: + name: ansible + role: super-user + sshkey: "{{ lookup('file', '~/.ssh/ansible.pub') }}" + state: present + + - name: remove a user account + junipernetworks.junos.junos_user: + name: ansible + state: absent + + - name: remove all user accounts except ansible + junipernetworks.junos.junos_user: + aggregate: + - name: ansible + purge: yes + + - name: set user password + junipernetworks.junos.junos_user: + name: ansible + role: super-user + encrypted_password: "{{ 'my-password' | password_hash('sha512') }}" + state: present + + - name: Create list of users + junipernetworks.junos.junos_user: + aggregate: + - {name: test_user1, full_name: test_user2, role: operator, state: present} + - {name: test_user2, full_name: test_user2, role: read-only, state: present} + + - name: Delete list of users + junipernetworks.junos.junos_user: + aggregate: + - {name: test_user1, full_name: test_user2, role: operator, state: absent} + - {name: test_user2, full_name: test_user2, role: read-only, state: absent} + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit system login] + user test-user { + uid 2005; + class read-only; + }
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlan_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlan_module.rst new file mode 100644 index 00000000..7173e3d0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlan_module.rst @@ -0,0 +1,611 @@ +.. _junipernetworks.junos.junos_vlan_module: + + +******************************** +junipernetworks.junos.junos_vlan +******************************** + +**(deprecated, removed after 2022-06-01) Manage VLANs on Juniper JUNOS network devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Updated modules released with more functionality +:Alternative: Use :ref:`junipernetworks.junos.junos_vlans ` instead. + + + +Synopsis +-------- +- This module provides declarative management of VLANs on Juniper JUNOS network devices. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
List of VLANs definitions.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ description + +
+ string +
+
+ +
Text description of VLANs.
+
+
+ filter_input + +
+ string +
+
+ +
The name of input filter.
+
+
+ filter_output + +
+ string +
+
+ +
The name of output filter.
+
+
+ interfaces + +
+ list + / elements=string +
+
+ +
List of interfaces to check the VLAN has been configured correctly.
+
+
+ l3_interface + +
+ string +
+
+ +
Name of logical layer 3 interface.
+
+
+ name + +
+ string + / required +
+
+ +
Name of the VLAN.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
State of the VLAN configuration.
+
+
+ vlan_id + +
+ integer + / required +
+
+ +
ID of the VLAN. Range 1-4094.
+
+
+ description + +
+ string +
+
+ +
Text description of VLANs.
+
+
+ filter_input + +
+ string +
+
+ +
The name of input filter.
+
+
+ filter_output + +
+ string +
+
+ +
The name of output filter.
+
+
+ interfaces + +
+ list + / elements=string +
+
+ +
List of interfaces to check the VLAN has been configured correctly.
+
+
+ l3_interface + +
+ string +
+
+ +
Name of logical layer 3 interface.
+
+
+ name + +
+ string +
+
+ +
Name of the VLAN.
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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 VLAN configuration.
+
+
+ vlan_id + +
+ integer +
+
+ +
ID of the VLAN. Range 1-4094.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure VLAN ID and name + junipernetworks.junos.junos_vlan: + name: test + vlan_id: 20 + + - name: Link to logical layer 3 interface + junipernetworks.junos.junos_vlan: + name: test + vlan_id: 20 + l3-interface: vlan.20 + + - name: remove VLAN configuration + junipernetworks.junos.junos_vlan: + name: test + state: absent + + - name: deactive VLAN configuration + junipernetworks.junos.junos_vlan: + name: test + state: present + active: false + + - name: activate VLAN configuration + junipernetworks.junos.junos_vlan: + name: test + state: present + active: true + + - name: Create vlan configuration using aggregate + junipernetworks.junos.junos_vlan: + aggregate: + - {vlan_id: 159, name: test_vlan_1, description: test vlan-1} + - {vlan_id: 160, name: test_vlan_2, description: test vlan-2} + + - name: Delete vlan configuration using aggregate + junipernetworks.junos.junos_vlan: + aggregate: + - {vlan_id: 159, name: test_vlan_1} + - {vlan_id: 160, name: test_vlan_2} + state: absent + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit vlans] + test-vlan-1 { + vlan-id 60; + }
+
+

+ + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlans_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlans_module.rst new file mode 100644 index 00000000..34746cbc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vlans_module.rst @@ -0,0 +1,288 @@ +.. _junipernetworks.junos.junos_vlans_module: + + +********************************* +junipernetworks.junos.junos_vlans +********************************* + +**VLANs resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module creates and manages VLAN configurations on Junos OS. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.6.4) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ config + +
+ list + / elements=dictionary +
+
+ +
A dictionary of Vlan options
+
+
+ description + +
+ string +
+
+ +
Text description of VLANs
+
+
+ name + +
+ string + / required +
+
+ +
Name of VLAN.
+
+
+ vlan_id + +
+ integer +
+
+ +
IEEE 802.1q VLAN identifier for VLAN (1..4094).
+
+
+ running_config + +
+ string +
+
+ +
This option is used only with state parsed.
+
The value of this option should be the output received from the Junos device by executing the command show vlans.
+
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 of the configuration after module completion.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed + - Tested against Junos OS 18.4R1 + - This module works with connection ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + ############# + + # Before State + # ------------ + # + # admin# show vlans + # vlan-2 { + # vlan-id 2; + # } + # vlan-3 { + # vlan-id 3; + # } + + - name: Merge JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-1 + vlan-id: 1 + state: merged + - name: Replace JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-1 + vlan-id: 10 + - name: vlan-3 + vlan-id: 30 + state: replaced + - name: Override JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-4 + vlan-id: 100 + - name: vlan-2 + vlan-id: 200 + state: overridden + - name: Delete JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-1 + state: deleted + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + +
KeyReturnedDescription
+
+ after + +
+ string +
+
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 + +
+ string +
+
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:
+
['xml 1', 'xml 2', 'xml 3']
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Daniel Mellado (@dmellado) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vrf_module.rst b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vrf_module.rst new file mode 100644 index 00000000..2ee96ec7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/docs/junipernetworks.junos.junos_vrf_module.rst @@ -0,0 +1,601 @@ +.. _junipernetworks.junos.junos_vrf_module: + + +******************************* +junipernetworks.junos.junos_vrf +******************************* + +**Manage the VRF definitions on Juniper JUNOS devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module provides declarative management of VRF definitions on Juniper JUNOS devices. It allows playbooks to manage individual or the entire VRF collection. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- ncclient (>=v0.5.2) + + +Parameters +---------- + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterChoices/DefaultsComments
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ aggregate + +
+ list + / elements=dictionary +
+
+ +
The set of VRF definition objects to be configured on the remote JUNOS device. Ths list entries can either be the VRF name or a hash of VRF definitions and attributes. This argument is mutually exclusive with the name argument.
+
+
+ active + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Specifies whether or not the configuration is active or deactivated
+
+
+ description + +
+ string +
+
+ +
Provides a short description of the VRF definition in the current active configuration. The VRF definition value accepts alphanumeric characters used to provide additional information about the VRF.
+
+
+ interfaces + +
+ list + / elements=string +
+
+ +
Identifies the set of interfaces that should be configured in the VRF. Interfaces must be routed interfaces in order to be placed into a VRF.
+
+
+ name + +
+ string + / required +
+
+ +
The name of the VRF definition to be managed on the remote IOS device. The VRF definition name is an ASCII string name used to uniquely identify the VRF. This argument is mutually exclusive with the aggregate argument
+
+
+ rd + +
+ list + / elements=string +
+
+ +
The router-distinguisher value uniquely identifies the VRF to routing processes on the remote IOS system. The RD value takes the form of A:B where A and B are both numeric values.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present
  • +
  • absent
  • +
+
+
Configures the state of the VRF definition as it relates to the device operational configuration. When set to present, the VRF should be configured in the device active configuration and when set to absent the VRF should not be in the device active configuration
+
+
+ table_label + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes
  • +
+
+
Causes JUNOS to allocate a VPN label per VRF rather than per VPN FEC. This allows for forwarding of traffic to directly connected subnets, COS Egress filtering etc.
+
+
+ target + +
+ list + / elements=string +
+
+ +
It configures VRF target community configuration. The target value takes the form of target:A:B where A and B are both numeric values.
+
+
+ description + +
+ string +
+
+ +
Provides a short description of the VRF definition in the current active configuration. The VRF definition value accepts alphanumeric characters used to provide additional information about the VRF.
+
+
+ interfaces + +
+ list + / elements=string +
+
+ +
Identifies the set of interfaces that should be configured in the VRF. Interfaces must be routed interfaces in order to be placed into a VRF.
+
+
+ name + +
+ string +
+
+ +
The name of the VRF definition to be managed on the remote IOS device. The VRF definition name is an ASCII string name used to uniquely identify the VRF. This argument is mutually exclusive with the aggregate argument
+
+
+ provider + +
+ dictionary +
+
+ +
Deprecated
+
Starting with Ansible 2.5 we recommend using connection: network_cli or connection: netconf.
+
For more information please see the Junos OS Platform Options 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. The port value will default to the well known SSH port of 22 (for transport=cli) or port 830 (for transport=netconf) 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 ←
  • +
+
+
Configures the transport connection to use when connecting to the remote device.
+
+
+ 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.
+
+
+ rd + +
+ list + / elements=string +
+
+ +
The router-distinguisher value uniquely identifies the VRF to routing processes on the remote IOS system. The RD value takes the form of A:B where A and B are both numeric values.
+
+
+ state + +
+ string +
+
+
    Choices: +
  • present ←
  • +
  • absent
  • +
+
+
Configures the state of the VRF definition as it relates to the device operational configuration. When set to present, the VRF should be configured in the device active configuration and when set to absent the VRF should not be in the device active configuration
+
+
+ table_label + +
+ boolean +
+
+
    Choices: +
  • no
  • +
  • yes ←
  • +
+
+
Causes JUNOS to allocate a VPN label per VRF rather than per VPN FEC. This allows for forwarding of traffic to directly connected subnets, COS Egress filtering etc.
+
+
+ target + +
+ list + / elements=string +
+
+ +
It configures VRF target community configuration. The target value takes the form of target:A:B where A and B are both numeric values.
+
+
+ + +Notes +----- + +.. note:: + - This module requires the netconf system service be enabled on the remote device being managed. + - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. + - Recommended connection is ``netconf``. See `the Junos OS Platform Options <../network/user_guide/platform_junos.html>`_. + - This module also works with ``local`` connections for legacy playbooks. + - For information on using CLI and netconf see the :ref:`Junos OS Platform Options guide ` + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide ` + - For more information on using Ansible to manage Juniper network devices see https://www.ansible.com/ansible-juniper. + + + +Examples +-------- + +.. code-block:: yaml + + - name: Configure vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: present + + - name: Remove vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: absent + + - name: Deactivate vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + active: false + + - name: Activate vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + active: true + + - name: Create vrf using aggregate + junipernetworks.junos.junos_vrf: + aggregate: + - name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + - name: test-2 + description: test-vrf-2 + interfaces: + - ge-0/0/4 + - ge-0/0/5 + rd: 192.0.2.2:10 + target: target:65515:114 + state: present + + + +Return Values +------------- +Common return values are documented `here `_, the following are the fields unique to this module: + +.. raw:: html + + + + + + + + + + + + +
KeyReturnedDescription
+
+ diff.prepared + +
+ string +
+
when configuration is changed and diff option is enabled. +
Configuration difference before and after applying change.
+
+
Sample:
+
[edit routing-instances] + test-1 { + description test-vrf-1; + instance-type vrf; + interface ge-0/0/2.0; + interface ge-0/0/3.0; + route-distinguisher 192.0.2.1:10; + vrf-target target:65514:113; + }
+
+

+ + +Status +------ + + +Authors +~~~~~~~ + +- Ganesh Nalawade (@ganeshrn) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/meta/runtime.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/meta/runtime.yml new file mode 100644 index 00000000..4de14af8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/meta/runtime.yml @@ -0,0 +1,283 @@ +--- +requires_ansible: '>=2.9.10,<2.11' +plugin_routing: + action: + junos_acl_interfaces: + redirect: junipernetworks.junos.junos + acl_interfaces: + redirect: junipernetworks.junos.junos + junos_acls: + redirect: junipernetworks.junos.junos + acls: + redirect: junipernetworks.junos.junos + junos_banner: + redirect: junipernetworks.junos.junos + banner: + redirect: junipernetworks.junos.junos + junos_command: + redirect: junipernetworks.junos.junos + command: + redirect: junipernetworks.junos.junos + junos_config: + redirect: junipernetworks.junos.junos + config: + redirect: junipernetworks.junos.junos + junos_facts: + redirect: junipernetworks.junos.junos + facts: + redirect: junipernetworks.junos.junos + junos_interface: + redirect: junipernetworks.junos.junos + interface: + redirect: junipernetworks.junos.junos + junos_interfaces: + redirect: junipernetworks.junos.junos + interfaces: + redirect: junipernetworks.junos.junos + junos_l2_interface: + redirect: junipernetworks.junos.junos + l2_interface: + redirect: junipernetworks.junos.junos + junos_l2_interfaces: + redirect: junipernetworks.junos.junos + l2_interfaces: + redirect: junipernetworks.junos.junos + junos_l3_interface: + redirect: junipernetworks.junos.junos + l3_interface: + redirect: junipernetworks.junos.junos + junos_l3_interfaces: + redirect: junipernetworks.junos.junos + l3_interfaces: + redirect: junipernetworks.junos.junos + junos_lacp: + redirect: junipernetworks.junos.junos + lacp: + redirect: junipernetworks.junos.junos + junos_lacp_interfaces: + redirect: junipernetworks.junos.junos + lacp_interfaces: + redirect: junipernetworks.junos.junos + junos_lag_interfaces: + redirect: junipernetworks.junos.junos + lag_interfaces: + redirect: junipernetworks.junos.junos + junos_linkagg: + redirect: junipernetworks.junos.junos + linkagg: + redirect: junipernetworks.junos.junos + junos_lldp: + redirect: junipernetworks.junos.junos + lldp: + redirect: junipernetworks.junos.junos + junos_lldp_global: + redirect: junipernetworks.junos.junos + lldp_global: + redirect: junipernetworks.junos.junos + junos_bgp_global: + redirect: junipernetworks.junos.junos + bgp_global: + redirect: junipernetworks.junos.junos + junos_lldp_interface: + redirect: junipernetworks.junos.junos + lldp_interface: + redirect: junipernetworks.junos.junos + junos_lldp_interfaces: + redirect: junipernetworks.junos.junos + lldp_interfaces: + redirect: junipernetworks.junos.junos + junos_logging: + redirect: junipernetworks.junos.junos + logging: + redirect: junipernetworks.junos.junos + junos_netconf: + redirect: junipernetworks.junos.junos + netconf: + redirect: junipernetworks.junos.junos + junos_ospfv2: + redirect: junipernetworks.junos.junos + ospfv2: + redirect: junipernetworks.junos.junos + junos_ospfv3: + redirect: junipernetworks.junos.junos + ospfv3: + redirect: junipernetworks.junos.junos + junos_ospf_interfaces: + redirect: junipernetworks.junos.junos + ospf_interfaces: + redirect: junipernetworks.junos.junos + junos_package: + redirect: junipernetworks.junos.junos + package: + redirect: junipernetworks.junos.junos + junos_ping: + redirect: junipernetworks.junos.junos + ping: + redirect: junipernetworks.junos.junos + junos_rpc: + redirect: junipernetworks.junos.junos + rpc: + redirect: junipernetworks.junos.junos + junos_scp: + redirect: junipernetworks.junos.junos + scp: + redirect: junipernetworks.junos.junos + junos_static_route: + redirect: junipernetworks.junos.junos + static_route: + redirect: junipernetworks.junos.junos + junos_static_routes: + redirect: junipernetworks.junos.junos + static_routes: + redirect: junipernetworks.junos.junos + junos_system: + redirect: junipernetworks.junos.junos + system: + redirect: junipernetworks.junos.junos + junos_user: + redirect: junipernetworks.junos.junos + user: + redirect: junipernetworks.junos.junos + junos_vlan: + redirect: junipernetworks.junos.junos + vlan: + redirect: junipernetworks.junos.junos + junos_vlans: + redirect: junipernetworks.junos.junos + vlans: + redirect: junipernetworks.junos.junos + junos_vrf: + redirect: junipernetworks.junos.junos + vrf: + redirect: junipernetworks.junos.junos + modules: + acl_interfaces: + redirect: junipernetworks.junos.junos_acl_interfaces + acls: + redirect: junipernetworks.junos.junos_acls + banner: + redirect: junipernetworks.junos.junos_banner + command: + redirect: junipernetworks.junos.junos_command + config: + redirect: junipernetworks.junos.junos_config + facts: + redirect: junipernetworks.junos.junos_facts + interface: + redirect: junipernetworks.junos.junos_interface + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_interface: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + interfaces: + redirect: junipernetworks.junos.junos_interfaces + l2_interface: + redirect: junipernetworks.junos.junos_l2_interface + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_l2_interface: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + l2_interfaces: + redirect: junipernetworks.junos.junos_l2_interfaces + l3_interface: + redirect: junipernetworks.junos.junos_l3_interface + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_l3_interface: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + l3_interfaces: + redirect: junipernetworks.junos.junos_l3_interfaces + lacp: + redirect: junipernetworks.junos.junos_lacp + lacp_interfaces: + redirect: junipernetworks.junos.junos_lacp_interfaces + lag_interfaces: + redirect: junipernetworks.junos.junos_lag_interfaces + linkagg: + redirect: junipernetworks.junos.junos_linkagg + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_linkagg: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + lldp: + redirect: junipernetworks.junos.junos_lldp + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_lldp: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + lldp_global: + redirect: junipernetworks.junos.junos_lldp_global + bgp_global: + redirect: junipernetworks.junos.junos_bgp_global + lldp_interface: + redirect: junipernetworks.junos.junos_lldp_interface + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_lldp_interface: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + lldp_interfaces: + redirect: junipernetworks.junos.junos_lldp_interfaces + logging: + redirect: junipernetworks.junos.junos_logging + netconf: + redirect: junipernetworks.junos.junos_netconf + ospfv2: + redirect: junipernetworks.junos.junos_ospfv2 + ospfv3: + redirect: junipernetworks.junos.junos_ospfv3 + ospf_interfaces: + redirect: junipernetworks.junos.junos_ospf_interfaces + package: + redirect: junipernetworks.junos.junos_package + ping: + redirect: junipernetworks.junos.junos_ping + rpc: + redirect: junipernetworks.junos.junos_rpc + scp: + redirect: junipernetworks.junos.junos_scp + static_route: + redirect: junipernetworks.junos.junos_static_route + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_static_route: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + static_routes: + redirect: junipernetworks.junos.junos_static_routes + system: + redirect: junipernetworks.junos.junos_system + user: + redirect: junipernetworks.junos.junos_user + vlan: + redirect: junipernetworks.junos.junos_vlan + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + junos_vlan: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + vlans: + redirect: junipernetworks.junos.junos_vlans + vrf: + redirect: junipernetworks.junos.junos_vrf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/junos.py new file mode 100644 index 00000000..5b8d8054 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/action/junos.py @@ -0,0 +1,177 @@ +# +# (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.ansible.netcommon.plugins.module_utils.network.common.utils import ( + load_provider, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_provider_spec, +) +from ansible_collections.ansible.netcommon.plugins.action.network import ( + ActionModule as ActionNetworkModule, +) +from ansible.utils.display import Display + +display = Display() + +CLI_SUPPORTED_MODULES = ["junos_netconf", "junos_ping", "junos_command"] + + +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 ["junos_config", "config"] else False + ) + persistent_connection = self._play_context.connection.split(".")[-1] + warnings = [] + + if self._play_context.connection == "local": + provider = load_provider(junos_provider_spec, self._task.args) + pc = copy.deepcopy(self._play_context) + pc.network_os = "junipernetworks.junos.junos" + pc.remote_addr = provider["host"] or self._play_context.remote_addr + + if ( + provider["transport"] == "cli" + and module_name not in CLI_SUPPORTED_MODULES + ): + return { + "failed": True, + "msg": "Transport type '%s' is not valid for '%s' module. " + "Please see https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html" + % (provider["transport"], module_name), + } + + if module_name == "junos_netconf" or ( + provider["transport"] == "cli" + and module_name == "junos_command" + ): + pc.connection = "ansible.netcommon.network_cli" + pc.port = int( + provider["port"] or self._play_context.port or 22 + ) + else: + pc.connection = "ansible.netcommon.netconf" + pc.port = int( + provider["port"] or self._play_context.port or 830 + ) + + pc.remote_user = ( + provider["username"] or self._play_context.connection_user + ) + pc.password = provider["password"] or self._play_context.password + pc.private_key_file = ( + provider["ssh_keyfile"] or self._play_context.private_key_file + ) + + 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 = "junos" + 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"): + provider = self._task.args.get("provider", {}) + if any(provider.values()): + # for legacy reasons provider value is required for junos_facts(optional) and junos_package + # modules as it uses junos_eznc library to connect to remote host + if not ( + module_name == "junos_facts" + or module_name == "junos_package" + or module_name == "junos_scp" + ): + display.warning( + "provider is unnecessary when using %s and will be ignored" + % self._play_context.connection + ) + del self._task.args["provider"] + + if ( + persistent_connection == "network_cli" + and module_name not in CLI_SUPPORTED_MODULES + ) or ( + persistent_connection == "netconf" + and module_name in CLI_SUPPORTED_MODULES[0:2] + ): + return { + "failed": True, + "msg": "Connection type '%s' is not valid for '%s' module. " + "Please see https://docs.ansible.com/ansible/latest/network/user_guide/platform_junos.html" + % (self._play_context.connection, module_name), + } + + 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/junipernetworks/junos/plugins/cliconf/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/cliconf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/cliconf/junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/cliconf/junos.py new file mode 100644 index 00000000..acb3ed29 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/cliconf/junos.py @@ -0,0 +1,323 @@ +# +# (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: junos +short_description: Use junos cliconf to run command on Juniper Junos OS platform +description: +- This junos plugin provides low level abstraction apis for sending and receiving + CLI commands from Juniper Junos OS network devices. +version_added: 1.0.0 +""" + +import json +import re + +from itertools import chain +from functools import wraps + +from ansible.errors import AnsibleConnectionFailure +from ansible.module_utils._text import to_text +from ansible.module_utils.common._collections_compat import Mapping +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible.plugins.cliconf import CliconfBase + + +def configure(func): + @wraps(func) + def wrapped(self, *args, **kwargs): + prompt = self._connection.get_prompt() + if ( + not to_text(prompt, errors="surrogate_or_strict") + .strip() + .endswith("#") + ): + self.send_command("configure") + return func(self, *args, **kwargs) + + return wrapped + + +class Cliconf(CliconfBase): + def get_text(self, ele, tag): + try: + return to_text( + ele.find(tag).text, errors="surrogate_then_replace" + ).strip() + except AttributeError: + pass + + def get_device_info(self): + device_info = dict() + device_info["network_os"] = "junos" + + reply = self.get(command="show version") + data = to_text(reply, errors="surrogate_or_strict").strip() + + match = re.search(r"Junos: (\S+)", data) + if match: + device_info["network_os_version"] = match.group(1) + + match = re.search(r"Model: (\S+)", data, re.M) + if match: + device_info["network_os_model"] = match.group(1) + + match = re.search(r"Hostname: (\S+)", data, re.M) + if match: + device_info["network_os_hostname"] = match.group(1) + return device_info + + def get_config(self, source="running", format="text", flags=None): + if source != "running": + raise ValueError( + "fetching configuration from %s is not supported" % source + ) + + options_values = self.get_option_values() + if format not in options_values["format"]: + raise ValueError( + "'format' value %s is invalid. Valid values are %s" + % (format, ",".join(options_values["format"])) + ) + + if format == "text": + cmd = "show configuration" + else: + cmd = "show configuration | display %s" % format + + cmd += " ".join(to_list(flags)) + cmd = cmd.strip() + return self.send_command(cmd) + + @configure + def edit_config( + self, candidate=None, commit=True, replace=None, comment=None + ): + + operations = self.get_device_operations() + self.check_edit_config_capability( + operations, candidate, commit, replace, comment + ) + + resp = {} + results = [] + requests = [] + + if replace: + candidate = "load override {0}".format(replace) + + for line in to_list(candidate): + if not isinstance(line, Mapping): + line = {"command": line} + cmd = line["command"] + try: + results.append(self.send_command(**line)) + except AnsibleConnectionFailure as exc: + if "error: commit failed" in exc.message: + self.discard_changes() + raise + requests.append(cmd) + + diff = self.compare_configuration() + if diff: + resp["diff"] = diff + + if commit: + self.commit(comment=comment) + else: + self.discard_changes() + + else: + self.send_command("top") + self.discard_changes() + + resp["request"] = requests + resp["response"] = results + return resp + + def get( + self, + command, + prompt=None, + answer=None, + sendonly=False, + output=None, + newline=True, + check_all=False, + ): + if output: + command = self._get_command_with_output(command, output) + return self.send_command( + command=command, + prompt=prompt, + answer=answer, + sendonly=sendonly, + newline=newline, + check_all=check_all, + ) + + @configure + def commit( + self, comment=None, confirmed=False, at_time=None, synchronize=False + ): + """ + Execute commit command on remote device. + :param comment: Comment to be associated with commit + :param confirmed: Boolean flag to indicate if the previous commit should confirmed + :param at_time: Time at which to activate configuration changes + :param synchronize: Boolean flag to indicate if commit should synchronize on remote peers + :return: Command response received from device + """ + command = "commit" + if comment: + command += " comment {0}".format(comment) + if confirmed: + command += " confirmed" + if at_time: + command += " {0}".format(at_time) + if synchronize: + command += " peers-synchronize" + + command += " and-quit" + + try: + response = self.send_command(command) + except AnsibleConnectionFailure: + self.discard_changes() + raise + + return response + + @configure + def discard_changes(self): + command = "rollback 0" + for cmd in chain(to_list(command), ["exit"]): + self.send_command(cmd) + + @configure + def validate(self): + return self.send_command("commit check") + + @configure + def compare_configuration(self, rollback_id=None): + command = "show | compare" + if rollback_id is not None: + command += " rollback %s" % int(rollback_id) + resp = self.send_command(command) + + r = resp.splitlines() + if ( + len(r) == 1 + and "[edit]" in r[0] + or len(r) == 4 + and r[1].startswith("- version") + ): + resp = "" + + return resp + + @configure + def rollback(self, rollback_id, commit=True): + resp = {} + self.send_command("rollback %s" % int(rollback_id)) + resp["diff"] = self.compare_configuration() + if commit: + self.commit() + else: + self.discard_changes() + return resp + + def get_diff(self, rollback_id=None): + diff = {"config_diff": None} + response = self.compare_configuration(rollback_id=rollback_id) + if response: + diff["config_diff"] = response + return diff + + def get_device_operations(self): + return { + "supports_diff_replace": False, + "supports_commit": True, + "supports_rollback": True, + "supports_defaults": False, + "supports_onbox_diff": True, + "supports_commit_comment": True, + "supports_multiline_delimiter": False, + "supports_diff_match": False, + "supports_diff_ignore_lines": False, + "supports_generate_diff": False, + "supports_replace": True, + } + + def get_option_values(self): + return { + "format": ["text", "set", "xml", "json"], + "diff_match": [], + "diff_replace": [], + "output": ["text", "set", "xml", "json"], + } + + def get_capabilities(self): + result = super(Cliconf, self).get_capabilities() + result["rpc"] += [ + "commit", + "discard_changes", + "run_commands", + "compare_configuration", + "validate", + "get_diff", + ] + 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="#") + + def _get_command_with_output(self, command, output): + options_values = self.get_option_values() + if output not in options_values["output"]: + raise ValueError( + "'output' value %s is invalid. Valid values are %s" + % (output, ",".join(options_values["output"])) + ) + + if output == "json" and not command.endswith("| display json"): + cmd = "%s | display json" % command + elif output == "xml" and not command.endswith("| display xml"): + cmd = "%s | display xml" % command + elif output == "text" and ( + command.endswith("| display json") + or command.endswith("| display xml") + ): + cmd = command.rsplit("|", 1)[0] + else: + cmd = command + return cmd diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/junos.py new file mode 100644 index 00000000..32b871a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/doc_fragments/junos.py @@ -0,0 +1,78 @@ +# -*- 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) or + C(connection: netconf).' + - For more information please see the L(Junos OS Platform Options guide, ../network/user_guide/platform_junos.html). + - 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. The + port value will default to the well known SSH port of 22 (for C(transport=cli)) + or port 830 (for C(transport=netconf)) 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: + - Configures the transport connection to use when connecting to the remote + device. + type: str + default: netconf + choices: + - cli + - netconf +notes: +- For information on using CLI and netconf see the :ref:`Junos OS Platform Options + guide ` +- For more information on using Ansible to manage network devices see the :ref:`Ansible + Network Guide ` +- For more information on using Ansible to manage Juniper network devices see U(https://www.ansible.com/ansible-juniper). +""" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/acl_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/acl_interfaces.py new file mode 100644 index 00000000..8a343816 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acl_interfaces/acl_interfaces.py @@ -0,0 +1,80 @@ +# +# -*- 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 junos_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 junos_acl_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "access_groups": { + "elements": "dict", + "options": { + "acls": { + "elements": "dict", + "options": { + "direction": { + "choices": ["in", "out"], + "type": "str", + }, + "name": {"type": "str"}, + }, + "type": "list", + }, + "afi": {"choices": ["ipv4", "ipv6"], "type": "str"}, + }, + "type": "list", + }, + "name": {"type": "str"}, + }, + "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/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/acls.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/acls.py new file mode 100644 index 00000000..2d455aca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/acls/acls.py @@ -0,0 +1,208 @@ +# +# _*_ 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 junos_acls module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class AclsArgs(object): # pylint: disable=R0903 + """The arg spec for the junos_acls module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "type": "list", + "options": { + "afi": { + "required": True, + "choices": ["ipv4", "ipv6"], + "type": "str", + }, + "acls": { + "elements": "dict", + "type": "list", + "options": { + "name": {"required": True, "type": "str"}, + "aces": { + "elements": "dict", + "type": "list", + "options": { + "name": {"required": True, "type": "str"}, + "source": { + "type": "dict", + "options": { + "address": {"type": "str"}, + "prefix_list": { + "elements": "dict", + "type": "list", + "options": { + "name": {"type": "str"} + }, + }, + "port_protocol": { + "type": "dict", + "options": { + "eq": {"type": "str"}, + "range": { + "type": "dict", + "options": { + "start": { + "type": "int" + }, + "end": {"type": "int"}, + }, + }, + }, + }, + }, + }, + "destination": { + "type": "dict", + "options": { + "address": {"type": "str"}, + "prefix_list": { + "elements": "dict", + "type": "list", + "options": { + "name": {"type": "str"} + }, + }, + "port_protocol": { + "type": "dict", + "options": { + "eq": {"type": "str"}, + "range": { + "type": "dict", + "options": { + "start": { + "type": "int" + }, + "end": {"type": "int"}, + }, + }, + }, + }, + }, + }, + "protocol": {"type": "str"}, + "protocol_options": { + "type": "dict", + "options": { + "icmp": { + "type": "dict", + "options": { + "dod_host_prohibited": { + "type": "bool" + }, + "dod_net_prohibited": { + "type": "bool" + }, + "echo": {"type": "bool"}, + "echo_reply": {"type": "bool"}, + "host_tos_unreachable": { + "type": "bool" + }, + "host_redirect": { + "type": "bool" + }, + "host_tos_redirect": { + "type": "bool" + }, + "host_unknown": { + "type": "bool" + }, + "host_unreachable": { + "type": "bool" + }, + "net_redirect": { + "type": "bool" + }, + "net_tos_redirect": { + "type": "bool" + }, + "network_unknown": { + "type": "bool" + }, + "port_unreachable": { + "type": "bool" + }, + "protocol_unreachable": { + "type": "bool" + }, + "reassembly_timeout": { + "type": "bool" + }, + "redirect": {"type": "bool"}, + "router_advertisement": { + "type": "bool" + }, + "router_solicitation": { + "type": "bool" + }, + "source_route_failed": { + "type": "bool" + }, + "time_exceeded": { + "type": "bool" + }, + "ttl_exceeded": { + "type": "bool" + }, + }, + } + }, + }, + "grant": { + "type": "str", + "choices": ["permit", "deny"], + }, + }, + }, + }, + }, + }, + }, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + ], + "default": "merged", + "type": "str", + }, + } + + +# pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/bgp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/bgp_global.py new file mode 100644 index 00000000..282f3f02 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/bgp_global/bgp_global.py @@ -0,0 +1,685 @@ +# +# -*- 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 junos_bgp_global module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Bgp_globalArgs(object): # pylint: disable=R0903 + """The arg spec for the junos_bgp_global module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "options": { + "accept_remote_nexthop": {"type": "bool"}, + "add_path_display_ipv4_address": {"type": "bool"}, + "advertise_bgp_static": { + "options": { + "policy": {"type": "str"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "advertise_external": { + "options": { + "conditional": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "advertise_from_main_vpn_tables": {"type": "bool"}, + "advertise_inactive": {"type": "bool"}, + "advertise_peer_as": {"type": "bool"}, + "as_number": {"type": "str"}, + "authentication_algorithm": { + "choices": ["aes-128-cmac-96", "hmac-sha-1-96", "md5"], + "type": "str", + }, + "authentication_key": {"type": "str"}, + "authentication_key_chain": {"type": "str"}, + "bfd_liveness_detection": { + "options": { + "authentication": { + "options": { + "algorithm": { + "choices": [ + "keyed-md5", + "keyed-sha-1", + "meticulous-keyed-md5", + "meticulous-keyed-sha-1", + "simple-password", + ], + "type": "str", + }, + "key_chain": {"type": "str"}, + "loose_check": {"type": "bool"}, + }, + "type": "dict", + }, + "detection_time": { + "options": {"threshold": {"type": "int"}}, + "type": "dict", + }, + "holddown_interval": {"type": "int"}, + "minimum_interval": {"type": "int"}, + "minimum_receive_interval": {"type": "int"}, + "multiplier": {"type": "int"}, + "no_adaptation": {"type": "bool"}, + "session_mode": { + "choices": ["automatic", "multihop", "single-hop"], + "type": "str", + }, + "transmit_interval": { + "options": { + "minimum_interval": {"type": "int"}, + "threshold": {"type": "int"}, + }, + "type": "dict", + }, + "version": { + "choices": ["0", "1", "automatic"], + "type": "str", + }, + }, + "type": "dict", + }, + "bgp_error_tolerance": { + "options": { + "malformed_route_limit": {"type": "int"}, + "malformed_update_log_interval": {"type": "int"}, + "no_malformed_route_limit": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "bmp": { + "options": { + "monitor": {"type": "bool"}, + "route_monitoring": { + "options": { + "none": {"type": "bool"}, + "post_policy": {"type": "bool"}, + "post_policy_exclude_non_eligible": { + "type": "bool" + }, + "post_policy_exclude_non_feasible": { + "type": "bool" + }, + "pre_policy": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "cluster_id": {"type": "str"}, + "damping": {"type": "bool"}, + "description": {"type": "str"}, + "disable": {"type": "bool"}, + "egress_te": { + "options": {"backup_path": {"type": "str"}}, + "type": "dict", + }, + "egress_te_backup_paths": { + "options": { + "peer_addr": {"type": "str"}, + "remote_nexthop": {"type": "str"}, + "template": { + "options": { + "ip_forward": { + "options": { + "rti_name": {"type": "str"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "path_name": {"type": "str"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "egress_te_set_segment": { + "options": { + "egress_te_backup_segment_label": {"type": "int"}, + "label": {"type": "int"}, + "name": {"type": "str"}, + }, + "type": "dict", + }, + "egress_te_sid_stats": {"type": "bool"}, + "enforce_first_as": {"type": "bool"}, + "export": {"type": "str"}, + "forwarding_context": {"type": "str"}, + "graceful_restart": { + "options": { + "disable": {"type": "bool"}, + "dont_help_shared_fate_bfd_down": {"type": "bool"}, + "forwarding_state_bit": { + "options": { + "as_rr_client": {"type": "bool"}, + "from_fib": {"type": "bool"}, + }, + "type": "dict", + }, + "long_lived": { + "options": { + "advertise_to_non_llgr_neighbor": { + "options": { + "omit_no_export": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "receiver_disable": {"type": "bool"}, + }, + "type": "dict", + }, + "restart_time": {"type": "int"}, + "set": {"type": "bool"}, + "stale_routes_time": {"type": "int"}, + }, + "type": "dict", + }, + "hold_time": {"type": "int"}, + "holddown_all_stale_labels": {"type": "bool"}, + "idle_after_switch_over": { + "options": { + "forever": {"type": "bool"}, + "timeout": {"type": "int"}, + }, + "type": "dict", + }, + "import": {"type": "str"}, + "include_mp_next_hop": {"type": "bool"}, + "ipsec_sa": {"type": "str"}, + "keep": {"choices": ["all", "none"], "type": "str"}, + "local_address": {"type": "str"}, + "local_as": { + "options": { + "alias": {"type": "bool"}, + "as_num": {"type": "str"}, + "loops": {"type": "int"}, + "no_prepend_global_as": {"type": "bool"}, + "private": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "local_interface": {"type": "str"}, + "local_preference": {"type": "str"}, + "log_updown": {"type": "bool"}, + "metric_out": { + "options": { + "igp": { + "options": { + "delay_med_update": {"type": "bool"}, + "metric_offset": {"type": "int"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "metric_value": {"type": "int"}, + "minimum_igp": { + "options": { + "metric_offset": {"type": "int"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "mtu_discovery": {"type": "bool"}, + "multihop": { + "options": { + "no_nexthop_change": {"type": "bool"}, + "set": {"type": "bool"}, + "ttl": {"type": "int"}, + }, + "type": "dict", + }, + "multipath": { + "options": { + "disable": {"type": "bool"}, + "multiple_as": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "multipath_build_priority": { + "choices": ["low", "medium"], + "type": "str", + }, + "no_advertise_peer_as": {"type": "bool"}, + "no_aggregator_id": {"type": "bool"}, + "no_client_reflect": {"type": "bool"}, + "no_precision_timers": {"type": "bool"}, + "out_delay": {"type": "int"}, + "outbound_route_filter": { + "options": { + "bgp_orf_cisco_mode": {"type": "bool"}, + "prefix_based": { + "options": { + "accept": { + "options": { + "inet": {"type": "bool"}, + "inet6": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "output_queue_priority": { + "options": { + "defaults": { + "options": { + "high": { + "options": { + "expedited": {"type": "bool"}, + "priority": {"type": "bool"}, + }, + "type": "dict", + }, + "low": { + "options": { + "expedited": {"type": "bool"}, + "priority": {"type": "bool"}, + }, + "type": "dict", + }, + "medium": { + "options": { + "expedited": {"type": "bool"}, + "priority": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "expedited": { + "options": { + "set": {"type": "bool"}, + "update_tokens": {"type": "int"}, + }, + "type": "dict", + }, + "priority": {"type": "int"}, + }, + "type": "dict", + }, + "passive": {"type": "bool"}, + "path_selection": { + "options": { + "always_compare_med": {"type": "bool"}, + "as_path_ignore": {"type": "bool"}, + "cisco_non_deterministic": {"type": "bool"}, + "external_router_id": {"type": "bool"}, + "l2vpn_use_bgp_rules": {"type": "bool"}, + "med_plus_igp": { + "options": { + "igp_multiplier": {"type": "int"}, + "med_multiplier": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "peer_as": {"type": "str"}, + "precision_timers": {"type": "bool"}, + "preference": {"type": "str"}, + "remove_private": { + "options": { + "all": {"type": "bool"}, + "no_peer_loop_check": {"type": "bool"}, + "replace": { + "options": { + "nearest": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "rfc6514_compliant_safi129": {"type": "bool"}, + "route_server_client": {"type": "bool"}, + "send_addpath_optimization": {"type": "bool"}, + "snmp_options": { + "options": { + "backward_traps_only_from_established": { + "type": "bool" + }, + "emit_inet_address_length_in_oid": {"type": "bool"}, + }, + "type": "dict", + }, + "sr_preference_override": {"type": "str"}, + "stale_labels_holddown_period": {"type": "int"}, + "tcp_aggressive_transmission": {"type": "bool"}, + "tcp_mss": {"type": "int"}, + "traceoptions": { + "options": { + "file": { + "options": { + "file_name": {"type": "str"}, + "files": {"type": "int"}, + "no_world_readable": {"type": "bool"}, + "size": {"type": "int"}, + "world_readable": {"type": "bool"}, + }, + "type": "dict", + }, + "flag": { + "options": { + "byte_as": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "add_path": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "all": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "bfd": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "damping": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "filter": { + "options": { + "match_on_prefix": { + "type": "bool" + }, + "policy": {"type": "str"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "egress_te": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "general": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "graceful_restart": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "keepalive": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "normal": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "nsr_synchronization": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "open": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "packets": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "policy": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "refresh": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "route": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "filter": { + "options": { + "match_on_prefix": { + "type": "bool" + }, + "policy": {"type": "str"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "state": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "thread_io": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "thread_update_io": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "timer": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + "update": { + "options": { + "detail": {"type": "bool"}, + "disable": {"type": "bool"}, + "receive": {"type": "bool"}, + "send": {"type": "bool"}, + "set": {"type": "bool"}, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + }, + "type": "dict", + }, + "traffic_statistics_labeled_path": { + "options": { + "file": { + "options": { + "file_name": {"type": "str"}, + "files": {"type": "int"}, + "no_world_readable": {"type": "bool"}, + "size": {"type": "int"}, + "world_readable": {"type": "bool"}, + }, + "type": "dict", + }, + "interval": {"type": "int"}, + }, + "type": "dict", + }, + "ttl": {"type": "int"}, + "unconfigured_peer_graceful_restart": {"type": "bool"}, + "vpn_apply_export": {"type": "bool"}, + }, + "type": "dict", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "purged", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/facts.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/facts.py new file mode 100644 index 00000000..48da2e75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/facts.py @@ -0,0 +1,29 @@ +# +# -*- 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 junos facts module. +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class FactsArgs(object): + """ The arg spec for the junos facts module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "gather_subset": dict( + default=["!config"], type="list", elements="str" + ), + "config_format": dict( + default="text", choices=["xml", "text", "set", "json"] + ), + "gather_network_resources": dict(type="list", elements="str"), + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/interfaces.py new file mode 100644 index 00000000..8c0c8927 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/interfaces/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) + +############################################# +# 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 junos_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class InterfacesArgs(object): + """The arg spec for the junos_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "description": {"type": "str"}, + "duplex": { + "choices": ["automatic", "full-duplex", "half-duplex"], + "type": "str", + }, + "enabled": {"default": True, "type": "bool"}, + "hold_time": { + "options": { + "down": {"type": "int"}, + "up": {"type": "int"}, + }, + "required_together": [["down", "up"]], + "type": "dict", + }, + "mtu": {"type": "int"}, + "name": {"required": True, "type": "str"}, + "speed": {"type": "str"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/l2_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/l2_interfaces.py new file mode 100644 index 00000000..318b9f34 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l2_interfaces/l2_interfaces.py @@ -0,0 +1,75 @@ +# +# -*- 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 junos_l2_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class L2_interfacesArgs(object): + """The arg spec for the junos_l2_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "access": { + "type": "dict", + "options": {"vlan": {"type": "str"}}, + }, + "name": {"required": True, "type": "str"}, + "trunk": { + "type": "dict", + "options": { + "allowed_vlans": {"elements": "str", "type": "list"}, + "native_vlan": {"type": "str"}, + }, + }, + "unit": {"type": "int"}, + "enhanced_layer": {"type": "bool"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/l3_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/l3_interfaces.py new file mode 100644 index 00000000..f022906e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/l3_interfaces/l3_interfaces.py @@ -0,0 +1,54 @@ +# -*- 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 junos_l3_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class L3_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the junos_l3_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "ipv4": { + "elements": "dict", + "options": {"address": {"type": "str"}}, + "type": "list", + }, + "ipv6": { + "elements": "dict", + "options": {"address": {"type": "str"}}, + "type": "list", + }, + "name": {"required": True, "type": "str"}, + "unit": {"type": "int", "default": 0}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/lacp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/lacp.py new file mode 100644 index 00000000..164766ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp/lacp.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 junos_lacp module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class LacpArgs(object): + """The arg spec for the junos_lacp module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "type": "dict", + "options": { + "link_protection": { + "choices": ["revertive", "non-revertive"], + "type": "str", + }, + "system_priority": {"type": "int"}, + }, + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/lacp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/lacp_interfaces.py new file mode 100644 index 00000000..2c7a4bac --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lacp_interfaces/lacp_interfaces.py @@ -0,0 +1,79 @@ +# +# -*- 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 junos_lacp_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lacp_interfacesArgs(object): + """The arg spec for the junos_lacp_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "force_up": {"type": "bool"}, + "name": {"type": "str"}, + "period": {"choices": ["fast", "slow"]}, + "port_priority": {"type": "int"}, + "sync_reset": { + "choices": ["disable", "enable"], + "type": "str", + }, + "system": { + "options": { + "mac": { + "type": "dict", + "options": {"address": {"type": "str"}}, + }, + "priority": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/lag_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/lag_interfaces.py new file mode 100644 index 00000000..74c336cc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lag_interfaces/lag_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 junos_lag_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lag_interfacesArgs(object): + """The arg spec for the junos_lag_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "members": { + "elements": "dict", + "options": { + "link_type": {"choices": ["primary", "backup"]}, + "member": {"type": "str"}, + }, + "type": "list", + }, + "mode": {"choices": ["active", "passive"]}, + "name": {"required": True, "type": "str"}, + "link_protection": {"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/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/lldp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/lldp_global.py new file mode 100644 index 00000000..66a81613 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_global/lldp_global.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 junos_lldp module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lldp_globalArgs(object): + """The arg spec for the junos_lldp module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "options": { + "address": {"type": "str"}, + "enabled": {"type": "bool"}, + "hold_multiplier": {"type": "int"}, + "interval": {"type": "int"}, + "transmit_delay": {"type": "int"}, + }, + "type": "dict", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/lldp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/lldp_interfaces.py new file mode 100644 index 00000000..afcd4b5f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/lldp_interfaces/lldp_interfaces.py @@ -0,0 +1,63 @@ +# +# -*- 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 junos_lldp_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Lldp_interfacesArgs(object): + """The arg spec for the junos_lldp_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "enabled": {"type": "bool"}, + "name": {"required": True, "type": "str"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "deleted", + "overridden", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/ospf.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/ospf.py new file mode 100644 index 00000000..5b1f4186 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf/ospf.py @@ -0,0 +1,125 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# 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 . + + +""" +The arg spec for the junos_ospfv2 module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class OspfArgs(object): # pylint: disable=R0903 + """The arg spec for the junos_ospfv2 module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "router_id": {"required": True, "type": "str"}, + "areas": { + "elements": "dict", + "options": { + "area_id": {"required": True, "type": "str"}, + "area_range": {"type": "str"}, + "stub": { + "type": "dict", + "options": { + "default_metric": {"type": "int"}, + "set": {"type": "bool"}, + }, + }, + "interfaces": { + "elements": "dict", + "options": { + "authentication": { + "type": "dict", + "options": {"type": {"type": "dict"}}, + }, + "bandwidth_based_metrics": { + "elements": "dict", + "options": { + "bandwidth": { + "choices": ["1g", "10g"], + "type": "str", + }, + "metric": {"type": "int"}, + }, + "type": "list", + }, + "name": {"required": True, "type": "str"}, + "priority": {"type": "int"}, + "metric": {"type": "int"}, + "flood_reduction": {"type": "bool"}, + "passive": {"type": "bool"}, + "timers": { + "type": "dict", + "options": { + "dead_interval": {"type": "int"}, + "hello_interval": {"type": "int"}, + "poll_interval": {"type": "int"}, + "retransmit_interval": {"type": "int"}, + "transit_delay": {"type": "int"}, + }, + }, + }, + "type": "list", + }, + }, + "type": "list", + }, + "external_preference": {"type": "int"}, + "overload": { + "type": "dict", + "options": {"timeout": {"type": "int"}}, + }, + "preference": {"type": "int"}, + "prefix_export_limit": {"type": "int"}, + "reference_bandwidth": { + "choices": ["1g", "10g"], + "type": "str", + }, + "rfc1583compatibility": {"type": "bool"}, + "spf_options": { + "type": "dict", + "options": { + "delay": {"type": "int"}, + "holddown": {"type": "int"}, + "rapid_runs": {"type": "int"}, + }, + }, + }, + "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/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/ospf_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/ospf_interfaces.py new file mode 100644 index 00000000..e24ae6d2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospf_interfaces/ospf_interfaces.py @@ -0,0 +1,134 @@ +# +# -*- 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 junos_ospf_interfaces module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Ospf_interfacesArgs(object): # pylint: disable=R0903 + """The arg spec for the junos_ospf_interfaces module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "router_id": {"required": True, "type": "str"}, + "address_family": { + "elements": "dict", + "options": { + "afi": { + "choices": ["ipv4", "ipv6"], + "required": True, + "type": "str", + }, + "processes": { + "options": { + "area": { + "options": {"area_id": {"type": "str"}}, + "type": "dict", + }, + "authentication": { + "options": { + "md5": { + "options": { + "key_id": {"type": "str"}, + "key_value": {"type": "str"}, + "start_time": {"type": "str"}, + }, + "type": "dict", + }, + "simple_password": {"type": "str"}, + }, + "type": "dict", + }, + "bandwidth_based_metrics": { + "elements": "dict", + "options": { + "bandwidth": { + "choices": ["1g", "10g"], + "type": "str", + }, + "metric": {"type": "int"}, + }, + "type": "list", + }, + "dead_interval": {"type": "int"}, + "demand_circuit": {"type": "bool"}, + "flood_reduction": {"type": "bool"}, + "hello_interval": {"type": "int"}, + "interface_type": { + "choices": ["nbma", "p2mp", "p2p"], + "type": "str", + }, + "ipsec_sa": {"type": "str"}, + "metric": {"type": "int"}, + "mtu": {"type": "int"}, + "no_advertise_adjacency_segment": { + "type": "bool" + }, + "no_eligible_backup": {"type": "bool"}, + "no_eligible_remote_backup": {"type": "bool"}, + "no_interface_state_traps": {"type": "bool"}, + "no_neighbor_down_notification": { + "type": "bool" + }, + "node_link_protection": {"type": "str"}, + "poll_interval": {"type": "int"}, + "priority": {"type": "int"}, + "retransmit_interval": {"type": "int"}, + "secondary": {"type": "bool"}, + "te_metric": {"type": "int"}, + "transit_delay": {"type": "int"}, + }, + "type": "dict", + }, + }, + "type": "list", + }, + "name": {"required": True, "type": "str"}, + }, + "type": "list", + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "parsed", + "rendered", + ], + "default": "merged", + "type": "str", + }, + } # pylint: disable=C0301 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/ospfv3.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/ospfv3.py new file mode 100644 index 00000000..33df13d0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/ospfv3/ospfv3.py @@ -0,0 +1,125 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# 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 . + + +""" +The arg spec for the junos_ospfv3 module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class Ospfv3Args(object): # pylint: disable=R0903 + """The arg spec for the junos_ospfv3 module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "router_id": {"required": True, "type": "str"}, + "areas": { + "elements": "dict", + "options": { + "area_id": {"required": True, "type": "str"}, + "area_range": {"type": "str"}, + "stub": { + "type": "dict", + "options": { + "default_metric": {"type": "int"}, + "set": {"type": "bool"}, + }, + }, + "interfaces": { + "elements": "dict", + "options": { + "authentication": { + "type": "dict", + "options": {"type": {"type": "dict"}}, + }, + "bandwidth_based_metrics": { + "elements": "dict", + "options": { + "bandwidth": { + "choices": ["1g", "10g"], + "type": "str", + }, + "metric": {"type": "int"}, + }, + "type": "list", + }, + "name": {"required": True, "type": "str"}, + "priority": {"type": "int"}, + "metric": {"type": "int"}, + "flood_reduction": {"type": "bool"}, + "passive": {"type": "bool"}, + "timers": { + "type": "dict", + "options": { + "dead_interval": {"type": "int"}, + "hello_interval": {"type": "int"}, + "poll_interval": {"type": "int"}, + "retransmit_interval": {"type": "int"}, + "transit_delay": {"type": "int"}, + }, + }, + }, + "type": "list", + }, + }, + "type": "list", + }, + "external_preference": {"type": "int"}, + "overload": { + "type": "dict", + "options": {"timeout": {"type": "int"}}, + }, + "preference": {"type": "int"}, + "prefix_export_limit": {"type": "int"}, + "reference_bandwidth": { + "choices": ["1g", "10g"], + "type": "str", + }, + "rfc1583compatibility": {"type": "bool"}, + "spf_options": { + "type": "dict", + "options": { + "delay": {"type": "int"}, + "holddown": {"type": "int"}, + "rapid_runs": {"type": "int"}, + }, + }, + }, + "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/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/static_routes.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/static_routes.py new file mode 100644 index 00000000..50aee55e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/static_routes/static_routes.py @@ -0,0 +1,90 @@ +# +# -*- 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 junos_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 junos_static_routes module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "address_families": { + "elements": "dict", + "options": { + "afi": { + "choices": ["ipv4", "ipv6"], + "required": True, + "type": "str", + }, + "routes": { + "elements": "dict", + "options": { + "dest": {"type": "str"}, + "metric": {"type": "int"}, + "next_hop": { + "elements": "dict", + "options": { + "forward_router_address": { + "type": "str" + } + }, + "type": "list", + }, + }, + "type": "list", + }, + }, + "type": "list", + }, + "vrf": {"type": "str"}, + }, + "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/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/vlans.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/vlans.py new file mode 100644 index 00000000..d12b8483 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/vlans/vlans.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 junos_vlans module +""" +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class VlansArgs(object): # pylint: disable=R0903 + """The arg spec for the junos_vlans module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "options": { + "description": {}, + "name": {"required": True, "type": "str"}, + "vlan_id": {"type": "int"}, + }, + "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/junipernetworks/junos/plugins/module_utils/network/junos/config/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/acl_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/acl_interfaces.py new file mode 100644 index 00000000..30bf8b20 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acl_interfaces/acl_interfaces.py @@ -0,0 +1,259 @@ +# +# -*- 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 junos_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.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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) + +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Acl_interfaces(ConfigBase): + """ + The junos_acl_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["acl_interfaces"] + + def __init__(self, module): + super(Acl_interfaces, self).__init__(module) + + def get_acl_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 + ) + acl_interfaces_facts = facts["ansible_network_resources"].get( + "junos_acl_interfaces" + ) + if not acl_interfaces_facts: + return [] + return acl_interfaces_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_acl_interfaces_facts = self.get_acl_interfaces_facts() + else: + existing_acl_interfaces_facts = [] + if state == "gathered": + existing_acl_interfaces_facts = self.get_acl_interfaces_facts() + result["gathered"] = existing_acl_interfaces_facts + 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_acl_interfaces_facts( + data=running_config + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_acl_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_acl_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_acl_interfaces_facts = self.get_acl_interfaces_facts() + + result["before"] = existing_acl_interfaces_facts + if result["changed"]: + result["after"] = changed_acl_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_acl_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_acl_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 + """ + root = build_root_xml_node("interfaces") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _get_common_xml_node(self, name): + root_node = build_root_xml_node("interface") + build_child_xml_node(root_node, "name", name) + intf_unit_node = build_child_xml_node(root_node, "unit") + return root_node, intf_unit_node + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acl_intf_xml = [] + acl_intf_xml.extend(self._state_deleted(want, have)) + acl_intf_xml.extend(self._state_merged(want, have)) + return acl_intf_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acl_intf_xml = [] + acl_intf_xml.extend(self._state_deleted(have, have)) + acl_intf_xml.extend(self._state_merged(want, have)) + return acl_intf_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acl_intf_xml = [] + delete = {"delete": "delete"} + + if not want: + want = have + + acl_intf_xml = self._state_merged(want, have, delete=delete) + return acl_intf_xml + + def _state_merged(self, want, have, delete=None): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + + acl_intf_xml = [] + + for config in want: + root_node, unit_node = self._get_common_xml_node(config["name"]) + build_child_xml_node(unit_node, "name", "0") + family_node = build_child_xml_node(unit_node, "family") + for acl_filter in config["access_groups"]: + inet_family = "inet" + if acl_filter["afi"] == "ipv6": + inet_family = "inet6" + inet_node = build_child_xml_node(family_node, inet_family) + if acl_filter.get("acls"): + filter_node = build_child_xml_node(inet_node, "filter") + for acl in acl_filter["acls"]: + acl_node = None + if acl["direction"] == "in": + acl_node = build_child_xml_node( + filter_node, "input-list", acl["name"] + ) + else: + acl_node = build_child_xml_node( + filter_node, "output-list", acl["name"] + ) + if delete: + acl_node.attrib.update(delete) + elif delete: + build_child_xml_node(inet_node, "filter", None, delete) + acl_intf_xml.append(root_node) + return acl_intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/acls.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/acls.py new file mode 100644 index 00000000..7fc8a7aa --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/acls/acls.py @@ -0,0 +1,401 @@ +# +# -*- 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 junos_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.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Acls(ConfigBase): + """ + The junos_acls class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["acls"] + + def __init__(self, module): + super(Acls, self).__init__(module) + + def get_acls_facts(self): + """ 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 + ) + acls_facts = facts["ansible_network_resources"].get("junos_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} + state = self._module.params["state"] + warnings = list() + + existing_acls_facts = self.get_acls_facts() + config_xmls = self.set_config(existing_acls_facts) + + if state == "gathered": + result["gathered"] = existing_acls_facts + + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["xml"] = config_xmls + changed_acls_facts = self.get_acls_facts() + + result["before"] = existing_acls_facts + if result["changed"]: + result["after"] = 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 + """ + root = build_root_xml_node("firewall") + state = self._module.params["state"] + config_xmls = [] + if state == "overridden": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state == "merged": + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acls_xml = [] + acls_xml.extend(self._state_deleted(want, have)) + acls_xml.extend(self._state_merged(want, have)) + return acls_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acls_xml = [] + acls_xml.extend(self._state_deleted(have, have)) + acls_xml.extend(self._state_merged(want, have)) + return acls_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acls_xml = [] + family_node = build_root_xml_node("family") + delete = dict(delete="delete") + + if not want: + want = have + + for config in want: + try: + family = "inet6" if config.get("afi") == "ipv6" else "inet" + except KeyError: + family = "inet" + inet_node = build_child_xml_node(family_node, family) + + # Look deeply into have to match replace correctly + existing_acls = [] + for conf in have: + if conf.get("afi") == config.get("afi"): + existing_acls.extend(conf["acls"] or []) + acl_names = [acl["name"] for acl in existing_acls] + + if not config["acls"]: + inet_node.attrib.update(delete) + continue + + for acl in config["acls"]: + if acl["name"] not in acl_names: + continue + + filter_node = build_child_xml_node(inet_node, "filter") + build_child_xml_node(filter_node, "name", acl["name"]) + if not acl.get("aces"): + filter_node.attrib.update(delete) + continue + + for ace in acl["aces"]: + # if ace["name"] not in ace_names: + term_node = build_child_xml_node(filter_node, "term") + build_child_xml_node(term_node, "name", ace["name"]) + term_node.attrib.update(delete) + + acls_xml.append(family_node) + return acls_xml + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + acls_xml = [] + family_node = build_root_xml_node("family") + for config in want: + try: + family = "inet6" if config.pop("afi") == "ipv6" else "inet" + except KeyError: + family = "inet" + inet_node = build_child_xml_node(family_node, family) + + for acl in config.get("acls") or []: + filter_node = build_child_xml_node(inet_node, "filter") + build_child_xml_node(filter_node, "name", acl["name"]) + for ace in acl.get("aces") or []: + term_node = build_child_xml_node(filter_node, "term") + build_child_xml_node(term_node, "name", ace["name"]) + + if ( + ace.get("source") + or ace.get("destination") + or ace.get("protocol") + ): + from_node = build_child_xml_node(term_node, "from") + for direction in ("source", "destination"): + if ace.get(direction): + if ace[direction].get("address"): + build_child_xml_node( + from_node, + "{0}-address".format(direction), + ace[direction]["address"], + ) + if ace[direction].get("prefix_list"): + for prefix in ace[direction].get( + "prefix_list" + ): + build_child_xml_node( + from_node, + "{0}-prefix-list".format( + direction + ), + prefix["name"], + ) + if ace[direction].get("port_protocol"): + if "eq" in ace[direction]["port_protocol"]: + build_child_xml_node( + from_node, + "{0}-port".format(direction), + ace[direction]["port_protocol"][ + "eq" + ], + ) + elif ( + "range" + in ace[direction]["port_protocol"] + ): + ports = "{0}-{1}".format( + ace[direction]["port_protocol"][ + "start" + ], + ace[direction]["port_protocol"][ + "end" + ], + ) + build_child_xml_node( + from_node, + "{0}-port".format(direction), + ports, + ) + if ace.get("protocol"): + build_child_xml_node( + from_node, "protocol", ace["protocol"] + ) + if ace.get("protocol_options"): + if ace["protocol_options"].get("icmp"): + icmp_code = build_child_xml_node( + from_node, "icmp-code" + ) + icmp_type = build_child_xml_node( + from_node, "icmp-type" + ) + icmp = ace["protocol_options"]["icmp"] + if "dod_host_prohibited" in icmp: + build_child_xml_node( + icmp_code, + "destination-host-prohibited", + ) + if "dod_net_prohibited" in icmp: + build_child_xml_node( + icmp_code, + "destination-network-prohibited", + ) + if "echo" in icmp: + build_child_xml_node( + icmp_type, "echo-request" + ) + if "echo_reply" in icmp: + build_child_xml_node( + icmp_type, "echo-reply" + ) + if "host_tos_unreachable" in icmp: + build_child_xml_node( + icmp_code, "host-unreachable-for-tos" + ) + if "host_redirect" in icmp: + build_child_xml_node( + icmp_code, "redirect-for-host" + ) + if "host_tos_redirect" in icmp: + build_child_xml_node( + icmp_code, "redirect-for-host-and-tos" + ) + if "host_unknown" in icmp: + build_child_xml_node( + icmp_code, "destination-host-unknown" + ) + if "host_unreachable" in icmp: + build_child_xml_node( + icmp_code, "host-unreachable" + ) + if "net_redirect" in icmp: + build_child_xml_node( + icmp_code, "redirect-for-network" + ) + if "net_tos_redirect" in icmp: + build_child_xml_node( + icmp_code, "redirect-for-tos-and-net" + ) + if "network_unknown" in icmp: + build_child_xml_node( + icmp_code, + "destination-network-unknown", + ) + if "port_unreachable" in icmp: + build_child_xml_node( + icmp_code, "port-unreachable" + ) + if "protocol_unreachable" in icmp: + build_child_xml_node( + icmp_code, "protocol-unreachable" + ) + if "reassembly_timeout" in icmp: + build_child_xml_node( + icmp_code, + "ttl-eq-zero-during-reassembly", + ) + if "redirect" in icmp: + build_child_xml_node(icmp_type, "redirect") + if "router_advertisement" in icmp: + build_child_xml_node( + icmp_type, "router-advertisement" + ) + if "router_solicitation" in icmp: + build_child_xml_node( + icmp_type, "router-solicit" + ) + if "source_route_failed" in icmp: + build_child_xml_node( + icmp_code, "source-route-failed" + ) + if "time_exceeded" in icmp: + build_child_xml_node( + icmp_type, "time-exceeded" + ) + if "ttl_exceeded" in icmp: + build_child_xml_node( + icmp_code, "ttl-eq-zero-during-transit" + ) + if ace.get("grant"): + then_node = build_child_xml_node(term_node, "then") + if ace["grant"] == "permit": + build_child_xml_node(then_node, "accept") + if ace["grant"] == "deny": + build_child_xml_node(then_node, "discard") + + acls_xml.append(family_node) + return acls_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/bgp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/bgp_global.py new file mode 100644 index 00000000..f8f6bb10 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/bgp_global/bgp_global.py @@ -0,0 +1,553 @@ +# +# -*- 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 junos_bgp_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.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Bgp_global(ConfigBase): + """ + The junos_bgp_global class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["bgp_global"] + + def __init__(self, module): + super(Bgp_global, self).__init__(module) + + def get_bgp_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 + ) + bgp_facts = facts["ansible_network_resources"].get("bgp_global") + if not bgp_facts: + return {} + return bgp_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + state = self._module.params["state"] + + warnings = list() + + if self.state in self.ACTION_STATES: + existing_bgp_global_facts = self.get_bgp_global_facts() + else: + existing_bgp_global_facts = {} + if state == "gathered": + existing_bgp_global_facts = self.get_bgp_global_facts() + result["gathered"] = existing_bgp_global_facts + 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_bgp_global_facts(data=running_config) + elif self.state == "rendered": + config_xmls = self.set_config(existing_bgp_global_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_bgp_global_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_bgp_global_facts = self.get_bgp_global_facts() + + result["before"] = existing_bgp_global_facts + if result["changed"]: + result["after"] = changed_bgp_global_facts + + result["warnings"] = warnings + + return result + + def set_config(self, existing_bgp_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"] + have = existing_bgp_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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + self.root = build_root_xml_node("protocols") + 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": + config_xmls = self._state_deleted(want, have) + elif state == "purged": + config_xmls = self._state_purged(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + self.root.append(xml) + return tostring(self.root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is merged + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + bgp_xml = [] + bgp_xml.extend(self._state_deleted(want, have)) + bgp_xml.extend(self._state_merged(want, have)) + + return bgp_xml + + def _state_merged(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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + bgp_xml = [] + + bgp_root = build_root_xml_node("bgp") + + want = remove_empties(want) + bool_parser = [ + "accept-remote-nexthop", + "add-path-display-ipv4-address", + "advertise-from-main-vpn-tables", + "advertise-inactive", + "advertise-peer-as", + "damping", + "disable", + "egress-te-sid-stats", + "enforce-first-as", + "holddown-all-stale-labels", + "include-mp-next-hop", + "log-updown", + "mtu-discovery", + "no-advertise-peer-as", + "no-aggregator-id", + "no-client-reflect", + "no-precision-timers", + "passive", + "precision-timers", + "rfc6514-compliant-safi129", + "route-server-client", + "send-addpath-optimization", + "itcp-aggressive-transmission", + "unconfigured-peer-graceful-restart", + "vpn-apply-export", + ] + cfg_parser = [ + "authentication-algorithm", + "authentication-key", + "authentication-key-chain", + "description", + "export", + "forwarding-context", + "hold-time", + "import", + "ipsec-sa", + "keep", + "local-address", + "local-interface", + "local-preference", + "peer-as", + "preference", + "out-delay", + "sr-preference-override", + "stale-labels-holddown-period", + "tcp-mss", + "ttl", + ] + for item in bool_parser: + bgp_root = self._add_node( + want, item, item.replace("-", "_"), bgp_root + ) + + for item in cfg_parser: + bgp_root = self._add_node( + want, item, item.replace("-", "_"), bgp_root, True + ) + + # Generate config commands for advertise-bgp-static + if want.get("advertise_bgp_static"): + ad_bgp_static_node = build_child_xml_node( + bgp_root, "advertise-bgp-static" + ) + ad_bgp_static = want.get("advertise_bgp_static") + if "policy" in ad_bgp_static.keys(): + build_child_xml_node( + ad_bgp_static_node, "policy", ad_bgp_static["policy"] + ) + + # Generate config commands for advertise-external + if want.get("advertise_external"): + ad_ext_node = build_child_xml_node(bgp_root, "advertise-external") + ad_ext = want.get("advertise_external") + if "conditional" in ad_ext.keys(): + build_child_xml_node(ad_ext_node, "conditional") + + # Generate config commands for bfd-liveness-detection + if want.get("bfd_liveness_detection"): + bfd_live_node = build_child_xml_node( + bgp_root, "bfd-liveness-detection" + ) + bfd_live_detect = want.get("bfd_liveness_detection") + + # Add node for authentication + + if "authentication" in bfd_live_detect.keys(): + bld_auth = bfd_live_detect["authentication"] + bld_auth_node = build_child_xml_node( + bfd_live_node, "authentication" + ) + # Add node for algorithm + if "algorithm" in bld_auth.keys(): + build_child_xml_node( + bld_auth_node, "algorithm", bld_auth["algorithm"] + ) + # Add node for key-chain + if "key_chain" in bld_auth.keys(): + build_child_xml_node( + bld_auth_node, "key-chain", bld_auth["key_chain"] + ) + # Add node for loose-check + if "loose_check" in bld_auth.keys(): + b_val = bld_auth.get("loose_check") + if b_val is not None: + if b_val is True: + build_child_xml_node(bld_auth_node, "loose-check") + # Add node for detection-time + if "detection_time" in bfd_live_detect.keys(): + d_time = bfd_live_detect["detection_time"] + bld_dtime_node = build_child_xml_node( + bfd_live_node, "detection-time" + ) + # Add node for threshold + if "threshold" in d_time.keys(): + build_child_xml_node( + bld_dtime_node, "threshold", d_time["threshold"] + ) + # Add node for transmit-interval + if "transmit_interval" in bfd_live_detect.keys(): + t_int = bfd_live_detect["transmit_interval"] + t_int_node = build_child_xml_node( + bfd_live_node, "transmit-interval" + ) + # Add node for minimum-interval + if "minimum_interval" in t_int.keys(): + build_child_xml_node( + t_int_node, + "minimum-interval", + t_int["minimum_interval"], + ) + # Add node for holddown-interval + if "holddown_interval" in bfd_live_detect.keys(): + build_child_xml_node( + bfd_live_node, + "holddown-interval", + bfd_live_detect["holddown_interval"], + ) + # Add node for minimum-receive-interval + if "minimum_receive_interval" in bfd_live_detect.keys(): + build_child_xml_node( + bfd_live_node, + "minimum-receive-interval", + bfd_live_detect["minimum_receive_interval"], + ) + # Add node for minimum-interval + if "minimum_interval" in bfd_live_detect.keys(): + build_child_xml_node( + bfd_live_node, + "minimum-interval", + bfd_live_detect["minimum_interval"], + ) + # Add node for multiplier + if "multiplier" in bfd_live_detect.keys(): + build_child_xml_node( + bfd_live_node, "multiplier", bfd_live_detect["multiplier"] + ) + # Add node for no-adaptation + if "no_adaptation" in bfd_live_detect.keys(): + b_val = bfd_live_detect.get("no_adaptation") + if b_val is not None: + if b_val is True: + build_child_xml_node(bfd_live_node, "no-adaptation") + # Add node for session-mode + if "session_mode" in bfd_live_detect.keys(): + build_child_xml_node( + bfd_live_node, + "session-mode", + bfd_live_detect["session_mode"], + ) + # Add node for version + if "version" in bfd_live_detect.keys(): + build_child_xml_node( + bfd_live_node, "version", bfd_live_detect["version"] + ) + # Generate config commands for bgp-error-tolerance + if want.get("bgp_error_tolerance"): + bgp_err_tol_node = build_child_xml_node( + bgp_root, "bgp-error-tolerance" + ) + bgp_err_tol = want.get("bgp_error_tolerance") + # Add node for malformed-route-limit" + if "malformed_route_limit" in bgp_err_tol.keys(): + build_child_xml_node( + bgp_err_tol_node, + "malformed-route-limit", + bgp_err_tol["malformed_route_limit"], + ) + # Add node for malformed-update-log-interval + if "malformed_update_log_interval" in bgp_err_tol.keys(): + build_child_xml_node( + bgp_err_tol_node, + "malformed-update-log-interval", + bgp_err_tol["malformed_update_log_interval"], + ) + # Generate config commands for no-malformed-route-limit + if "no_malformed_route_limit" in bgp_err_tol.keys(): + b_val = bgp_err_tol.get("no_malformed_route_limit") + if b_val is not None: + if b_val is True: + build_child_xml_node( + bgp_err_tol_node, "no-malformed-route-limit" + ) + + # Generate config commands for bmp + if want.get("bmp"): + bmp_node = build_child_xml_node(bgp_root, "bmp") + bmp = want.get("bmp") + # Add node for monitor + if "monitor" in bmp.keys(): + b_val = bmp.get("monitor") + if b_val is not None: + if b_val is True: + build_child_xml_node(bmp_node, "monitor", "enable") + else: + build_child_xml_node(bmp_node, "monitor", "disable") + + # Add node for route-monitoring + if "route_monitoring" in bmp.keys(): + r_mon_node = build_child_xml_node(bmp_node, "route-monitoring") + r_mon = bmp["route_monitoring"] + # Add node for none + if "none" in r_mon.keys(): + b_val = r_mon.get("none") + if b_val is not None: + if b_val is True: + build_child_xml_node(r_mon_node, "none") + # Add node for post-policy + if "post_policy_exclude_non_eligible" in r_mon.keys(): + b_val = r_mon.get("post_policy_exclude_non_eligible") + if b_val is not None: + if b_val is True: + policy_node = build_child_xml_node( + r_mon_node, "post-policy" + ) + build_child_xml_node( + policy_node, "exclude-non-eligible" + ) + elif "post_policy" in r_mon.keys(): + b_val = r_mon.get("post_policy") + if b_val is not None: + if b_val is True: + build_child_xml_node(r_mon_node, "post-policy") + # Add node for post-policy + if "pre_policy_exclude_non_feasible" in r_mon.keys(): + b_val = r_mon.get("pre_policy_exclude_non_feasible") + if b_val is not None: + if b_val is True: + policy_node = build_child_xml_node( + r_mon_node, "pre-policy" + ) + build_child_xml_node( + policy_node, "exclude-non-eligible" + ) + elif "pre-policy" in r_mon.keys(): + b_val = r_mon.get("pre_policy") + if b_val is not None: + if b_val is True: + build_child_xml_node(r_mon_node, "pre-policy") + + bgp_xml.append(bgp_root) + + return bgp_xml + + 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 + """ + bgp_xml = [] + parser = [ + "accept-remote-nexthop", + "add-path-display-ipv4-address", + "advertise-bgp-static", + "advertise-external", + "advertise-from-main-vpn-tables", + "advertise-inactive", + "advertise-peer-as", + "authentication-algorithm", + "authentication-key", + "authentication-key-chain", + "bfd-liveness-detection", + "bgp-error-tolerance", + "bmp", + "cluster", + "damping", + "description", + "disable", + "egress-te-sid-stats", + "enforce-first-as", + "export", + "forwarding-context", + "hold-time", + "holddown-all-stale-labels", + "import", + "include-mp-next-hop", + "ipsec-sa", + "keep", + "local-address", + "local-interface", + "local-preference", + "log-updown", + "mtu-discovery", + "no-advertise-peer-as", + "no-aggregator-id", + "no-client-reflect", + "no-precision-timers", + "passive", + "peer-as", + "precision-timers", + "preference", + "out-delay", + "rfc6514-compliant-safi129", + "route-server-client", + "send-addpath-optimization", + "sr-preference-override", + "stale-labels-holddown-period", + "tcp-aggressive-transmission", + "tcp-mss", + "ttl", + "unconfigured-peer-graceful-restart", + "vpn-apply-export", + ] + if have is not None: + bgp_root = build_root_xml_node("bgp") + for attrib in parser: + build_child_xml_node( + bgp_root, attrib, None, {"delete": "delete"} + ) + bgp_xml.append(bgp_root) + return bgp_xml + + def _state_purged(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 + """ + bgp_xml = [] + delete = {"delete": "delete"} + bgp_node = build_child_xml_node(self.root, "bgp") + bgp_node.attrib.update(delete) + bgp_xml.append(bgp_node) + return bgp_xml + + def _add_node(self, want, h_key, w_key, node, cfg=False): + """ Append the child node to the root node + :param want: the desired configuration as a dictionary + :param h_key: the current configuration key + :param: node: root node + """ + if cfg: + if want.get(w_key): + build_child_xml_node(node, h_key, want[w_key]) + else: + if w_key in want.keys(): + b_val = want.get(w_key) + if b_val is not None: + if b_val is True: + build_child_xml_node(node, h_key) + return node diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py new file mode 100644 index 00000000..f4696bb1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/interfaces/interfaces.py @@ -0,0 +1,306 @@ +# +# -*- 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 junos_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.utils import ( + to_list, +) + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Interfaces(ConfigBase): + """ + The junos_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["interfaces"] + + 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} + state = self._module.params["state"] + + if self.state in self.ACTION_STATES: + existing_interfaces_facts = self.get_interfaces_facts() + else: + existing_interfaces_facts = [] + + if state == "gathered": + existing_interfaces_facts = self.get_interfaces_facts() + result["gathered"] = existing_interfaces_facts + 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) + elif self.state == "rendered": + config_xmls = self.set_config(existing_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_interfaces_facts = self.get_interfaces_facts() + + result["before"] = existing_interfaces_facts + if result["changed"]: + result["after"] = changed_interfaces_facts + + 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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + root = build_root_xml_node("interfaces") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is replaced + + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(want, have)) + intf_xml.extend(self._state_merged(want, have)) + + return intf_xml + + def _state_overridden(self, want, have): + """ The xml configuration generator when state is overridden + + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + interface_xmls_obj = [] + # replace interface config with data in want + interface_xmls_obj.extend(self._state_replaced(want, have)) + + # delete interface config if interface in have not present in want + delete_obj = [] + for have_obj in have: + for want_obj in want: + if have_obj["name"] == want_obj["name"]: + break + else: + delete_obj.append(have_obj) + + if delete_obj: + interface_xmls_obj.extend(self._state_deleted(delete_obj, have)) + return interface_xmls_obj + + def _state_merged(self, want, have): + """ The xml configuration generator when state is merged + + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + intf_xml = [] + + for config in want: + intf = build_root_xml_node("interface") + build_child_xml_node(intf, "name", config["name"]) + + intf_fields = ["description", "speed"] + if not config["name"].startswith("fxp"): + intf_fields.append("mtu") + for field in intf_fields: + if config.get(field): + build_child_xml_node(intf, field, config[field]) + + if config.get("duplex"): + build_child_xml_node(intf, "link-mode", config["duplex"]) + + if config.get("enabled") is False: + build_child_xml_node(intf, "disable") + + holdtime = config.get("hold_time") + if holdtime: + holdtime_ele = build_child_xml_node(intf, "hold-time") + + for holdtime_field in ["up", "down"]: + build_child_xml_node( + holdtime_ele, + holdtime_field, + holdtime.get(holdtime_field, ""), + ) + intf_xml.append(intf) + + return intf_xml + + def _state_deleted(self, want, have): + """ The xml configuration generator when state is deleted + + :rtype: A list + :returns: the xml configuration necessary to remove the current configuration + of the provided objects + """ + intf_xml = [] + intf_obj = want + + if not intf_obj: + # delete base interfaces attribute from all the existing interface + intf_obj = have + + for config in intf_obj: + intf = build_root_xml_node("interface") + build_child_xml_node(intf, "name", config["name"]) + + intf_fields = ["description"] + if not any( + [ + config["name"].startswith("gr"), + config["name"].startswith("lo"), + ] + ): + intf_fields.append("speed") + + if not any( + [ + config["name"].startswith("gr"), + config["name"].startswith("fxp"), + config["name"].startswith("lo"), + ] + ): + intf_fields.append("mtu") + + for field in intf_fields: + build_child_xml_node(intf, field, None, {"delete": "delete"}) + + if not any( + [ + config["name"].startswith("gr"), + config["name"].startswith("lo"), + ] + ): + build_child_xml_node( + intf, "link-mode", None, {"delete": "delete"} + ) + + build_child_xml_node(intf, "disable", None, {"delete": "delete"}) + + holdtime_ele = build_child_xml_node(intf, "hold-time") + for holdtime_field in ["up", "down"]: + build_child_xml_node( + holdtime_ele, holdtime_field, None, {"delete": "delete"} + ) + intf_xml.append(intf) + + return intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py new file mode 100644 index 00000000..22cb92a4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l2_interfaces/l2_interfaces.py @@ -0,0 +1,331 @@ +# +# -*- 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 junos_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.utils import ( + to_list, +) + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, + build_subtree, +) + + +class L2_interfaces(ConfigBase): + """ + The junos_l2_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["l2_interfaces"] + + def __init__(self, module): + super(L2_interfaces, self).__init__(module) + + 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} + state = self._module.params["state"] + + if self.state in self.ACTION_STATES: + existing_l2_interfaces_facts = self.get_l2_interfaces_facts() + else: + existing_l2_interfaces_facts = [] + if state == "gathered": + existing_l2_interfaces_facts = self.get_l2_interfaces_facts() + result["gathered"] = existing_l2_interfaces_facts + 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 + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_l2_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_l2_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_interfaces_facts = self.get_l2_interfaces_facts() + + result["before"] = existing_l2_interfaces_facts + if result["changed"]: + result["after"] = changed_interfaces_facts + + 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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + root = build_root_xml_node("interfaces") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is replaced + + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + l2_intf_xml = [] + l2_intf_xml.extend(self._state_deleted(want, have)) + l2_intf_xml.extend(self._state_merged(want, have)) + + return l2_intf_xml + + def _state_overridden(self, want, have): + """ The xml configuration generator when state is overridden + + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + l2_interface_xmls_obj = [] + # replace interface config with data in want + l2_interface_xmls_obj.extend(self._state_replaced(want, have)) + + # delete interface config if interface in have not present in want + delete_obj = [] + for have_obj in have: + for want_obj in want: + if have_obj["name"] == want_obj["name"]: + break + else: + delete_obj.append(have_obj) + + if delete_obj: + l2_interface_xmls_obj.extend(self._state_deleted(delete_obj, have)) + return l2_interface_xmls_obj + + def _state_merged(self, want, have): + """ The xml configuration generator when state is merged + + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + intf_xml = [] + for config in want: + enhanced_layer = True + if config.get("enhanced_layer") is False: + enhanced_layer = False + + mode = "interface-mode" if enhanced_layer else "port-mode" + intf = build_root_xml_node("interface") + build_child_xml_node(intf, "name", config["name"]) + unit_node = build_child_xml_node(intf, "unit") + unit = config["unit"] if config["unit"] else "0" + build_child_xml_node(unit_node, "name", unit) + + eth_node = build_subtree(unit_node, "family/ethernet-switching") + if config.get("access"): + vlan = config["access"].get("vlan") + if vlan: + build_child_xml_node(eth_node, mode, "access") + vlan_node = build_child_xml_node(eth_node, "vlan") + build_child_xml_node(vlan_node, "members", vlan) + intf_xml.append(intf) + elif config.get("trunk"): + allowed_vlans = config["trunk"].get("allowed_vlans") + native_vlan = config["trunk"].get("native_vlan") + if allowed_vlans: + build_child_xml_node(eth_node, mode, "trunk") + vlan_node = build_child_xml_node(eth_node, "vlan") + for vlan in allowed_vlans: + build_child_xml_node(vlan_node, "members", vlan) + if native_vlan: + build_child_xml_node(intf, "native-vlan-id", native_vlan) + + if allowed_vlans or native_vlan: + intf_xml.append(intf) + + return intf_xml + + def get_res_config(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return get_resource_config(connection, config_filter=config_filter) + + def _state_deleted(self, want, have): + """ The xml configuration generator when state is deleted + + :rtype: A list + :returns: the xml configuration necessary to remove the current configuration + of the provided objects + """ + l2_intf_xml = [] + l2_intf_obj = want + + config_filter = """ + + + + """ + data = self.get_res_config( + self._connection, config_filter=config_filter + ) + + if not l2_intf_obj: + # delete l2 interfaces attribute from all the existing interface having l2 config + l2_intf_obj = have + + for config in l2_intf_obj: + name = config["name"] + enhanced_layer = True + l2_mode = data.xpath( + "configuration/interfaces/interface[name='%s']/unit/family/ethernet-switching/interface-mode" + % name + ) + + if not len(l2_mode): + l2_mode = data.xpath( + "configuration/interfaces/interface[name='%s']/unit/family/ethernet-switching/port-mode" + % name + ) + enhanced_layer = False + + if len(l2_mode): + mode = "interface-mode" if enhanced_layer else "port-mode" + + intf = build_root_xml_node("interface") + build_child_xml_node(intf, "name", name) + + unit_node = build_child_xml_node(intf, "unit") + unit = config["unit"] if config["unit"] else "0" + build_child_xml_node(unit_node, "name", unit) + + eth_node = build_subtree( + unit_node, "family/ethernet-switching" + ) + build_child_xml_node( + eth_node, mode, None, {"delete": "delete"} + ) + build_child_xml_node( + eth_node, "vlan", None, {"delete": "delete"} + ) + build_child_xml_node( + intf, "native-vlan-id", None, {"delete": "delete"} + ) + + l2_intf_xml.append(intf) + + return l2_intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/l3_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/l3_interfaces.py new file mode 100644 index 00000000..89063cd6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/l3_interfaces/l3_interfaces.py @@ -0,0 +1,280 @@ +# +# -*- 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 junos_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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class L3_interfaces(ConfigBase): + """ + The junos_l3_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["l3_interfaces"] + + def __init__(self, module): + super(L3_interfaces, self).__init__(module) + + 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} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_l3_interfaces_facts = self.get_l3_interfaces_facts() + else: + existing_l3_interfaces_facts = [] + if state == "gathered": + existing_l3_interfaces_facts = self.get_l3_interfaces_facts() + result["gathered"] = existing_l3_interfaces_facts + 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 + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_l3_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_l3_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_interfaces_facts = self.get_l3_interfaces_facts() + + result["before"] = existing_l3_interfaces_facts + if result["changed"]: + result["after"] = changed_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 list xml configuration necessary to migrate the current + configuration + to the desired configuration + """ + root = build_root_xml_node("interfaces") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _get_common_xml_node(self, name): + root_node = build_root_xml_node("interface") + build_child_xml_node(root_node, "name", name) + intf_unit_node = build_child_xml_node(root_node, "unit") + return root_node, intf_unit_node + + def _state_replaced(self, want, have): + """ The xml generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(want, have)) + intf_xml.extend(self._state_merged(want, have)) + return intf_xml + + def _state_overridden(self, want, have): + """ The xml generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(have, have)) + intf_xml.extend(self._state_merged(want, have)) + return intf_xml + + def _state_merged(self, want, have): + """ The xml generator when state is merged + + :rtype: A list + :returns: the xml necessary to merge the provided into + the current configuration + """ + intf_xml = [] + for config in want: + root_node, unit_node = self._get_common_xml_node(config["name"]) + build_child_xml_node(unit_node, "name", str(config["unit"])) + if config.get("ipv4"): + self.build_ipaddr_et(config, unit_node) + if config.get("ipv6"): + self.build_ipaddr_et(config, unit_node, protocol="ipv6") + intf_xml.append(root_node) + return intf_xml + + def build_ipaddr_et( + self, config, unit_node, protocol="ipv4", delete=False + ): + family = build_child_xml_node(unit_node, "family") + inet = "inet" + if protocol == "ipv6": + inet = "inet6" + ip_protocol = build_child_xml_node(family, inet) + for ip_addr in config[protocol]: + if ip_addr["address"] == "dhcp" and protocol == "ipv4": + build_child_xml_node(ip_protocol, "dhcp") + else: + ip_addresses = build_child_xml_node(ip_protocol, "address") + build_child_xml_node(ip_addresses, "name", ip_addr["address"]) + + def _state_deleted(self, want, have): + """ The xml configuration generator when state is deleted + + :rtype: A list + :returns: the xml configuration necessary to remove the current + configuration of the provided objects + """ + intf_xml = [] + existing_l3_intfs = [l3_intf["name"] for l3_intf in have] + + if not want: + want = have + + for config in want: + if config["name"] not in existing_l3_intfs: + continue + root_node, unit_node = self._get_common_xml_node(config["name"]) + build_child_xml_node(unit_node, "name", str(config["unit"])) + family = build_child_xml_node(unit_node, "family") + ipv4 = build_child_xml_node(family, "inet") + intf = next( + (intf for intf in have if intf["name"] == config["name"]), None + ) + if "ipv4" in intf: + if "dhcp" in [ + x["address"] + for x in intf.get("ipv4") + if intf.get("ipv4") is not None + ]: + build_child_xml_node( + ipv4, "dhcp", None, {"delete": "delete"} + ) + else: + build_child_xml_node( + ipv4, "address", None, {"delete": "delete"} + ) + ipv6 = build_child_xml_node(family, "inet6") + build_child_xml_node(ipv6, "address", None, {"delete": "delete"}) + + intf_xml.append(root_node) + return intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/lacp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/lacp.py new file mode 100644 index 00000000..561c0511 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp/lacp.py @@ -0,0 +1,239 @@ +# +# -*- 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 junos_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.netconf import ( + build_root_xml_node, + build_child_xml_node, + build_subtree, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) + + +class Lacp(ConfigBase): + """ + The junos_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} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_lacp_facts = self.get_lacp_facts() + else: + existing_lacp_facts = {} + if state == "gathered": + existing_lacp_facts = self.get_lacp_facts() + result["gathered"] = existing_lacp_facts + 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) + elif self.state == "rendered": + config_xmls = self.set_config(existing_lacp_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_lacp_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_lacp_facts = self.get_lacp_facts() + + result["before"] = existing_lacp_facts + if result["changed"]: + result["after"] = 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["config"] + 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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + root = build_root_xml_node("chassis") + ethernet_ele = build_subtree(root, "aggregated-devices/ethernet") + 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 == "overridden": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + ethernet_ele.append(xml) + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is merged + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + lacp_xml = [] + lacp_xml.extend(self._state_deleted(want, have)) + lacp_xml.extend(self._state_merged(want, have)) + + return lacp_xml + + 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 + """ + lacp_xml = [] + lacp_xml.extend(self._state_deleted(want, have)) + lacp_xml.extend(self._state_merged(want, have)) + + return lacp_xml + + def _state_merged(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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + lacp_xml = [] + + lacp_root = build_root_xml_node("lacp") + build_child_xml_node( + lacp_root, "system-priority", want.get("system_priority") + ) + if want.get("link_protection") == "non-revertive": + build_subtree(lacp_root, "link-protection/non-revertive") + elif want.get("link_protection") == "revertive": + link_root = build_child_xml_node(lacp_root, "link-protection") + build_child_xml_node( + link_root, "non-revertive", None, {"delete": "delete"} + ) + lacp_xml.append(lacp_root) + return lacp_xml + + 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 + """ + lacp_xml = [] + + lacp_root = build_root_xml_node("lacp") + build_child_xml_node( + lacp_root, "system-priority", None, {"delete": "delete"} + ) + element = build_child_xml_node( + lacp_root, "link-protection", None, {"delete": "delete"} + ) + build_child_xml_node( + element, "non-revertive", None, {"delete": "delete"} + ) + + lacp_xml.append(lacp_root) + return lacp_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/lacp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/lacp_interfaces.py new file mode 100644 index 00000000..78cd266c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lacp_interfaces/lacp_interfaces.py @@ -0,0 +1,305 @@ +# +# -*- 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 junos_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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, + build_subtree, +) + + +class Lacp_interfaces(ConfigBase): + """ + The junos_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} + state = self._module.params["state"] + + if self.state in self.ACTION_STATES: + existing_lacp_interfaces_facts = self.get_lacp_interfaces_facts() + else: + existing_lacp_interfaces_facts = [] + + if state == "gathered": + existing_lacp_interfaces_facts = self.get_lacp_interfaces_facts() + result["gathered"] = existing_lacp_interfaces_facts + 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 + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_lacp_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_lacp_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_interfaces_facts = self.get_lacp_interfaces_facts() + + result["before"] = existing_lacp_interfaces_facts + if result["changed"]: + result["after"] = changed_interfaces_facts + 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 + """ + root = build_root_xml_node("interfaces") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is replaced + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(want, have)) + intf_xml.extend(self._state_merged(want, have)) + + return intf_xml + + def _state_overridden(self, want, have): + """ The xml configuration generator when state is overridden + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + interface_xmls_obj = [] + # replace interface config with data in want + interface_xmls_obj.extend(self._state_replaced(want, have)) + + # delete interface config if interface in have not present in want + delete_obj = [] + for have_obj in have: + for want_obj in want: + if have_obj["name"] == want_obj["name"]: + break + else: + delete_obj.append(have_obj) + + if delete_obj: + interface_xmls_obj.extend(self._state_deleted(delete_obj, have)) + return interface_xmls_obj + + def _state_merged(self, want, have): + """ The xml configuration generator when state is merged + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + intf_xml = [] + + for config in want: + lacp_intf_name = config["name"] + lacp_intf_root = build_root_xml_node("interface") + + build_child_xml_node(lacp_intf_root, "name", lacp_intf_name) + if lacp_intf_name.startswith("ae"): + element = build_subtree( + lacp_intf_root, "aggregated-ether-options/lacp" + ) + if config["period"]: + build_child_xml_node(element, "periodic", config["period"]) + if config["sync_reset"]: + build_child_xml_node( + element, "sync-reset", config["sync_reset"] + ) + + system = config["system"] + if system: + mac = system.get("mac") + if mac: + if mac.get("address"): + build_child_xml_node( + element, "system-id", mac["address"] + ) + if system.get("priority"): + build_child_xml_node( + element, "system-priority", system["priority"] + ) + intf_xml.append(lacp_intf_root) + elif config["port_priority"] or config["force_up"] is not None: + element = build_subtree( + lacp_intf_root, "ether-options/ieee-802.3ad/lacp" + ) + build_child_xml_node( + element, "port-priority", config["port_priority"] + ) + if config["force_up"] is False: + build_child_xml_node( + element, "force-up", None, {"delete": "delete"} + ) + else: + build_child_xml_node(element, "force-up") + intf_xml.append(lacp_intf_root) + + return intf_xml + + def _state_deleted(self, want, have): + """ The xml configuration generator when state is deleted + :rtype: A list + :returns: the xml configuration necessary to remove the current configuration + of the provided objects + """ + intf_xml = [] + intf_obj = want + + if not intf_obj: + # delete lag interfaces attribute for all the interface + intf_obj = have + + for config in intf_obj: + lacp_intf_name = config["name"] + lacp_intf_root = build_root_xml_node("interface") + build_child_xml_node(lacp_intf_root, "name", lacp_intf_name) + if lacp_intf_name.startswith("ae"): + element = build_subtree( + lacp_intf_root, "aggregated-ether-options/lacp" + ) + build_child_xml_node( + element, "periodic", None, {"delete": "delete"} + ) + build_child_xml_node( + element, "sync-reset", None, {"delete": "delete"} + ) + build_child_xml_node( + element, "system-id", None, {"delete": "delete"} + ) + build_child_xml_node( + element, "system-priority", None, {"delete": "delete"} + ) + else: + element = build_subtree( + lacp_intf_root, "ether-options/ieee-802.3ad/lacp" + ) + build_child_xml_node( + element, "port-priority", None, {"delete": "delete"} + ) + build_child_xml_node( + element, "force-up", None, {"delete": "delete"} + ) + + intf_xml.append(lacp_intf_root) + + return intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/lag_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/lag_interfaces.py new file mode 100644 index 00000000..a613087c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lag_interfaces/lag_interfaces.py @@ -0,0 +1,341 @@ +# +# -*- 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 junos_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 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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, + build_subtree, +) + + +class Lag_interfaces(ConfigBase): + """ + The junos_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} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_lag_interfaces_facts = self.get_lag_interfaces_facts() + else: + existing_lag_interfaces_facts = [] + if state == "gathered": + existing_lag_interfaces_facts = self.get_lag_interfaces_facts() + result["gathered"] = existing_lag_interfaces_facts + 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 + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_lag_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_lag_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_lag_interfaces_facts = self.get_lag_interfaces_facts() + + result["before"] = existing_lag_interfaces_facts + if result["changed"]: + result["after"] = 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"] + 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 + """ + root = build_root_xml_node("interfaces") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is replaced + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(want, have)) + intf_xml.extend(self._state_merged(want, have)) + + return intf_xml + + def _state_overridden(self, want, have): + """ The xml configuration generator when state is overridden + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + interface_xmls_obj = [] + # replace interface config with data in want + interface_xmls_obj.extend(self._state_replaced(want, have)) + + # delete interface config if interface in have not present in want + delete_obj = [] + for have_obj in have: + for want_obj in want: + if have_obj["name"] == want_obj["name"]: + break + else: + delete_obj.append(have_obj) + + if delete_obj: + interface_xmls_obj.extend(self._state_deleted(delete_obj, have)) + return interface_xmls_obj + + def _state_merged(self, want, have): + """ The xml configuration generator when state is merged + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + intf_xml = [] + config_filter = """ + + + + """ + if self._module.params["state"] != "rendered": + data = get_resource_config( + self._connection, config_filter=config_filter + ) + + for config in want: + lag_name = config["name"] + + # if lag interface not already configured fail module. + if self._module.params["state"] != "rendered": + if not data.xpath( + "configuration/interfaces/interface[name='%s']" % lag_name + ): + self._module.fail_json( + msg="lag interface %s not configured, configure interface" + " %s before assigning members to lag" + % (lag_name, lag_name) + ) + + lag_intf_root = build_root_xml_node("interface") + build_child_xml_node(lag_intf_root, "name", lag_name) + ether_options_node = build_subtree( + lag_intf_root, "aggregated-ether-options" + ) + if config["mode"]: + + lacp_node = build_child_xml_node(ether_options_node, "lacp") + build_child_xml_node(lacp_node, config["mode"]) + + link_protection = config["link_protection"] + if link_protection: + build_child_xml_node(ether_options_node, "link-protection") + elif link_protection is False: + build_child_xml_node( + ether_options_node, + "link-protection", + None, + {"delete": "delete"}, + ) + + intf_xml.append(lag_intf_root) + + members = config["members"] + for member in members: + lag_member_intf_root = build_root_xml_node("interface") + build_child_xml_node( + lag_member_intf_root, "name", member["member"] + ) + lag_node = build_subtree( + lag_member_intf_root, "ether-options/ieee-802.3ad" + ) + build_child_xml_node(lag_node, "bundle", config["name"]) + + link_type = member.get("link_type") + if link_type == "primary": + build_child_xml_node(lag_node, "primary") + elif link_type == "backup": + build_child_xml_node(lag_node, "backup") + + intf_xml.append(lag_member_intf_root) + + return intf_xml + + def _state_deleted(self, want, have): + """ The xml configuration generator when state is deleted + :rtype: A list + :returns: the xml configuration necessary to remove the current configuration + of the provided objects + """ + intf_xml = [] + intf_obj = want + + if not intf_obj: + # delete lag interfaces attribute for all the interface + intf_obj = have + + for config in intf_obj: + lag_name = config["name"] + lag_intf_root = build_root_xml_node("interface") + build_child_xml_node(lag_intf_root, "name", lag_name) + + lag_node = build_subtree(lag_intf_root, "aggregated-ether-options") + build_child_xml_node( + lag_node, "link-protection", None, {"delete": "delete"} + ) + + lacp_node = build_child_xml_node(lag_node, "lacp") + build_child_xml_node( + lacp_node, "active", None, {"delete": "delete"} + ) + build_child_xml_node( + lacp_node, "passive", None, {"delete": "delete"} + ) + + intf_xml.append(lag_intf_root) + + # delete lag configuration from member interfaces + for interface_obj in have: + if lag_name == interface_obj["name"]: + for member in interface_obj.get("members", []): + lag_member_intf_root = build_root_xml_node("interface") + build_child_xml_node( + lag_member_intf_root, "name", member["member"] + ) + lag_node = build_subtree( + lag_member_intf_root, "ether-options/ieee-802.3ad" + ) + build_child_xml_node( + lag_node, "bundle", None, {"delete": "delete"} + ) + build_child_xml_node( + lag_node, "primary", None, {"delete": "delete"} + ) + build_child_xml_node( + lag_node, "backup", None, {"delete": "delete"} + ) + intf_xml.append(lag_member_intf_root) + + return intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/lldp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/lldp_global.py new file mode 100644 index 00000000..9230a915 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_global/lldp_global.py @@ -0,0 +1,241 @@ +# +# -*- 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 junos_lldp 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.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Lldp_global(ConfigBase): + """ + The junos_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} + state = self._module.params["state"] + + warnings = list() + + if self.state in self.ACTION_STATES: + existing_lldp_global_facts = self.get_lldp_global_facts() + else: + existing_lldp_global_facts = {} + if state == "gathered": + existing_lldp_global_facts = self.get_lldp_global_facts() + result["gathered"] = existing_lldp_global_facts + 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) + elif self.state == "rendered": + config_xmls = self.set_config(existing_lldp_global_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_lldp_global_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_lldp_global_facts = self.get_lldp_global_facts() + + result["before"] = existing_lldp_global_facts + if result["changed"]: + result["after"] = 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"] + 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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + root = build_root_xml_node("protocols") + 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": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is merged + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + lldp_xml = [] + lldp_xml.extend(self._state_deleted(want, have)) + lldp_xml.extend(self._state_merged(want, have)) + + return lldp_xml + + def _state_merged(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 list xml configuration necessary to migrate the current configuration + to the desired configuration + """ + lldp_xml = [] + + lldp_root = build_root_xml_node("lldp") + if want.get("address"): + build_child_xml_node( + lldp_root, "management-address", want["address"] + ) + if want.get("interval"): + build_child_xml_node( + lldp_root, "advertisement-interval", want["interval"] + ) + if want.get("transmit_delay"): + build_child_xml_node( + lldp_root, "transmit-delay", want["transmit_delay"] + ) + if want.get("hold_multiplier"): + build_child_xml_node( + lldp_root, "hold-multiplier", want["hold_multiplier"] + ) + enable = want.get("enable") + if enable is not None: + if enable is False: + build_child_xml_node(lldp_root, "disable") + else: + build_child_xml_node( + lldp_root, "disable", None, {"delete": "delete"} + ) + else: + build_child_xml_node( + lldp_root, "disable", None, {"delete": "delete"} + ) + lldp_xml.append(lldp_root) + + return lldp_xml + + 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 + """ + lldp_xml = [] + + lldp_root = build_root_xml_node("lldp") + build_child_xml_node( + lldp_root, "management-address", None, {"delete": "delete"} + ) + build_child_xml_node( + lldp_root, "advertisement-interval", None, {"delete": "delete"} + ) + build_child_xml_node( + lldp_root, "transmit-delay", None, {"delete": "delete"} + ) + build_child_xml_node( + lldp_root, "hold-multiplier", None, {"delete": "delete"} + ) + build_child_xml_node(lldp_root, "disable", None, {"delete": "delete"}) + lldp_xml.append(lldp_root) + return lldp_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/lldp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/lldp_interfaces.py new file mode 100644 index 00000000..ca70a52e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/lldp_interfaces/lldp_interfaces.py @@ -0,0 +1,259 @@ +# +# -*- 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 junos_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, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, + build_subtree, +) + + +class Lldp_interfaces(ConfigBase): + """ + The junos_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} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_lldp_interfaces_facts = self.get_lldp_interfaces_facts() + else: + existing_lldp_interfaces_facts = [] + if state == "gathered": + existing_lldp_interfaces_facts = self.get_lldp_interfaces_facts() + result["gathered"] = existing_lldp_interfaces_facts + 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 + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_lldp_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_lldp_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_lldp_interfaces_facts = self.get_lldp_interfaces_facts() + + result["before"] = existing_lldp_interfaces_facts + if result["changed"]: + result["after"] = 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 + """ + root = build_root_xml_node("protocols") + lldp_intf_ele = build_subtree(root, "lldp") + + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + lldp_intf_ele.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The xml configuration generator when state is replaced + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + lldp_intf_xml = [] + lldp_intf_xml.extend(self._state_deleted(want, have)) + lldp_intf_xml.extend(self._state_merged(want, have)) + + return lldp_intf_xml + + def _state_overridden(self, want, have): + """ The xml configuration generator when state is overridden + :rtype: A list + :returns: the xml configuration necessary to migrate the current configuration + to the desired configuration + """ + lldp_intf_xmls_obj = [] + + # replace interface config with data in want + lldp_intf_xmls_obj.extend(self._state_replaced(want, have)) + + # delete interface config if interface in have not present in want + delete_obj = [] + for have_obj in have: + for want_obj in want: + if have_obj["name"] == want_obj["name"]: + break + else: + delete_obj.append(have_obj) + + if len(delete_obj): + lldp_intf_xmls_obj.extend(self._state_deleted(delete_obj, have)) + + return lldp_intf_xmls_obj + + def _state_merged(self, want, have): + """ The xml configuration generator when state is merged + :rtype: A list + :returns: the xml configuration necessary to merge the provided into + the current configuration + """ + lldp_intf_xml = [] + for config in want: + lldp_intf_root = build_root_xml_node("interface") + + if config.get("name"): + build_child_xml_node(lldp_intf_root, "name", config["name"]) + + if config.get("enabled") is not None: + if config["enabled"] is False: + build_child_xml_node(lldp_intf_root, "disable") + else: + build_child_xml_node( + lldp_intf_root, "disable", None, {"delete": "delete"} + ) + else: + build_child_xml_node( + lldp_intf_root, "disable", None, {"delete": "delete"} + ) + lldp_intf_xml.append(lldp_intf_root) + return lldp_intf_xml + + def _state_deleted(self, want, have): + """ The xml configuration generator when state is deleted + :rtype: A list + :returns: the xml configuration necessary to remove the current configuration + of the provided objects + """ + lldp_intf_xml = [] + intf_obj = want + + if not intf_obj: + # delete lldp interfaces attribute from all the existing interface + intf_obj = have + + for config in intf_obj: + lldp_intf_root = build_root_xml_node("interface") + lldp_intf_root.attrib.update({"delete": "delete"}) + build_child_xml_node(lldp_intf_root, "name", config["name"]) + + lldp_intf_xml.append(lldp_intf_root) + + return lldp_intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/ospf.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/ospf.py new file mode 100644 index 00000000..2655f7b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf/ospf.py @@ -0,0 +1,438 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# 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 . + + +""" +The junos_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 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 ( + remove_empties, + to_list, +) + +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Ospf(ConfigBase): + """ + The junos_ospfv2 class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ospf"] + + def __init__(self, module): + super(Ospf, self).__init__(module) + + def get_ospf_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 + ) + ospf_facts = facts["ansible_network_resources"].get("junos_ospfv2") + if not ospf_facts: + return [] + return ospf_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_ospf_facts = self.get_ospf_facts() + else: + existing_ospf_facts = [] + if state == "gathered": + existing_ospf_facts = self.get_ospf_facts() + result["gathered"] = existing_ospf_facts + 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_ospf_facts(data=running_config) + elif self.state == "rendered": + config_xmls = self.set_config(existing_ospf_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_ospf_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_ospf_facts = self.get_ospf_facts() + + result["before"] = existing_ospf_facts + if result["changed"]: + result["after"] = changed_ospf_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_ospf_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_ospf_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 + """ + self.router_id = None + self.root = build_root_xml_node("configuration") + self.protocols = build_child_xml_node(self.root, "protocols") + self.routing_options = build_child_xml_node( + self.root, "routing-options" + ) + state = self._module.params["state"] + if ( + 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 + ) + ) + config_xmls = [] + if state == "overridden": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + self.protocols.append(xml) + + return [tostring(xml) for xml in self.root.getchildren()] + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_xml = [] + ospf_xml.extend(self._state_deleted(want, have)) + ospf_xml.extend(self._state_merged(want, have)) + return ospf_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_xml = [] + ospf_xml.extend(self._state_deleted(None, have)) + ospf_xml.extend(self._state_merged(want, have)) + return ospf_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_xml = [] + delete = {"delete": "delete"} + + if not want: + ospf_node = build_child_xml_node(self.protocols, "ospf") + ospf_node.attrib.update(delete) + if have: + router_id = have[0].get("router_id") + if router_id: + build_child_xml_node( + self.routing_options, + "router-id", + self.router_id, + attrib=delete, + ) + return ospf_node + + ospf_xml = self._state_merged(want, have, delete=delete) + return ospf_xml + + def _state_merged(self, want, have, delete=None): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_xml = [] + protocol = build_root_xml_node("ospf") + for ospf in want: + ospf = remove_empties(ospf) + self.router_id = ospf.get("router_id") + build_child_xml_node( + self.routing_options, "router-id", self.router_id + ) + + if ospf.get("spf_options"): + spf_options_node = build_child_xml_node( + protocol, "spf-options" + ) + if delete and not ospf.get("spf_options").values(): + spf_options_node.attrib.update(delete) + + if ospf["spf_options"].get("delay"): + delay_node = build_child_xml_node( + spf_options_node, + "delay", + ospf["spf_options"].get("delay"), + ) + if delete: + delay_node.attrib.update(delete) + + if ospf["spf_options"].get("holddown"): + holddown_node = build_child_xml_node( + spf_options_node, + "holddown", + ospf["spf_options"].get("holddown"), + ) + if delete: + holddown_node.attrib.update(delete) + + if ospf["spf_options"].get("delay"): + delay_node = build_child_xml_node( + spf_options_node, + "rapid-runs", + ospf["spf_options"].get("rapid_runs"), + ) + if delete: + delay_node.attrib.update(delete) + + if ospf.get("overload"): + overload_node = build_child_xml_node(protocol, "overload") + if ospf["overload"].get("timeout"): + build_child_xml_node( + overload_node, + "timeout", + ospf["overload"].get("timeout"), + ) + if delete: + overload_node.attrib.update(delete) + + if ospf.get("external_preference"): + ext_pref_node = build_child_xml_node( + protocol, + "external-preference", + ospf["externall_preference"], + ) + if delete: + ext_pref_node.attrib.update(delete) + + if ospf.get("preference"): + pref_node = build_child_xml_node( + protocol, "preference", ospf["preference"] + ) + if delete: + pref_node.attrib.update(delete) + + if ospf.get("prefix_export_limit"): + prefix_export_node = build_child_xml_node( + protocol, + "prefix-export-limit", + ospf["prefix_export_limit"], + ) + if delete: + prefix_export_node.attrib.update(delete) + + if ospf.get("reference_bandwidth"): + ref_bw_node = build_child_xml_node( + protocol, + "reference-bandwidth", + ospf.get("reference_bandwidth"), + ) + if delete: + ref_bw_node.attrib.update(delete) + + if "rfc1583compatibility" in ospf.keys(): + if not ospf["rfc1583compatibility"]: + build_child_xml_node(protocol, "no-rfc-1583") + + for area in ospf["areas"]: + area_node = build_child_xml_node(protocol, "area") + area_id = area.get("area_id") + build_child_xml_node(area_node, "name", area_id) + if area.get("area_range"): + area_range_node = build_child_xml_node( + area_node, "area-range" + ) + build_child_xml_node( + area_range_node, "name", area["area_range"] + ) + if delete: + area_range_node.attrib.update(delete) + + for intf in area.get("interfaces"): + intf_node = build_child_xml_node(area_node, "interface") + build_child_xml_node(intf_node, "name", intf.get("name")) + if delete: + if have: + existing_config = have[0] + for existing_area in existing_config["areas"]: + if existing_area["area_id"] == area_id: + if len(existing_area["interfaces"]) == 1: + area_node.attrib.update(delete) + else: + intf_node.attrib.update(delete) + + if intf.get("priority"): + build_child_xml_node( + intf_node, "priority", intf.get("priority") + ) + + if intf.get("flood_reduction"): + build_child_xml_node(intf_node, "flood-reduction") + + if intf.get("metric"): + build_child_xml_node( + intf_node, "metric", intf["metric"] + ) + + if intf.get("passive"): + build_child_xml_node(intf_node, "passive") + + if intf.get("bandwidth_based_metrics"): + bw_metrics_node = build_child_xml_node( + intf_node, "bandwidth-based-metrics" + ) + bw_metrics = intf.get("bandwidth_based_metrics") + for bw_metric in bw_metrics: + bw_metric_node = build_child_xml_node( + bw_metrics_node, "bandwidth" + ) + build_child_xml_node( + bw_metric_node, + "name", + bw_metric.get("bandwidth"), + ) + build_child_xml_node( + bw_metric_node, + "metric", + bw_metric.get("metric"), + ) + if intf.get("timers"): + if intf["timers"].get("dead_interval"): + build_child_xml_node( + intf_node, + "dead-interval", + intf["timers"].get("dead_interval"), + ) + if intf["timers"].get("hello_interval"): + build_child_xml_node( + intf_node, + "hello-interval", + intf["timers"].get("hello_interval"), + ) + if intf["timers"].get("poll_interval"): + build_child_xml_node( + intf_node, + "poll-interval", + intf["timers"].get("poll_interval"), + ) + if intf["timers"].get("retransmit_interval"): + build_child_xml_node( + intf_node, + "retransmit-interval", + intf["timers"].get("retransmit_interval"), + ) + + if area.get("stub"): + if area["stub"]["set"]: + stub_node = build_child_xml_node(area_node, "stub") + if area["stub"].get("default_metric"): + build_child_xml_node( + stub_node, + "default-metric", + area["stub"].get("default_metric"), + ) + ospf_xml.append(protocol) + return ospf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/ospf_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/ospf_interfaces.py new file mode 100644 index 00000000..45feb5cb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospf_interfaces/ospf_interfaces.py @@ -0,0 +1,340 @@ +# +# -*- 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 junos_ospf_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.utils import ( + remove_empties, + to_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( + ConfigBase, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) + + +class Ospf_interfaces(ConfigBase): + """ + The junos_ospf_interfaces class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ospf_interfaces"] + + def __init__(self, module): + super(Ospf_interfaces, self).__init__(module) + + def get_ospf_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 + ) + ospf_interfaces_facts = facts["ansible_network_resources"].get( + "junos_ospf_interfaces" + ) + if not ospf_interfaces_facts: + return [] + return ospf_interfaces_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_ospf_interfaces_facts = self.get_ospf_interfaces_facts() + else: + existing_ospf_interfaces_facts = [] + if state == "gathered": + existing_ospf_interfaces_facts = self.get_ospf_interfaces_facts() + result["gathered"] = existing_ospf_interfaces_facts + 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_ospf_interfaces_facts( + data=running_config + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_ospf_interfaces_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_ospf_interfaces_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_ospf_interfaces_facts = self.get_ospf_interfaces_facts() + + result["before"] = existing_ospf_interfaces_facts + if result["changed"]: + result["after"] = changed_ospf_interfaces_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_ospf_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_ospf_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 + """ + self.router_id = None + self.root = build_root_xml_node("configuration") + self.protocols = build_child_xml_node(self.root, "protocols") + self.routing_options = build_child_xml_node( + self.root, "routing-options" + ) + state = self._module.params["state"] + if ( + 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 + ) + ) + config_xmls = [] + if state == "overridden": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + self.protocols.append(xml) + + return [tostring(xml) for xml in self.root.getchildren()] + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_interfaces_xml = [] + ospf_interfaces_xml.extend(self._state_deleted(want, have)) + ospf_interfaces_xml.extend(self._state_merged(want, have)) + return ospf_interfaces_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_interfaces_xml = [] + ospf_interfaces_xml.extend(self._state_deleted(None, have)) + ospf_interfaces_xml.extend(self._state_merged(want, have)) + return ospf_interfaces_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_interfaces_xml = [] + delete = {"delete": "delete"} + protocol = build_root_xml_node("ospf") + if not want: + for h in have: + for af in h["address_family"]: + area_node = build_child_xml_node(protocol, "area") + processes = af.get("processes") + area = processes.get("area") + area_id = area.get("area_id") + build_child_xml_node(area_node, "name", area_id) + ospf_interfacesnode = build_child_xml_node( + area_node, "interface" + ) + build_child_xml_node( + ospf_interfacesnode, "name", h.get("name") + ) + ospf_interfacesnode.attrib.update(delete) + else: + for w in want: + for h in have: + if h["name"] == w["name"]: + for af in h["address_family"]: + area_node = build_child_xml_node(protocol, "area") + processes = af.get("processes") + area = processes.get("area") + area_id = area.get("area_id") + build_child_xml_node(area_node, "name", area_id) + ospf_interfacesnode = build_child_xml_node( + area_node, "interface" + ) + build_child_xml_node( + ospf_interfacesnode, "name", h.get("name") + ) + ospf_interfacesnode.attrib.update(delete) + ospf_interfaces_xml.append(protocol) + return ospf_interfaces_xml + + def _state_merged(self, want, have, delete=None): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospf_interfaces_xml = [] + protocol = build_root_xml_node("ospf") + for ospf_interfaces in want: + ospf_interfaces = remove_empties(ospf_interfaces) + self.router_id = ospf_interfaces.get("router_id") + build_child_xml_node( + self.routing_options, "router-id", self.router_id + ) + for af in ospf_interfaces["address_family"]: + area_node = build_child_xml_node(protocol, "area") + processes = af.get("processes") + area = processes.get("area") + area_id = area.get("area_id") + build_child_xml_node(area_node, "name", area_id) + + intf_node = build_child_xml_node(area_node, "interface") + build_child_xml_node( + intf_node, "name", ospf_interfaces.get("name") + ) + if delete: + if have: + existing_config = have[0] + if existing_config["name"] == ospf_interfaces["name"]: + intf_node.attrib.update(delete) + if processes.get("priority"): + build_child_xml_node( + intf_node, "priority", processes.get("priority") + ) + if processes.get("flood_reduction"): + build_child_xml_node(intf_node, "flood-reduction") + + if processes.get("metric"): + build_child_xml_node( + intf_node, "metric", processes.get("metric") + ) + + if processes.get("passive"): + build_child_xml_node(intf_node, "passive") + + if processes.get("bandwidth_based_metrics"): + bw_metrics_node = build_child_xml_node( + intf_node, "bandwidth-based-metrics" + ) + bw_metrics = processes.get("bandwidth_based_metrics") + for bw_metric in bw_metrics: + bw_metric_node = build_child_xml_node( + bw_metrics_node, "bandwidth" + ) + build_child_xml_node( + bw_metric_node, "name", bw_metric.get("bandwidth") + ) + build_child_xml_node( + bw_metric_node, "metric", bw_metric.get("metric") + ) + if processes.get("dead_interval"): + build_child_xml_node( + intf_node, + "dead-interval", + processes.get("dead_interval"), + ) + if processes.get("hello_interval"): + build_child_xml_node( + intf_node, + "hello-interval", + processes.get("hello_interval"), + ) + if processes.get("poll_interval"): + build_child_xml_node( + intf_node, + "poll-interval", + processes.get("poll_interval"), + ) + if processes.get("retransmit_interval"): + build_child_xml_node( + intf_node, + "retransmit-interval", + processes.get("retransmit_interval"), + ) + + ospf_interfaces_xml.append(protocol) + return ospf_interfaces_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/ospfv3.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/ospfv3.py new file mode 100644 index 00000000..47e1b291 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/ospfv3/ospfv3.py @@ -0,0 +1,438 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# 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 . + + +""" +The junos_ospfv3 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 ( + remove_empties, + to_list, +) + +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Ospfv3(ConfigBase): + """ + The junos_ospfv3 class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ospfv3"] + + def __init__(self, module): + super(Ospfv3, self).__init__(module) + + def get_ospfv3_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 + ) + ospfv3_facts = facts["ansible_network_resources"].get("junos_ospfv3") + if not ospfv3_facts: + return [] + return ospfv3_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_ospfv3_facts = self.get_ospfv3_facts() + else: + existing_ospfv3_facts = [] + if state == "gathered": + existing_ospfv3_facts = self.get_ospfv3_facts() + result["gathered"] = existing_ospfv3_facts + 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_ospfv3_facts(data=running_config) + elif self.state == "rendered": + config_xmls = self.set_config(existing_ospfv3_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_ospfv3_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_ospfv3_facts = self.get_ospfv3_facts() + + result["before"] = existing_ospfv3_facts + if result["changed"]: + result["after"] = changed_ospfv3_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_ospfv3_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_ospfv3_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 + """ + self.router_id = None + self.root = build_root_xml_node("configuration") + self.protocols = build_child_xml_node(self.root, "protocols") + self.routing_options = build_child_xml_node( + self.root, "routing-options" + ) + state = self._module.params["state"] + if ( + 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 + ) + ) + config_xmls = [] + if state == "overridden": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + self.protocols.append(xml) + + return [tostring(xml) for xml in self.root.getchildren()] + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospfv3_xml = [] + ospfv3_xml.extend(self._state_deleted(want, have)) + ospfv3_xml.extend(self._state_merged(want, have)) + return ospfv3_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospfv3_xml = [] + ospfv3_xml.extend(self._state_deleted(None, have)) + ospfv3_xml.extend(self._state_merged(want, have)) + return ospfv3_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospfv3_xml = [] + delete = {"delete": "delete"} + + if not want: + ospfv3node = build_child_xml_node(self.protocols, "ospf3") + ospfv3node.attrib.update(delete) + if have: + router_id = have[0].get("router_id") + if router_id: + build_child_xml_node( + self.routing_options, + "router-id", + self.router_id, + attrib=delete, + ) + return ospfv3node + + ospfv3_xml = self._state_merged(want, have, delete=delete) + return ospfv3_xml + + def _state_merged(self, want, have, delete=None): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + ospfv3_xml = [] + protocol = build_root_xml_node("ospf3") + for ospfv3 in want: + ospfv3 = remove_empties(ospfv3) + self.router_id = ospfv3.get("router_id") + build_child_xml_node( + self.routing_options, "router-id", self.router_id + ) + + if ospfv3.get("spf_options"): + spf_options_node = build_child_xml_node( + protocol, "spf-options" + ) + if delete and not ospfv3.get("spf_options").values(): + spf_options_node.attrib.update(delete) + + if ospfv3["spf_options"].get("delay"): + delay_node = build_child_xml_node( + spf_options_node, + "delay", + ospfv3["spf_options"].get("delay"), + ) + if delete: + delay_node.attrib.update(delete) + + if ospfv3["spf_options"].get("holddown"): + holddown_node = build_child_xml_node( + spf_options_node, + "holddown", + ospfv3["spf_options"].get("holddown"), + ) + if delete: + holddown_node.attrib.update(delete) + + if ospfv3["spf_options"].get("delay"): + delay_node = build_child_xml_node( + spf_options_node, + "rapid-runs", + ospfv3["spf_options"].get("rapid_runs"), + ) + if delete: + delay_node.attrib.update(delete) + + if ospfv3.get("overload"): + overload_node = build_child_xml_node(protocol, "overload") + if ospfv3["overload"].get("timeout"): + build_child_xml_node( + overload_node, + "timeout", + ospfv3["overload"].get("timeout"), + ) + if delete: + overload_node.attrib.update(delete) + + if ospfv3.get("external_preference"): + ext_pref_node = build_child_xml_node( + protocol, + "external-preference", + ospfv3["externall_preference"], + ) + if delete: + ext_pref_node.attrib.update(delete) + + if ospfv3.get("preference"): + pref_node = build_child_xml_node( + protocol, "preference", ospfv3["preference"] + ) + if delete: + pref_node.attrib.update(delete) + + if ospfv3.get("prefix_export_limit"): + prefix_export_node = build_child_xml_node( + protocol, + "prefix-export-limit", + ospfv3["prefix_export_limit"], + ) + if delete: + prefix_export_node.attrib.update(delete) + + if ospfv3.get("reference_bandwidth"): + ref_bw_node = build_child_xml_node( + protocol, + "reference-bandwidth", + ospfv3.get("reference_bandwidth"), + ) + if delete: + ref_bw_node.attrib.update(delete) + + if "rfc1583compatibility" in ospfv3.keys(): + if not ospfv3["rfc1583compatibility"]: + build_child_xml_node(protocol, "no-rfc-1583") + + for area in ospfv3["areas"]: + area_node = build_child_xml_node(protocol, "area") + area_id = area.get("area_id") + build_child_xml_node(area_node, "name", area_id) + if area.get("area_range"): + area_range_node = build_child_xml_node( + area_node, "area-range" + ) + build_child_xml_node( + area_range_node, "name", area["area_range"] + ) + if delete: + area_range_node.attrib.update(delete) + + for intf in area.get("interfaces"): + intf_node = build_child_xml_node(area_node, "interface") + build_child_xml_node(intf_node, "name", intf.get("name")) + if delete: + if have: + existing_config = have[0] + for existing_area in existing_config["areas"]: + if existing_area["area_id"] == area_id: + if len(existing_area["interfaces"]) == 1: + area_node.attrib.update(delete) + else: + intf_node.attrib.update(delete) + + if intf.get("priority"): + build_child_xml_node( + intf_node, "priority", intf.get("priority") + ) + + if intf.get("flood_reduction"): + build_child_xml_node(intf_node, "flood-reduction") + + if intf.get("metric"): + build_child_xml_node( + intf_node, "metric", intf["metric"] + ) + + if intf.get("passive"): + build_child_xml_node(intf_node, "passive") + + if intf.get("bandwidth_based_metrics"): + bw_metrics_node = build_child_xml_node( + intf_node, "bandwidth-based-metrics" + ) + bw_metrics = intf.get("bandwidth_based_metrics") + for bw_metric in bw_metrics: + bw_metric_node = build_child_xml_node( + bw_metrics_node, "bandwidth" + ) + build_child_xml_node( + bw_metric_node, + "name", + bw_metric.get("bandwidth"), + ) + build_child_xml_node( + bw_metric_node, + "metric", + bw_metric.get("metric"), + ) + if intf.get("timers"): + if intf["timers"].get("dead_interval"): + build_child_xml_node( + intf_node, + "dead-interval", + intf["timers"].get("dead_interval"), + ) + if intf["timers"].get("hello_interval"): + build_child_xml_node( + intf_node, + "hello-interval", + intf["timers"].get("hello_interval"), + ) + if intf["timers"].get("poll_interval"): + build_child_xml_node( + intf_node, + "poll-interval", + intf["timers"].get("poll_interval"), + ) + if intf["timers"].get("retransmit_interval"): + build_child_xml_node( + intf_node, + "retransmit-interval", + intf["timers"].get("retransmit_interval"), + ) + + if area.get("stub"): + if area["stub"]["set"]: + stub_node = build_child_xml_node(area_node, "stub") + if area["stub"].get("default_metric"): + build_child_xml_node( + stub_node, + "default-metric", + area["stub"].get("default_metric"), + ) + ospfv3_xml.append(protocol) + return ospfv3_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/static_routes.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/static_routes.py new file mode 100644 index 00000000..653eba2b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/static_routes/static_routes.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 junos_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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Static_routes(ConfigBase): + """ + The junos_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} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_static_routes_facts = self.get_static_routes_facts() + else: + existing_static_routes_facts = [] + if state == "gathered": + existing_static_routes_facts = self.get_static_routes_facts() + result["gathered"] = existing_static_routes_facts + 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 + ) + elif self.state == "rendered": + config_xmls = self.set_config(existing_static_routes_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_static_routes_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_static_routes_facts = self.get_static_routes_facts() + + result["before"] = existing_static_routes_facts + if result["changed"]: + result["after"] = 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"] + if ( + 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 + ) + ) + root = build_root_xml_node("configuration") + routing_options = build_child_xml_node(root, "routing-options") + routing_instances = build_child_xml_node(root, "routing-instances") + if state == "overridden": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + if xml["root_type"] == "routing-options": + routing_options.append(xml["static_route_xml"]) + elif xml["root_type"] == "routing-instances": + routing_instances.append(xml["static_route_xml"]) + + return [tostring(xml) for xml in root.getchildren()] + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + static_route_xml = [] + static_route_xml.extend(self._state_deleted(want, have)) + static_route_xml.extend(self._state_merged(want, have)) + return static_route_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + static_route_xml = [] + static_route_xml.extend(self._state_deleted(have, have)) + static_route_xml.extend(self._state_merged(want, have)) + return static_route_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + if not want: + want = have + static_route_xml = self._state_merged( + want, have, delete={"delete": "delete"} + ) + return static_route_xml + + def _state_merged(self, want, have, delete=None): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + static_route_xml = [] + root_type = "" + vrf_name = None + for config in want: + if config.get("vrf"): + vrf_name = config["vrf"] + if vrf_name: + root_type = "routing-instances" + instance = build_root_xml_node("instance") + build_child_xml_node(instance, "name", vrf_name) + routing_options = build_child_xml_node( + instance, "routing-options" + ) + else: + root_type = "routing-options" + + for afi in config["address_families"]: + protocol = afi["afi"] + if protocol == "ipv6": + if vrf_name: + rib_route_root = build_child_xml_node( + routing_options, "rib" + ) + build_child_xml_node( + rib_route_root, "name", vrf_name + ".inet6.0" + ) + else: + rib_route_root = build_root_xml_node("rib") + build_child_xml_node(rib_route_root, "name", "inet6.0") + static_route_root = build_child_xml_node( + rib_route_root, "static" + ) + elif protocol == "ipv4": + if vrf_name: + static_route_root = build_child_xml_node( + routing_options, "static" + ) + else: + static_route_root = build_root_xml_node("static") + + if afi.get("routes"): + for route in afi["routes"]: + route_node = build_child_xml_node( + static_route_root, "route" + ) + if delete: + route_node.attrib.update(delete) + if route.get("dest"): + build_child_xml_node( + route_node, "name", route["dest"] + ) + if not delete: + if route.get("metric"): + build_child_xml_node( + route_node, "metric", route["metric"] + ) + if route.get("next_hop"): + for hop in route["next_hop"]: + build_child_xml_node( + route_node, + "next-hop", + hop["forward_router_address"], + ) + elif delete: + if vrf_name: + instance.attrib.update(delete) + static_route_root.attrib.update(delete) + + if vrf_name: + static_route_xml.append( + {"root_type": root_type, "static_route_xml": instance} + ) + else: + if protocol == "ipv6": + static_route_xml.append( + { + "root_type": root_type, + "static_route_xml": rib_route_root, + } + ) + else: + static_route_xml.append( + { + "root_type": root_type, + "static_route_xml": static_route_root, + } + ) + return static_route_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/vlans.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/vlans.py new file mode 100644 index 00000000..7712b1a7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/config/vlans/vlans.py @@ -0,0 +1,246 @@ +# Copyright (C) 2019 Red Hat, Inc. +# +# 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 . +""" +The junos_vlans 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.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + locked_config, + load_config, + commit_configuration, + discard_changes, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + build_root_xml_node, + build_child_xml_node, +) + + +class Vlans(ConfigBase): + """ + The junos_vlans class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["vlans"] + + def __init__(self, module): + super(Vlans, self).__init__(module) + + def get_vlans_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 + ) + vlans_facts = facts["ansible_network_resources"].get("vlans") + if not vlans_facts: + return [] + return vlans_facts + + def execute_module(self): + """ Execute the module + + :rtype: A dictionary + :returns: The result from module execution + """ + result = {"changed": False} + state = self._module.params["state"] + warnings = list() + + if self.state in self.ACTION_STATES: + existing_vlans_facts = self.get_vlans_facts() + else: + existing_vlans_facts = [] + if state == "gathered": + existing_vlans_facts = self.get_vlans_facts() + result["gathered"] = existing_vlans_facts + 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_vlans_facts(data=running_config) + elif self.state == "rendered": + config_xmls = self.set_config(existing_vlans_facts) + if config_xmls: + result["rendered"] = config_xmls[0] + else: + result["rendered"] = "" + + else: + config_xmls = self.set_config(existing_vlans_facts) + with locked_config(self._module): + for config_xml in to_list(config_xmls): + diff = load_config(self._module, config_xml, []) + + commit = not self._module.check_mode + if diff: + if commit: + commit_configuration(self._module) + else: + discard_changes(self._module) + result["changed"] = True + + if self._module._diff: + result["diff"] = {"prepared": diff} + + result["commands"] = config_xmls + + changed_vlans_facts = self.get_vlans_facts() + + result["before"] = existing_vlans_facts + if result["changed"]: + result["after"] = changed_vlans_facts + + result["warnings"] = warnings + return result + + def set_config(self, existing_vlans_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_vlans_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 + """ + root = build_root_xml_node("vlans") + state = self._module.params["state"] + if ( + 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": + config_xmls = self._state_overridden(want, have) + elif state == "deleted": + config_xmls = self._state_deleted(want, have) + elif state in ("merged", "rendered"): + config_xmls = self._state_merged(want, have) + elif state == "replaced": + config_xmls = self._state_replaced(want, have) + + for xml in config_xmls: + root.append(xml) + + return tostring(root) + + def _state_replaced(self, want, have): + """ The command generator when state is replaced + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(want, have)) + intf_xml.extend(self._state_merged(want, have)) + return intf_xml + + def _state_overridden(self, want, have): + """ The command generator when state is overridden + + :rtype: A list + :returns: the xml necessary to migrate the current configuration + to the desired configuration + """ + intf_xml = [] + intf_xml.extend(self._state_deleted(have, have)) + intf_xml.extend(self._state_merged(want, have)) + return intf_xml + + def _state_merged(self, want, have): + """ The command generator when state is merged + + :rtype: A list + :returns: the xml necessary to merge the provided into + the current configuration + """ + intf_xml = [] + + for config in want: + vlan_name = str(config["name"]) + vlan_id = str(config["vlan_id"]) + vlan_description = config.get("description") + vlan_root = build_root_xml_node("vlan") + build_child_xml_node(vlan_root, "name", vlan_name) + build_child_xml_node(vlan_root, "vlan-id", vlan_id) + if vlan_description: + build_child_xml_node( + vlan_root, "description", vlan_description + ) + intf_xml.append(vlan_root) + return intf_xml + + def _state_deleted(self, want, have): + """ The command generator when state is deleted + + :rtype: A list + :returns: the xml necessary to remove the current configuration + of the provided objects + """ + intf_xml = [] + + if not want: + want = have + + for config in want: + vlan_name = config["name"] + vlan_root = build_root_xml_node("vlan") + vlan_root.attrib.update({"delete": "delete"}) + build_child_xml_node(vlan_root, "name", vlan_name) + intf_xml.append(vlan_root) + return intf_xml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py new file mode 100644 index 00000000..2465753c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acl_interfaces/acl_interfaces.py @@ -0,0 +1,167 @@ +# +# -*- 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 junos 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.module_utils._text import to_bytes +from ansible.module_utils.basic import missing_required_lib +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.acl_interfaces.acl_interfaces import ( + Acl_interfacesArgs, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class Acl_interfacesFacts(object): + """ The junos 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 HAS_LXML: + self._module.fail_json(msg=missing_required_lib("lxml")) + + if not data: + config_filter = """ + + + + """ + data = connection.get_configuration(filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/interfaces/interface") + + objs = [] + for resource in resources: + if resource is not None: + xml = self._get_xml_dict(resource) + obj = self.render_config(self.generated_spec, xml) + if obj: + objs.append(obj) + + facts = {} + if objs: + facts["junos_acl_interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["junos_acl_interfaces"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + 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["access_groups"] = [] + + if ( + "unit" in conf["interface"] + and "family" in conf["interface"]["unit"] + ): + for family in conf["interface"]["unit"]["family"].keys(): + access_groups = { + "afi": "ipv6" if family == "inet6" else "ipv4", + "acls": [], + } + if conf["interface"]["unit"]["family"][ + family + ] is not None and conf["interface"]["unit"]["family"][ + family + ].get( + "filter" + ): + for direction in ["input-list", "output-list"]: + rendered_direction = ( + "in" if direction == "input-list" else "out" + ) + if conf["interface"]["unit"]["family"][family][ + "filter" + ].get(direction): + acl_name = conf["interface"]["unit"]["family"][ + family + ]["filter"][direction] + if not isinstance(acl_name, list): + acl_name = [acl_name] + for filter_name in acl_name: + access_groups["acls"].append( + { + "name": filter_name, + "direction": rendered_direction, + } + ) + if access_groups["acls"]: + config["name"] = conf["interface"]["name"] + config["access_groups"].append(access_groups) + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py new file mode 100644 index 00000000..b176126b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/acls/acls.py @@ -0,0 +1,273 @@ +# +# -*- 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 junos 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 ansible.module_utils._text import to_bytes +from ansible.module_utils.basic import missing_required_lib +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.acls.acls import ( + AclsArgs, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class AclsFacts(object): + """ The junos 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 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 HAS_LXML: + self._module.fail_json(msg=missing_required_lib("lxml")) + + if not data: + config_filter = """ + + + + """ + data = connection.get_configuration(filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/firewall") + + objs = [] + for resource in resources: + if resource: + xml = self._get_xml_dict(resource) + for family, sub_dict in xml["firewall"]["family"].items(): + sub_dict["family"] = family + obj = self.render_config( + self.generated_spec, dict(firewall=sub_dict) + ) + if obj: + objs.append(obj) + + facts = {} + if objs: + facts["junos_acls"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["junos_acls"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + 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["afi"] = ( + "ipv6" if conf["firewall"].pop("family") == "inet6" else "ipv4" + ) + acls = conf.get("firewall").get("filter") + if not isinstance(acls, list): + acls = [acls] + config["acls"] = [] + for acl in acls: + acl_dict = {"name": acl["name"], "aces": []} + if acl.get("term"): + terms = acl["term"] + if not isinstance(terms, list): + terms = [terms] + for term in terms: + ace = {"name": term.get("name")} + if term.get("from"): + if term["from"].get("source-address"): + ace["source"] = ace.get("source", {}) + ace["source"]["address"] = term["from"][ + "source-address" + ]["name"] + if term["from"].get("source-prefix-list"): + ace["source"] = ace.get("source", {}) + ace["source"]["prefix_list"] = term["from"][ + "source-prefix-list" + ] + if term["from"].get("source-port"): + ace["source"] = ace.get("source", {}) + ace["source"]["port_protocol"] = dict( + eq=term["from"]["source-port"] + ) + if term["from"].get("destination-address"): + ace["destination"] = ace.get("destination", {}) + ace["destination"]["address"] = term["from"][ + "destination-address" + ]["name"] + if term["from"].get("destination-prefix-list"): + ace["destination"] = ace.get("destination", {}) + ace["destination"]["prefix_list"] = term["from"][ + "destination-prefix-list" + ] + if term["from"].get("destination-port"): + ace["destination"]["port_protocol"] = dict( + eq=term["from"]["destination-port"] + ) + if term["from"].get("protocol"): + ace["protocol"] = term["from"]["protocol"] + if term["from"].get("icmp-type"): + ace["protocol_options"] = dict(icmp={}) + icmp_type = term["from"]["icmp-type"] + if icmp_type == "echo-reply": + ace["protocol_options"]["icmp"][ + "echo_reply" + ] = True + if icmp_type == "echo-request": + ace["protocol_options"]["icmp"]["echo"] = True + if icmp_type == "redirect": + ace["protocol_options"]["icmp"][ + "redirect" + ] = True + if icmp_type == "router-advertisement": + ace["protocol_options"]["icmp"][ + "router_advertisement" + ] = True + if icmp_type == "router-solicit": + ace["protocol_options"]["icmp"][ + "router_solicitation" + ] = True + if icmp_type == "time-exceeded": + ace["protocol_options"]["icmp"][ + "time_exceeded" + ] = True + if term["from"].get("icmp-code"): + ace["protocol_options"] = dict(icmp={}) + icmp_code = term["from"]["icmp-code"] + if icmp_code == "destination-host-prohibited": + ace["protocol_options"]["icmp"][ + "dod_host_prohibited" + ] = True + if icmp_code == "destination-host-unknown": + ace["protocol_options"]["icmp"][ + "host_unknown" + ] = True + if icmp_code == "destination-network-prohibited": + ace["protocol_options"]["icmp"][ + "dod_net_prohibited" + ] = True + if icmp_code == "destination-network-unknown": + ace["protocol_options"]["icmp"][ + "network_unknown" + ] = True + if icmp_code == "host-unreachable": + ace["protocol_options"]["icmp"][ + "host_unreachable" + ] = True + if icmp_code == "host-unreachable-for-tos": + ace["protocol_options"]["icmp"][ + "host_tos_unreachable" + ] = True + if icmp_code == "port-unreachable": + ace["protocol_options"]["icmp"][ + "port_unreachable" + ] = True + if icmp_code == "protocol-unreachable": + ace["protocol_options"]["icmp"][ + "protocol_unreachable" + ] = True + if icmp_code == "redirect-for-host": + ace["protocol_options"]["icmp"][ + "host_redirect" + ] = True + if icmp_code == "redirect-for-network": + ace["protocol_options"]["icmp"][ + "net_redirect" + ] = True + if icmp_code == "redirect-for-tos-and-host": + ace["protocol_options"]["icmp"][ + "host_tos_redirect" + ] = True + if icmp_code == "redirect-for-tos-and-net": + ace["protocol_options"]["icmp"][ + "net_tos_redirect" + ] = True + if icmp_code == "source-route-failed": + ace["protocol_options"]["icmp"][ + "source_route_failed" + ] = True + if icmp_code == "ttl-eq-zero-during-reassembly": + ace["protocol_options"]["icmp"][ + "reassembly-timeout" + ] = True + if icmp_code == "ttl-eq-zero-during-transit": + ace["protocol_options"]["icmp"][ + "ttl_exceeded" + ] = True + + if term.get("then"): + if "accept" in term["then"]: + ace["grant"] = "permit" + if "discard" in term["then"]: + ace["grant"] = "deny" + acl_dict["aces"].append(ace) + config["acls"].append(acl_dict) + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/bgp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/bgp_global.py new file mode 100644 index 00000000..ef67711a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/bgp_global/bgp_global.py @@ -0,0 +1,474 @@ +# +# -*- 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 junos bgp_global 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.module_utils._text import to_bytes +from ansible.module_utils.basic import missing_required_lib +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.bgp_global.bgp_global import ( + Bgp_globalArgs, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class Bgp_globalFacts(object): + """ The junos bgp_global fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = Bgp_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 get_connection(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return connection.get_configuration(filter=config_filter) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for bgp_global + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + + """ + data = self.get_connection(connection, config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + objs = {} + resources = data.xpath("configuration/protocols/bgp") + autonomous_system = data.xpath( + "configuration/routing-options/autonomous-system" + ) + if autonomous_system: + self.autonomous_system = self._get_xml_dict( + autonomous_system.pop() + ) + else: + self.autonomous_system = "" + for resource in resources: + if resource: + xml = self._get_xml_dict(resource) + objs = self.render_config(self.generated_spec, xml) + facts = {} + if objs: + facts["bgp_global"] = {} + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + facts["bgp_global"] = utils.remove_empties(params["config"]) + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + 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 + """ + bgp_global = {} + bgp = conf.get("bgp") + # Read accept-remote-nexthop value + if "accept-remote-nexthop" in bgp.keys(): + bgp_global["accept_remote_nexthop"] = True + + # Read add-path-display-ipv4-address value + if "add-path-display-ipv4-address" in bgp.keys(): + bgp_global["add_path_display_ipv4_address"] = True + + # Parse advertise-bgp-static dictionary + if "advertise-bgp-static" in bgp.keys(): + cfg = {} + if ( + bgp.get("advertise-bgp-static") + and "advertise-bgp-static" in bgp.keys() + ): + if "policy" in bgp["advertise-bgp-static"]: + cfg["policy"] = bgp["advertise-bgp-static"].get("policy") + else: + cfg["set"] = True + bgp_global["advertise_bgp_static"] = cfg + + # Parse advertise-external dictionary + if "advertise-external" in bgp.keys(): + cfg = {} + if "conditional" in bgp["advertise-bgp-static"].keys(): + cfg["conditional"] = True + else: + cfg["set"] = True + bgp_global["advertise_external"] = cfg + + # Read advertise-from-main-vpn-tables value + if "advertise-from-main-vpn-tables" in bgp.keys(): + bgp_global["advertise_from_main_vpn_tables"] = True + + # Read advertise-inactive value + if "advertise-inactive" in bgp.keys(): + bgp_global["advertise_inactive"] = True + + # Read advertise-peer-as value + if "advertise-peer-as" in bgp.keys(): + bgp_global["advertise_peer_as"] = True + + # Read authentication-algorithm value + if "authentication-algorithm" in bgp.keys(): + bgp_global["authentication_algorithm"] = bgp[ + "authentication-algorithm" + ] + + # Read authentication-key value + if "authentication-key" in bgp.keys(): + bgp_global["authentication_key"] = bgp["authentication-key"] + + # Read authentication-key-chain value + if "authentication-key-chain" in bgp.keys(): + bgp_global["authentication_key_chain"] = bgp[ + "authentication-key-chain" + ] + + # Parse bfd-liveness-detection dictionary + if "bfd-liveness-detection" in bgp.keys(): + cfg = {} + bld = bgp["bfd-liveness-detection"] + # Parse authentication dictionary + if "authentication" in bld.keys(): + a_dict = {} + authentication = bld["authentication"] + if "algorithm" in authentication.keys(): + a_dict["algorithm"] = authentication["algorithm"] + if "key-chain" in authentication.keys(): + a_dict["key_chain"] = authentication["key-chain"] + if "loose-check" in authentication.keys(): + a_dict["loose_check"] = True + cfg["authentication"] = a_dict + + # Parse detection-time dictionary + if "detection-time" in bld.keys(): + dt_dict = {} + d_time = bld["detection-time"] + if "threshold" in d_time.keys(): + dt_dict["threshold"] = d_time["threshold"] + cfg["detection_time"] = dt_dict + # Parse transmit-interval dictionary + if "transmit-interval" in bld.keys(): + t_dict = {} + t_int = bld["transmit-interval"] + if "minimum-interval" in t_int.keys(): + t_dict["minimum_interval"] = t_int["minimum-interval"] + cfg["transmit_interval"] = t_dict + + # Read holddown-interval value + if "holddown-interval" in bld.keys(): + cfg["holddown_interval"] = bld["holddown-interval"] + + # Read minimum-receive-interval value + if "minimum-receive-interval" in bld.keys(): + cfg["minimum_receive_interval"] = bld[ + "minimum-receive-interval" + ] + + # Read minimum-interval value + if "minimum-interval" in bld.keys(): + cfg["minimum_interval"] = bld["minimum-interval"] + + # Read multiplier value + if "multiplier" in bld.keys(): + cfg["multiplier"] = bld["multiplier"] + + # Read no-adaptation value + if "no-adaptation" in bld.keys(): + cfg["no_adaptation"] = True + + # Read session-mode value + if "session-mode" in bld.keys(): + cfg["session_mode"] = bld["session-mode"] + + # Read version value + if "version" in bld.keys(): + cfg["version"] = bld["version"] + + # write the bfd_liveness_detection to bgp global config dictionary + bgp_global["bfd_liveness_detection"] = cfg + + # Parse bgp-error-tolerance dictionary + if "bgp-error-tolerance" in bgp.keys(): + cfg = {} + bet = bgp["bgp-error-tolerance"] + # Parse authentication dictionary + if "malformed-route-limit" in bet.keys(): + cfg["malformed_route_limit"] = bet["malformed-route-limit"] + if "malformed-update-log-interval" in bet.keys(): + cfg["malformed_update_log_interval"] = bet[ + "malformed-update-log-interval" + ] + if "no-malformed-route-limit" in bet.keys(): + cfg["no_malformed_route_limit"] = True + # write the bfd_liveness_detection to bgp global config dictionary + bgp_global["bgp_error_tolerance"] = cfg + + # Parse bmp dictionary + if "bmp" in bgp.keys(): + cfg = {} + bmp = bgp["bmp"] + # Parse authentication dictionary + if "route-monitoring" in bmp.keys(): + rm_dict = {} + r_monitoring = bmp["route-monitoring"] + + # Read none attribute value + if "none" in r_monitoring.keys(): + rm_dict["none"] = True + + # Read post-policy attribute value + if "post-policy" in r_monitoring.keys(): + if r_monitoring["post-policy"].keys( + "exclude-non-eligible" + ): + rm_dict["post_policy_exclude_non_eligible"] = True + else: + rm_dict["post_policy"] = True + + # Read pre-policy attribute value + if "pre-policy" in r_monitoring.keys(): + if r_monitoring["pre-policy"].keys("exclude-non-feasible"): + rm_dict["pre_policy_exclude_non_feasible"] = True + else: + rm_dict["pre_policy"] = True + cfg["route_monitoring"] = rm_dict + # Read monitor value + if "monitor" in bmp.keys(): + if bmp["monitor"] == "disable": + cfg["monitor"] = False + else: + cfg["monitor"] = True + + # write the bmp to bgp global config dictionary + bgp_global["bmp"] = cfg + + # Read cluster value + if "cluster" in bgp.keys(): + bgp_global["cluster_id"] = bgp["cluster"] + + # Read damping value + if "damping" in bgp.keys(): + bgp_global["damping"] = True + + # Read description value + if "description" in bgp.keys(): + bgp_global["description"] = bgp["description"] + + # Read disable value + if "disable" in bgp.keys(): + bgp_global["disable"] = True + + # Read egress-te-sid-stats value + if "egress-te-sid-stats" in bgp.keys(): + bgp_global["egress_te_sid_stats"] = True + + # Read enforce-first-as value + if "enforce-first-as" in bgp.keys(): + bgp_global["enforce_first_as"] = True + + # Read export value + if "export" in bgp.keys(): + bgp_global["export"] = bgp["export"] + + # Read forwarding-context value + if "forwarding-context" in bgp.keys(): + bgp_global["forwarding_context"] = bgp["forwarding-context"] + + # Read hold-time value + if "hold-time" in bgp.keys(): + bgp_global["hold_time"] = bgp["hold-time"] + + # Read holddown-all-stale-labels value + if "holddown-all-stale-labels" in bgp.keys(): + bgp_global["holddown_all_stale_labels"] = True + + # Read import value + if "import" in bgp.keys(): + bgp_global["import"] = bgp["import"] + + # Read include-mp-next-hop value + if "include-mp-next-hop" in bgp.keys(): + bgp_global["include_mp_next_hop"] = True + + # Read ipsec-sa value + if "ipsec-sa" in bgp.keys(): + bgp_global["ipsec_sa"] = bgp["ipsec-sa"] + + # Read keep value + if "keep" in bgp.keys(): + bgp_global["keep"] = bgp["keep"] + + # Read local-address value + if "local-address" in bgp.keys(): + bgp_global["local_address"] = bgp["local-address"] + + # Read local-interface value + if "local-interface" in bgp.keys(): + bgp_global["local_interface"] = bgp["local-interface"] + + # Read local-preference value + if "local-preference" in bgp.keys(): + bgp_global["local_preference"] = bgp["local-preference"] + + # Read log-updown value + if "log-updown" in bgp.keys(): + bgp_global["log_updown"] = True + + # Read mtu-discovery value + if "mtu-discovery" in bgp.keys(): + bgp_global["mtu_discovery"] = True + + # Read no-advertise-peer-as value + if "no-advertise-peer-as" in bgp.keys(): + bgp_global["no_advertise_peer_as"] = True + + # Read no-aggregator-id value + if "no-aggregator-id" in bgp.keys(): + bgp_global["no_aggregator_id"] = True + + # Read no-client-reflect value + if "no-client-reflect" in bgp.keys(): + bgp_global["no_client_reflect"] = True + + # Read no-precision-timers value + if "no-precision-timers" in bgp.keys(): + bgp_global["no_precision_timers"] = True + + # Read out-delay value + if "out-delay" in bgp.keys(): + bgp_global["out_delay"] = bgp["out-delay"] + + # Read passive value + if "passive" in bgp.keys(): + bgp_global["passive"] = True + + # Read peer-as value + if "peer-as" in bgp.keys(): + bgp_global["peer_as"] = bgp["peer-as"] + + # Read precision-timers value + if "precision-timers" in bgp.keys(): + bgp_global["precision_timers"] = True + + # Read preference value + if "preference" in bgp.keys(): + bgp_global["preference"] = bgp["preference"] + + # Read rfc6514-compliant-safi129 value + if "rfc6514-compliant-safi129" in bgp.keys(): + bgp_global["rfc6514_compliant_safi129"] = True + + # Read route-server-client value + if "route-server-client" in bgp.keys(): + bgp_global["route_server_client"] = True + + # Read send-addpath-optimization value + if "send-addpath-optimization" in bgp.keys(): + bgp_global["send_addpath_optimization"] = True + + # Read sr-preference-override value + if "sr-preference-override" in bgp.keys(): + bgp_global["sr_preference_override"] = bgp[ + "sr-preference-override" + ] + + # Read stale-labels-holddown-period value + if "stale-labels-holddown-period" in bgp.keys(): + bgp_global["stale_labels_holddown_period"] = bgp[ + "stale-labels-holddown-period" + ] + + # Read tcp-aggressive-transmission value + if "tcp-aggressive-transmission" in bgp.keys(): + bgp_global["tcp_aggressive_transmission"] = True + + # Read tcp-mss value + if "tcp-mss" in bgp.keys(): + bgp_global["tcp_mss"] = bgp["tcp-mss"] + + # Read ttl value + if "ttl" in bgp.keys(): + bgp_global["ttl"] = bgp["ttl"] + + # Read unconfigured-peer-graceful-restart value + if "unconfigured-peer-graceful-restart" in bgp.keys(): + bgp_global["unconfigured_peer_graceful_restart"] = True + + # Read vpn-apply-export value + if "vpn-apply-export" in bgp.keys(): + bgp_global["vpn_apply_export"] = True + + utils.remove_empties(bgp_global) + return bgp_global diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py new file mode 100644 index 00000000..3d4f6b28 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/facts.py @@ -0,0 +1,149 @@ +# +# -*- 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 junos +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.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + HAS_PYEZ, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.legacy.base import ( + Default, + Hardware, + Config, + Interfaces, + OFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.acls.acls import ( + AclsFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.acl_interfaces.acl_interfaces import ( + Acl_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.interfaces.interfaces import ( + InterfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.lacp.lacp import ( + LacpFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.lacp_interfaces.lacp_interfaces import ( + Lacp_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.lag_interfaces.lag_interfaces import ( + Lag_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.l3_interfaces.l3_interfaces import ( + L3_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.lldp_global.lldp_global import ( + Lldp_globalFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.lldp_interfaces.lldp_interfaces import ( + Lldp_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.vlans.vlans import ( + VlansFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.l2_interfaces.l2_interfaces import ( + L2_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.static_routes.static_routes import ( + Static_routesFacts, +) + +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospf.ospf import ( + OspfFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospfv3.ospfv3 import ( + Ospfv3Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospf_interfaces.ospf_interfaces import ( + Ospf_interfacesFacts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.bgp_global.bgp_global import ( + Bgp_globalFacts, +) + +FACT_LEGACY_SUBSETS = dict( + default=Default, hardware=Hardware, config=Config, interfaces=Interfaces +) +FACT_RESOURCE_SUBSETS = dict( + acls=AclsFacts, + acl_interfaces=Acl_interfacesFacts, + interfaces=InterfacesFacts, + lacp=LacpFacts, + lacp_interfaces=Lacp_interfacesFacts, + lag_interfaces=Lag_interfacesFacts, + l2_interfaces=L2_interfacesFacts, + l3_interfaces=L3_interfacesFacts, + lldp_global=Lldp_globalFacts, + lldp_interfaces=Lldp_interfacesFacts, + ospf=OspfFacts, + ospfv3=Ospfv3Facts, + ospf_interfaces=Ospf_interfacesFacts, + vlans=VlansFacts, + static_routes=Static_routesFacts, + bgp_global=Bgp_globalFacts, +) + + +class Facts(FactsBase): + """ The fact class for junos + """ + + 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 junos + :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 not legacy_facts_type: + legacy_facts_type = self._gather_subset + # fetch old style facts only when explicitly mentioned in gather_subset option + if "ofacts" in legacy_facts_type: + if HAS_PYEZ: + self.ansible_facts.update(OFacts(self._module).populate()) + else: + self._warnings.extend( + [ + "junos-eznc is required to gather old style facts but does not appear to be installed. " + "It can be installed using `pip install junos-eznc`" + ] + ) + self.ansible_facts["ansible_net_gather_subset"].append( + "ofacts" + ) + legacy_facts_type.remove("ofacts") + + 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/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/interfaces.py new file mode 100644 index 00000000..5ced3af0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/interfaces/interfaces.py @@ -0,0 +1,138 @@ +# +# -*- 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 junos 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.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.interfaces.interfaces import ( + InterfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class InterfacesFacts(object): + """ The junos 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 get_config(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return get_resource_config(connection, config_filter=config_filter) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for interfaces + + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + """ + data = self.get_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/interfaces/interface") + + objs = [] + for resource in resources: + if resource is not None: + obj = self.render_config(self.generated_spec, resource) + 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 ElementTree instance of configuration object + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + config["name"] = utils.get_xml_conf_arg(conf, "name") + config["description"] = utils.get_xml_conf_arg(conf, "description") + mtu = utils.get_xml_conf_arg(conf, "mtu") + config["mtu"] = int(mtu) if mtu else None + config["speed"] = utils.get_xml_conf_arg(conf, "speed") + config["duplex"] = utils.get_xml_conf_arg(conf, "link-mode") + config["hold_time"]["down"] = utils.get_xml_conf_arg( + conf, "hold-time/down" + ) + config["hold_time"]["up"] = utils.get_xml_conf_arg( + conf, "hold-time/up" + ) + disable = utils.get_xml_conf_arg(conf, "disable", data="tag") + if disable: + config["enabled"] = False + else: + config["enabled"] = True + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/l2_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/l2_interfaces.py new file mode 100644 index 00000000..3bea6088 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l2_interfaces/l2_interfaces.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 junos 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 + +from ansible.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.l2_interfaces.l2_interfaces import ( + L2_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class L2_interfacesFacts(object): + """ The junos 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 get_config(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return get_resource_config(connection, config_filter=config_filter) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for interfaces + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + """ + data = self.get_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + self._resources = data.xpath("configuration/interfaces/interface") + + objs = [] + for resource in self._resources: + if resource is not None: + obj = self.render_config(self.generated_spec, resource) + 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 ElementTree instance of configuration object + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + + enhanced_layer = True + mode = utils.get_xml_conf_arg( + conf, "unit/family/ethernet-switching/interface-mode" + ) + + if mode is None: + mode = utils.get_xml_conf_arg( + conf, "unit/family/ethernet-switching/port-mode" + ) + enhanced_layer = False + + # Layer 2 is configured on interface + if mode: + config["name"] = utils.get_xml_conf_arg(conf, "name") + unit = utils.get_xml_conf_arg(conf, "unit/name") + config["unit"] = unit if unit else 0 + config["enhanced_layer"] = enhanced_layer + + if mode == "access": + config["access"] = {} + config["access"]["vlan"] = utils.get_xml_conf_arg( + conf, "unit/family/ethernet-switching/vlan/members" + ) + elif mode == "trunk": + config["trunk"] = {} + vlan_members = conf.xpath( + "unit/family/ethernet-switching/vlan/members" + ) + if vlan_members: + config["trunk"]["allowed_vlans"] = [] + for vlan_member in vlan_members: + config["trunk"]["allowed_vlans"].append( + vlan_member.text + ) + + config["trunk"]["native_vlan"] = utils.get_xml_conf_arg( + conf, "native-vlan-id" + ) + + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py new file mode 100644 index 00000000..abf47487 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/l3_interfaces/l3_interfaces.py @@ -0,0 +1,179 @@ +# +# -*- 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 junos 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 +from ansible.module_utils.basic import missing_required_lib +from ansible.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.l3_interfaces.l3_interfaces import ( + L3_interfacesArgs, +) +from ansible.module_utils.six import iteritems +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class L3_interfacesFacts(object): + """ The junos 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 get_config(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return connection.get_configuration(filter=config_filter) + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for l3_interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + """ + data = self.get_config(connection, config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + resources = data.xpath("configuration/interfaces/interface") + config = [] + if resources: + config = self.parse_l3_if_resources(resources) + facts = {} + facts["l3_interfaces"] = config + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def parse_l3_if_resources(self, l3_if_resources): + l3_ifaces = [] + for iface in l3_if_resources: + int_have = self._get_xml_dict(iface) + int_dict = int_have["interface"] + if "unit" in int_dict.keys() and int_dict.get("unit") is not None: + unit_list = int_dict["unit"] + if isinstance(unit_list, list): + for item in unit_list: + fact_dict = self._render_l3_intf(item, int_dict) + if fact_dict: + l3_ifaces.append(fact_dict) + else: + fact_dict = self._render_l3_intf(unit_list, int_dict) + if fact_dict: + l3_ifaces.append(fact_dict) + return l3_ifaces + + def _render_l3_intf(self, unit, int_dict): + """ + + :param item: + :param int_dict: + :return: + """ + interface = {} + ipv4 = [] + ipv6 = [] + if "family" in unit.keys(): + if "inet" in unit["family"].keys(): + interface["name"] = int_dict["name"] + interface["unit"] = unit["name"] + inet = unit["family"].get("inet") + if inet is not None and "address" in inet.keys(): + if isinstance(inet["address"], dict): + for key, value in iteritems(inet["address"]): + addr = {} + addr["address"] = value + ipv4.append(addr) + else: + for ip in inet["address"]: + addr = {} + addr["address"] = ip["name"] + ipv4.append(addr) + if "inet" in unit["family"].keys(): + interface["name"] = int_dict["name"] + interface["unit"] = unit["name"] + inet = unit["family"].get("inet") + if inet is not None and "dhcp" in inet.keys(): + addr = {} + addr["address"] = "dhcp" + ipv4.append(addr) + if "inet6" in unit["family"].keys(): + interface["name"] = int_dict["name"] + interface["unit"] = unit["name"] + inet6 = unit["family"].get("inet6") + if inet6 is not None and "address" in inet6.keys(): + if isinstance(inet6["address"], dict): + for key, value in iteritems(inet6["address"]): + addr = {} + addr["address"] = value + ipv6.append(addr) + else: + for ip in inet6["address"]: + addr = {} + addr["address"] = ip["name"] + ipv4.append(addr) + interface["ipv4"] = ipv4 + interface["ipv6"] = ipv6 + return utils.remove_empties(interface) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/lacp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/lacp.py new file mode 100644 index 00000000..f6d3c6b6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp/lacp.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 junos 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.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lacp.lacp import ( + LacpArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class LacpFacts(object): + """ The junos 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 interfaces + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + + + + + + """ + data = get_resource_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + facts = {} + config = deepcopy(self.generated_spec) + resources = data.xpath( + "configuration/chassis/aggregated-devices/ethernet/lacp" + ) + if resources: + + lacp_root = resources[0] + config["system_priority"] = utils.get_xml_conf_arg( + lacp_root, "system-priority" + ) + + if utils.get_xml_conf_arg( + lacp_root, "link-protection/non-revertive", data="tag" + ): + config["link_protection"] = "non-revertive" + + elif utils.get_xml_conf_arg(lacp_root, "link-protection"): + config["link_protection"] = "revertive" + + params = utils.validate_config( + self.argument_spec, {"config": utils.remove_empties(config)} + ) + facts["lacp"] = {} + facts["lacp"].update(utils.remove_empties(params["config"])) + + ansible_facts["ansible_network_resources"].update(facts) + + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/lacp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/lacp_interfaces.py new file mode 100644 index 00000000..a4b787e1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lacp_interfaces/lacp_interfaces.py @@ -0,0 +1,138 @@ +# +# -*- 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 junos 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 + +from copy import deepcopy + +from ansible.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lacp_interfaces.lacp_interfaces import ( + Lacp_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class Lacp_interfacesFacts(object): + """ The junos 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 interfaces + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + """ + data = get_resource_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + self._resources = data.xpath("configuration/interfaces/interface") + + objs = [] + for resource in self._resources: + if resource is not None: + obj = self.render_config(self.generated_spec, resource) + if obj: + objs.append(obj) + 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 ElementTree instance of configuration object + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + config["name"] = utils.get_xml_conf_arg(conf, "name") + config["period"] = utils.get_xml_conf_arg( + conf, "aggregated-ether-options/lacp/periodic" + ) + config["sync_reset"] = utils.get_xml_conf_arg( + conf, "aggregated-ether-options/lacp/sync-reset" + ) + force_up = utils.get_xml_conf_arg( + conf, "ether-options/ieee-802.3ad/lacp/force-up", data="tag" + ) + if force_up: + config["force_up"] = True + config["port_priority"] = utils.get_xml_conf_arg( + conf, "ether-options/ieee-802.3ad/lacp/port-priority" + ) + config["system"]["priority"] = utils.get_xml_conf_arg( + conf, "aggregated-ether-options/lacp/system-priority" + ) + address = utils.get_xml_conf_arg( + conf, "aggregated-ether-options/lacp/system-id" + ) + if address: + config["system"].update({"mac": {"address": address}}) + + lacp_intf_cfg = utils.remove_empties(config) + # if lacp config is not present for interface return empty dict + if len(lacp_intf_cfg) == 1: + return {} + else: + return lacp_intf_cfg diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py new file mode 100644 index 00000000..02e95692 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lag_interfaces/lag_interfaces.py @@ -0,0 +1,160 @@ +# +# -*- 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 junos 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 + +from copy import deepcopy + +from ansible.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lag_interfaces.lag_interfaces import ( + Lag_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class Lag_interfacesFacts(object): + """ The junos 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 interfaces + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + """ + data = get_resource_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + self._resources = data.xpath("configuration/interfaces/interface") + + objs = [] + for resource in self._resources: + if resource is not None: + obj = self.render_config(self.generated_spec, resource) + if obj: + objs.append(obj) + facts = {} + if objs: + 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): + """ + 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 ElementTree instance of configuration object + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + intf_name = utils.get_xml_conf_arg(conf, "name") + if intf_name.startswith("ae"): + config["name"] = intf_name + config["members"] = [] + for interface_obj in self._resources: + lag_interface_member = utils.get_xml_conf_arg( + interface_obj, + "ether-options/ieee-802.3ad[bundle='%s']/../../name" + % intf_name, + ) + if lag_interface_member: + member_config = {} + member_config["member"] = lag_interface_member + if utils.get_xml_conf_arg( + interface_obj, + "ether-options/ieee-802.3ad/primary", + data="tag", + ): + member_config["link_type"] = "primary" + elif utils.get_xml_conf_arg( + interface_obj, + "ether-options/ieee-802.3ad/backup", + data="tag", + ): + member_config["link_type"] = "backup" + + if member_config: + config["members"].append(member_config) + + for m in ["active", "passive"]: + if utils.get_xml_conf_arg( + conf, + "aggregated-ether-options/lacp/%s" % m, + data="tag", + ): + config["mode"] = m + break + + link_protection = utils.get_xml_conf_arg( + conf, + "aggregated-ether-options/link-protection", + data="tag", + ) + if link_protection: + config["link_protection"] = True + + lag_intf_cfg = utils.remove_empties(config) + # if lag interfaces config is not present return empty dict + if len(lag_intf_cfg) == 1: + return {} + else: + return lag_intf_cfg diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/base.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/base.py new file mode 100644 index 00000000..8782d8d4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/legacy/base.py @@ -0,0 +1,210 @@ +# -*- 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 junos 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 platform + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + exec_rpc, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + get_configuration, + get_capabilities, + get_device, +) +from ansible.module_utils._text import to_text + + +try: + from lxml.etree import Element, SubElement +except ImportError: + from xml.etree.ElementTree import Element, SubElement + + +class FactsBase(object): + def __init__(self, module): + self.module = module + self.facts = dict() + self.warnings = [] + + def populate(self): + raise NotImplementedError + + def cli(self, command): + reply = command(self.module, command) + output = reply.find(".//output") + if not output: + self.module.fail_json( + msg="failed to retrieve facts for command %s" % command + ) + return to_text(output.text).strip() + + def rpc(self, rpc): + return exec_rpc(self.module, tostring(Element(rpc))) + + def get_text(self, ele, tag): + try: + return to_text(ele.find(tag).text).strip() + except AttributeError: + pass + + +class Default(FactsBase): + def populate(self): + self.facts.update(self.platform_facts()) + + reply = self.rpc("get-chassis-inventory") + data = reply.find(".//chassis-inventory/chassis") + self.facts["serialnum"] = self.get_text(data, "serial-number") + + 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 Config(FactsBase): + def populate(self): + config_format = self.module.params["config_format"] + reply = get_configuration(self.module, format=config_format) + + if config_format == "xml": + config = tostring(reply.find("configuration")).strip() + + elif config_format == "text": + config = self.get_text(reply, "configuration-text") + + elif config_format == "json": + config = self.module.from_json(reply.text.strip()) + + elif config_format == "set": + config = self.get_text(reply, "configuration-set") + + self.facts["config"] = config + + +class Hardware(FactsBase): + def populate(self): + + reply = self.rpc("get-system-memory-information") + data = reply.find( + ".//system-memory-information/system-memory-summary-information" + ) + + self.facts.update( + { + "memfree_mb": int(self.get_text(data, "system-memory-free")), + "memtotal_mb": int(self.get_text(data, "system-memory-total")), + } + ) + + reply = self.rpc("get-system-storage") + data = reply.find(".//system-storage-information") + + filesystems = list() + for obj in data: + filesystems.append(self.get_text(obj, "filesystem-name")) + self.facts["filesystems"] = filesystems + + reply = self.rpc("get-route-engine-information") + data = reply.find(".//route-engine-information") + + routing_engines = dict() + for obj in data: + slot = self.get_text(obj, "slot") + routing_engines.update({slot: {}}) + routing_engines[slot].update({"slot": slot}) + for child in obj: + if child.text != "\n": + routing_engines[slot].update( + {child.tag.replace("-", "_"): child.text} + ) + + self.facts["routing_engines"] = routing_engines + + if len(data) > 1: + self.facts["has_2RE"] = True + else: + self.facts["has_2RE"] = False + + reply = self.rpc("get-chassis-inventory") + data = reply.findall(".//chassis-module") + + modules = list() + for obj in data: + mod = dict() + for child in obj: + if child.text != "\n": + mod.update({child.tag.replace("-", "_"): child.text}) + modules.append(mod) + + self.facts["modules"] = modules + + +class Interfaces(FactsBase): + def populate(self): + ele = Element("get-interface-information") + SubElement(ele, "detail") + reply = exec_rpc(self.module, tostring(ele)) + + interfaces = {} + + for item in reply[0]: + name = self.get_text(item, "name") + obj = { + "oper-status": self.get_text(item, "oper-status"), + "admin-status": self.get_text(item, "admin-status"), + "speed": self.get_text(item, "speed"), + "macaddress": self.get_text(item, "hardware-physical-address"), + "mtu": self.get_text(item, "mtu"), + "type": self.get_text(item, "if-type"), + } + + interfaces[name] = obj + + self.facts["interfaces"] = interfaces + + +class OFacts(FactsBase): + def populate(self): + + device = get_device(self.module) + facts = dict(device.facts) + + if "2RE" in facts: + facts["has_2RE"] = facts["2RE"] + del facts["2RE"] + + facts["version_info"] = dict(facts["version_info"]) + if "junos_info" in facts: + for key, value in facts["junos_info"].items(): + if "object" in value: + value["object"] = dict(value["object"]) + + return facts diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/lldp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/lldp_global.py new file mode 100644 index 00000000..4a4cd6a5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_global/lldp_global.py @@ -0,0 +1,110 @@ +# +# -*- 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 junos 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.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lldp_global.lldp_global import ( + Lldp_globalArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class Lldp_globalFacts(object): + """ The junos 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 interfaces + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + + """ + data = get_resource_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + facts = {} + config = deepcopy(self.generated_spec) + resources = data.xpath("configuration/protocols/lldp") + if resources: + lldp_root = resources[0] + config["address"] = utils.get_xml_conf_arg( + lldp_root, "management-address" + ) + config["interval"] = utils.get_xml_conf_arg( + lldp_root, "advertisement-interval" + ) + config["transmit_delay"] = utils.get_xml_conf_arg( + lldp_root, "transmit-delay" + ) + config["hold_multiplier"] = utils.get_xml_conf_arg( + lldp_root, "hold-multiplier" + ) + if utils.get_xml_conf_arg(lldp_root, "disable", data="tag"): + config["enable"] = False + + params = utils.validate_config( + self.argument_spec, {"config": utils.remove_empties(config)} + ) + + facts["lldp_global"] = utils.remove_empties(params["config"]) + ansible_facts["ansible_network_resources"].update(facts) + + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/lldp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/lldp_interfaces.py new file mode 100644 index 00000000..903b6374 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/lldp_interfaces/lldp_interfaces.py @@ -0,0 +1,114 @@ +# +# -*- 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 junos 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 + +from copy import deepcopy + +from ansible.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lldp_interfaces.lldp_interfaces import ( + Lldp_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class Lldp_interfacesFacts(object): + """ The junos 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 interfaces + :param connection: the device connection + :param data: previously collected configuration as lxml ElementTree root instance + or valid xml sting + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + """ + data = get_resource_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + self._resources = data.xpath("configuration/protocols/lldp/interface") + + objs = [] + for resource in self._resources: + if resource is not None: + obj = self.render_config(self.generated_spec, resource) + if obj: + objs.append(obj) + 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 ElementTree instance of configuration object + :rtype: dictionary + :returns: The generated config + """ + config = deepcopy(spec) + config["name"] = utils.get_xml_conf_arg(conf, "name") + if utils.get_xml_conf_arg(conf, "disable", data="tag"): + config["enabled"] = False + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/ospf.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/ospf.py new file mode 100644 index 00000000..c8fa583f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf/ospf.py @@ -0,0 +1,288 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# 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 . +# + + +""" +The junos_ospfv2 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.module_utils._text import to_bytes +from ansible.module_utils.basic import missing_required_lib +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.ospf.ospf import ( + OspfArgs, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class OspfFacts(object): + """ The junos ospf fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = OspfArgs.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) + self.router_id = "" + + def get_connection(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return connection.get_configuration(filter=config_filter) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for ospf + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + + + + """ + data = self.get_connection(connection, config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/protocols/ospf") + router_id_path = data.xpath("configuration/routing-options/router-id") + if router_id_path: + self.router_id = self._get_xml_dict(router_id_path.pop()) + else: + self.router_id = "" + + objs = [] + for resource in resources: + if resource: + xml = self._get_xml_dict(resource) + obj = self.render_config(self.generated_spec, xml) + if obj: + objs.append(obj) + + facts = {} + if objs: + facts["junos_ospfv2"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + + for cfg in params["config"]: + facts["junos_ospfv2"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + 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) + ospf = conf.get("ospf") + + if ospf.get("area"): + rendered_areas = [] + areas = ospf.get("area") + + if not isinstance(areas, list): + areas = [areas] + + for area in areas: + rendered_area = {} + rendered_area["area_id"] = area.get("name") + rendered_area["interfaces"] = [] + + interfaces = area["interface"] + if not isinstance(interfaces, list): + interfaces = [interfaces] + + for interface in interfaces: + interface_dict = {} + interface_dict["name"] = interface.get("name") + interface_dict["priority"] = interface.get("priority") + interface_dict["metric"] = interface.get("metric") + interface_dict["timers"] = {} + interface_dict["timers"]["hello_interval"] = interface.get( + "hello-interval" + ) + interface_dict["timers"]["dead_interval"] = interface.get( + "dead-interval" + ) + interface_dict["timers"][ + "retransmit_interval" + ] = interface.get("retransmit-interval") + interface_dict["timers"]["transit_delay"] = interface.get( + "transit-delay" + ) + interface_dict["timers"]["poll_interval"] = interface.get( + "poll-interval" + ) + if "passive" in interface.keys(): + interface_dict["passive"] = True + if "flood-reduction" in interface.keys(): + interface_dict["flood_reduction"] = True + if "bandwidth-based-metrics" in interface.keys(): + bandwidth_metrics = interface[ + "bandwidth-based-metrics" + ].get("bandwidth") + if not isinstance(bandwidth_metrics, list): + bandwidth_metrics = [bandwidth_metrics] + interface_dict["bandwidth_based_metrics"] = [] + + for metric in bandwidth_metrics: + interface_dict["bandwidth_based_metrics"].append( + { + "metric": metric.get("metric"), + "bandwidth": metric.get("name"), + } + ) + + if "authentication" in interface.keys(): + auth = interface["authentication"] + auth_dict = {} + if auth.get("simple-password"): + auth_dict["type"] = "simple_password" + auth_dict["password"] = auth.get("simple-password") + elif auth.get("md5"): + auth_dict["type"] = {"md5": []} + md5_list = auth.get("md5") + + if not isinstance(md5_list, list): + md5_list = [md5_list] + + for md5_auth in md5_list: + auth_dict["type"]["md5"].append( + { + "key_id": md5_auth.get("name"), + "key": md5_auth.get("key"), + } + ) + interface_dict["authentication"] = auth_dict + + rendered_area["interfaces"].append(interface_dict) + + if area.get("area-range"): + area_range = area["area-range"] + if not isinstance(area_range, list): + area_range = [area_range] + rendered_area["area_range"] = [] + for a_range in area_range: + rendered_area["area_range"].append(a_range["name"]) + + if area.get("stub"): + rendered_area["stub"] = {"set": True} + if "no-summaries" in area.get("stub").keys(): + rendered_area["stub"]["no_summary"] = True + if "default-metric" in area.get("stub").keys(): + rendered_area["stub"]["default_metric"] = area[ + "stub" + ].get("default-metric") + if area.get("nssa"): + rendered_area["nssa"] = {"set": True} + if "no-summaries" in area.get("nssa").keys(): + rendered_area["nssa"]["no_summary"] = True + elif "summaries" in area.get("nssa").keys(): + rendered_area["nssa"]["no_summary"] = False + if "default-lsa" in area.get("nssa").keys(): + rendered_area["nssa"]["default-lsa"] = True + rendered_areas.append(rendered_area) + + if "no-rfc-1583" in ospf.keys(): + config["rfc1583compatibility"] = False + if ospf.get("spf-options"): + config["spf_options"] = {} + config["spf_options"]["delay"] = ospf["spf-options"].get( + "delay" + ) + config["spf_options"]["holddown"] = ospf["spf-options"].get( + "holddown" + ) + config["spf_options"]["rapid_runs"] = ospf["spf-options"].get( + "rapid-runs" + ) + config["overload"] = ospf.get("overload") + config["preference"] = ospf.get("preference") + config["external_preference"] = ospf.get("external-preference") + config["prefix_export_limit"] = ospf.get("prefix-export-limit") + config["reference_bandwidth"] = ospf.get("reference-bandwidth") + config["areas"] = rendered_areas + config["router_id"] = self.router_id["router-id"] + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/ospf_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/ospf_interfaces.py new file mode 100644 index 00000000..d971b519 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospf_interfaces/ospf_interfaces.py @@ -0,0 +1,259 @@ +# +# -*- 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 junos 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 __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from copy import deepcopy + +from ansible.module_utils._text import to_bytes +from ansible.module_utils.basic import missing_required_lib +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.ospf_interfaces.ospf_interfaces import ( + Ospf_interfacesArgs, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class Ospf_interfacesFacts(object): + """ The junos ospf_interfaces fact 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) + self.router_id = "" + + def get_connection(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return connection.get_configuration(filter=config_filter) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for ospf_interfaces + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + + + + """ + data = self.get_connection(connection, config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/protocols/ospf") + router_id_path = data.xpath("configuration/routing-options/router-id") + if router_id_path: + self.router_id = self._get_xml_dict(router_id_path.pop()) + else: + self.router_id = "" + + objs = [] + for resource in resources: + if resource: + xml = self._get_xml_dict(resource) + objs = self.render_config(self.generated_spec, xml) + + facts = {} + if objs: + facts["junos_ospf_interfaces"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + + for cfg in params["config"]: + facts["junos_ospf_interfaces"].append( + utils.remove_empties(cfg) + ) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + 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 + """ + ospf_interfaces_config = [] + ospf = conf.get("ospf") + + if ospf.get("area"): + areas = ospf.get("area") + + if not isinstance(areas, list): + areas = [areas] + + for area in areas: + rendered_area = {} + rendered_area["area_id"] = area.get("name") + rendered_area["interfaces"] = [] + + interfaces = area["interface"] + if not isinstance(interfaces, list): + interfaces = [interfaces] + for interface in interfaces: + interface_dict = {} + interface_dict["priority"] = interface.get("priority") + interface_dict["metric"] = interface.get("metric") + interface_dict["mtu"] = interface.get("mtu") + interface_dict["te_metric"] = interface.get("te-metric") + interface_dict["ipsec_sa"] = interface.get("ipsec-sa") + interface_dict["hello_interval"] = interface.get( + "hello-interval" + ) + interface_dict["dead_interval"] = interface.get( + "dead-interval" + ) + interface_dict["retransmit_interval"] = interface.get( + "retransmit-interval" + ) + interface_dict["transit_delay"] = interface.get( + "transit-delay" + ) + interface_dict["poll_interval"] = interface.get( + "poll-interval" + ) + if "passive" in interface.keys(): + interface_dict["passive"] = True + if "flood-reduction" in interface.keys(): + interface_dict["flood_reduction"] = True + if "demand-circuit" in interface.keys(): + interface_dict["demand_circuit"] = True + if "no-advertise-adjacency-segment" in interface.keys(): + interface_dict["no_advertise_adjacency_segment"] = True + if "no-eligible-backup" in interface.keys(): + interface_dict["no_eligible_backup"] = True + if "no-eligible-remote-backup" in interface.keys(): + interface_dict["no_eligible_remote_backup"] = True + if "no-interface-state-traps" in interface.keys(): + interface_dict["no_interface_state_traps"] = True + if "no-neighbor-down-notification" in interface.keys(): + interface_dict["no_neighbor_down_notification"] = True + if "node-link-protection" in interface.keys(): + interface_dict["node_link_protection"] = True + if "bandwidth-based-metrics" in interface.keys(): + bandwidth_metrics = interface[ + "bandwidth-based-metrics" + ].get("bandwidth") + if not isinstance(bandwidth_metrics, list): + bandwidth_metrics = [bandwidth_metrics] + interface_dict["bandwidth_based_metrics"] = [] + + for metric in bandwidth_metrics: + interface_dict["bandwidth_based_metrics"].append( + { + "metric": metric.get("metric"), + "bandwidth": metric.get("name"), + } + ) + + if "authentication" in interface.keys(): + auth = interface["authentication"] + auth_dict = {} + if auth.get("simple-password"): + auth_dict["simple_password"] = auth.get( + "simple-password" + ) + elif auth.get("md5"): + auth_dict["type"] = {"md5": []} + md5_list = auth.get("md5") + + if not isinstance(md5_list, list): + md5_list = [md5_list] + + for md5_auth in md5_list: + auth_dict["type"]["md5"].append( + { + "key_id": md5_auth.get("name"), + "key": md5_auth.get("key"), + } + ) + interface_dict["authentication"] = auth_dict + + rendered_area["interfaces"].append(interface_dict) + + af = {} + conf = {} + areas = {} + address_family = [] + af["afi"] = "ipv4" + areas["area_id"] = rendered_area["area_id"] + interface_dict["area"] = areas + af["processes"] = interface_dict + address_family.append(af) + conf["address_family"] = address_family + conf["name"] = interface.get("name") + conf["router_id"] = self.router_id["router-id"] + utils.remove_empties(conf) + ospf_interfaces_config.append(conf) + + return ospf_interfaces_config diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/ospfv3.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/ospfv3.py new file mode 100644 index 00000000..063d044a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/ospfv3/ospfv3.py @@ -0,0 +1,288 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# 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 . +# + + +""" +The junos_ospfv3 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.module_utils._text import to_bytes +from ansible.module_utils.basic import missing_required_lib +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.ospfv3.ospfv3 import ( + Ospfv3Args, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class Ospfv3Facts(object): + """ The junos ospfv3 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) + self.router_id = "" + + def get_connection(self, connection, config_filter): + """ + + :param connection: + :param config_filter: + :return: + """ + return connection.get_configuration(filter=config_filter) + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for ospfv3 + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + + + + + """ + data = self.get_connection(connection, config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/protocols/ospf3") + router_id_path = data.xpath("configuration/routing-options/router-id") + if router_id_path: + self.router_id = self._get_xml_dict(router_id_path.pop()) + else: + self.router_id = "" + + objs = [] + for resource in resources: + if resource: + xml = self._get_xml_dict(resource) + obj = self.render_config(self.generated_spec, xml) + if obj: + objs.append(obj) + + facts = {} + if objs: + facts["junos_ospfv3"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + + for cfg in params["config"]: + facts["junos_ospfv3"].append(utils.remove_empties(cfg)) + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts + + def _get_xml_dict(self, xml_root): + if not HAS_XMLTODICT: + self._module.fail_json(msg=missing_required_lib("xmltodict")) + + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + 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) + ospfv3 = conf.get("ospf3") + + if ospfv3.get("area"): + rendered_areas = [] + areas = ospfv3.get("area") + + if not isinstance(areas, list): + areas = [areas] + + for area in areas: + rendered_area = {} + rendered_area["area_id"] = area.get("name") + rendered_area["interfaces"] = [] + + interfaces = area["interface"] + if not isinstance(interfaces, list): + interfaces = [interfaces] + + for interface in interfaces: + interface_dict = {} + interface_dict["name"] = interface.get("name") + interface_dict["priority"] = interface.get("priority") + interface_dict["metric"] = interface.get("metric") + interface_dict["timers"] = {} + interface_dict["timers"]["hello_interval"] = interface.get( + "hello-interval" + ) + interface_dict["timers"]["dead_interval"] = interface.get( + "dead-interval" + ) + interface_dict["timers"][ + "retransmit_interval" + ] = interface.get("retransmit-interval") + interface_dict["timers"]["transit_delay"] = interface.get( + "transit-delay" + ) + interface_dict["timers"]["poll_interval"] = interface.get( + "poll-interval" + ) + if "passive" in interface.keys(): + interface_dict["passive"] = True + if "flood-reduction" in interface.keys(): + interface_dict["flood_reduction"] = True + if "bandwidth-based-metrics" in interface.keys(): + bandwidth_metrics = interface[ + "bandwidth-based-metrics" + ].get("bandwidth") + if not isinstance(bandwidth_metrics, list): + bandwidth_metrics = [bandwidth_metrics] + interface_dict["bandwidth_based_metrics"] = [] + + for metric in bandwidth_metrics: + interface_dict["bandwidth_based_metrics"].append( + { + "metric": metric.get("metric"), + "bandwidth": metric.get("name"), + } + ) + + if "authentication" in interface.keys(): + auth = interface["authentication"] + auth_dict = {} + if auth.get("simple-password"): + auth_dict["type"] = "simple_password" + auth_dict["password"] = auth.get("simple-password") + elif auth.get("md5"): + auth_dict["type"] = {"md5": []} + md5_list = auth.get("md5") + + if not isinstance(md5_list, list): + md5_list = [md5_list] + + for md5_auth in md5_list: + auth_dict["type"]["md5"].append( + { + "key_id": md5_auth.get("name"), + "key": md5_auth.get("key"), + } + ) + interface_dict["authentication"] = auth_dict + + rendered_area["interfaces"].append(interface_dict) + + if area.get("area-range"): + area_range = area["area-range"] + if not isinstance(area_range, list): + area_range = [area_range] + rendered_area["area_range"] = [] + for a_range in area_range: + rendered_area["area_range"].append(a_range["name"]) + + if area.get("stub"): + rendered_area["stub"] = {"set": True} + if "no-summaries" in area.get("stub").keys(): + rendered_area["stub"]["no_summary"] = True + if "default-metric" in area.get("stub").keys(): + rendered_area["stub"]["default_metric"] = area[ + "stub" + ].get("default-metric") + if area.get("nssa"): + rendered_area["nssa"] = {"set": True} + if "no-summaries" in area.get("nssa").keys(): + rendered_area["nssa"]["no_summary"] = True + elif "summaries" in area.get("nssa").keys(): + rendered_area["nssa"]["no_summary"] = False + if "default-lsa" in area.get("nssa").keys(): + rendered_area["nssa"]["default-lsa"] = True + rendered_areas.append(rendered_area) + + if "no-rfc-1583" in ospfv3.keys(): + config["rfc1583compatibility"] = False + if ospfv3.get("spf-options"): + config["spf_options"] = {} + config["spf_options"]["delay"] = ospfv3["spf-options"].get( + "delay" + ) + config["spf_options"]["holddown"] = ospfv3["spf-options"].get( + "holddown" + ) + config["spf_options"]["rapid_runs"] = ospfv3[ + "spf-options" + ].get("rapid-runs") + config["overload"] = ospfv3.get("overload") + config["preference"] = ospfv3.get("preference") + config["external_preference"] = ospfv3.get("external-preference") + config["prefix_export_limit"] = ospfv3.get("prefix-export-limit") + config["reference_bandwidth"] = ospfv3.get("reference-bandwidth") + config["areas"] = rendered_areas + config["router_id"] = self.router_id["router-id"] + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/static_routes.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/static_routes.py new file mode 100644 index 00000000..93dd8130 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/static_routes/static_routes.py @@ -0,0 +1,187 @@ +# +# -*- 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 junos 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 + +from copy import deepcopy + +from ansible.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.static_routes.static_routes import ( + Static_routesArgs, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False +try: + import xmltodict + + HAS_XMLTODICT = True +except ImportError: + HAS_XMLTODICT = False + + +class Static_routesFacts(object): + """ The junos 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 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 HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + if not HAS_XMLTODICT: + self._module.fail_json(msg="xmltodict is not installed.") + + if not data: + config_filter = """ + + + + + """ + data = connection.get_configuration(filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/routing-options") + vrf_resources = data.xpath("configuration/routing-instances") + resources.extend(vrf_resources) + + objs = [] + for resource in resources: + if resource is not None: + xml = self._get_xml_dict(resource) + obj = self.render_config(self.generated_spec, xml) + if obj: + objs.append(obj) + + facts = {} + if objs: + 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 _get_xml_dict(self, xml_root): + xml_dict = xmltodict.parse( + etree.tostring(xml_root), dict_constructor=dict + ) + return xml_dict + + def _create_route_dict(self, afi, route_path): + routes_dict = {"afi": afi, "routes": []} + if isinstance(route_path, dict): + route_path = [route_path] + for route in route_path: + route_dict = {} + route_dict["dest"] = route["name"] + if route.get("metric"): + route_dict["metric"] = route["metric"]["metric-value"] + route_dict["next_hop"] = [] + route_dict["next_hop"].append( + {"forward_router_address": route["next-hop"]} + ) + routes_dict["routes"].append(route_dict) + return routes_dict + + 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) + routes = [] + config["address_families"] = [] + + if conf.get("routing-options"): + if conf["routing-options"].get("rib"): + if conf["routing-options"].get("rib").get("name") == "inet6.0": + if conf["routing-options"].get("rib").get("static"): + route_path = conf["routing-options"]["rib"][ + "static" + ].get("route") + routes.append( + self._create_route_dict("ipv6", route_path) + ) + if conf["routing-options"].get("static"): + route_path = conf["routing-options"]["static"].get("route") + routes.append(self._create_route_dict("ipv4", route_path)) + + if conf.get("routing-instances"): + config["vrf"] = conf["routing-instances"]["instance"]["name"] + if ( + conf["routing-instances"] + .get("instance") + .get("routing-options") + .get("rib") + .get("name") + == config["vrf"] + ".inet6.0" + ): + if conf["routing-instances"]["instance"]["routing-options"][ + "rib" + ].get("static"): + route_path = conf["routing-instances"]["instance"][ + "routing-options" + ]["rib"]["static"].get("route") + routes.append(self._create_route_dict("ipv6", route_path)) + if ( + conf["routing-instances"] + .get("instance") + .get("routing-options") + .get("static") + ): + route_path = conf["routing-instances"]["instance"][ + "routing-options" + ]["static"].get("route") + routes.append(self._create_route_dict("ipv4", route_path)) + config["address_families"].extend(routes) + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/vlans.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/vlans.py new file mode 100644 index 00000000..e6145321 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/facts/vlans/vlans.py @@ -0,0 +1,114 @@ +# +# -*- 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 junos vlans 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.module_utils._text import to_bytes +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.vlans.vlans import ( + VlansArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.utils.utils import ( + get_resource_config, +) +from ansible.module_utils.six import string_types + +try: + from lxml import etree + + HAS_LXML = True +except ImportError: + HAS_LXML = False + + +class VlansFacts(object): + """ The junos vlans fact class + """ + + def __init__(self, module, subspec="config", options="options"): + self._module = module + self.argument_spec = VlansArgs.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 vlans + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not HAS_LXML: + self._module.fail_json(msg="lxml is not installed.") + + if not data: + config_filter = """ + + + + + """ + data = get_resource_config(connection, config_filter=config_filter) + + if isinstance(data, string_types): + data = etree.fromstring( + to_bytes(data, errors="surrogate_then_replace") + ) + + resources = data.xpath("configuration/vlans/vlan") + + objs = [] + for resource in resources: + if resource is not None: + obj = self.render_config(self.generated_spec, resource) + if obj: + objs.append(obj) + facts = {} + if objs: + facts["vlans"] = [] + params = utils.validate_config( + self.argument_spec, {"config": objs} + ) + for cfg in params["config"]: + facts["vlans"].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["name"] = utils.get_xml_conf_arg(conf, "name") + config["vlan_id"] = utils.get_xml_conf_arg(conf, "vlan-id") + config["description"] = utils.get_xml_conf_arg(conf, "description") + return utils.remove_empties(config) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py new file mode 100644 index 00000000..1d650754 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/junos.py @@ -0,0 +1,515 @@ +# +# (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 +import collections +import json +from contextlib import contextmanager +from copy import deepcopy + +from ansible.module_utils.basic import env_fallback +from ansible.module_utils.connection import Connection, ConnectionError +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + NetconfConnection, +) +from ansible.module_utils._text import to_text + +try: + from lxml.etree import Element, SubElement, tostring as xml_to_string + + HAS_LXML = True +except ImportError: + from xml.etree.ElementTree import ( + Element, + SubElement, + tostring as xml_to_string, + ) + + HAS_LXML = False + +try: + from jnpr.junos import Device + from jnpr.junos.exception import ConnectError + + HAS_PYEZ = True +except ImportError: + HAS_PYEZ = False + +ACTIONS = frozenset(["merge", "override", "replace", "update", "set"]) +JSON_ACTIONS = frozenset(["merge", "override", "update"]) +FORMATS = frozenset(["xml", "text", "json"]) +CONFIG_FORMATS = frozenset(["xml", "text", "json", "set"]) + +junos_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(default="netconf", choices=["cli", "netconf"]), +} +junos_argument_spec = { + "provider": dict( + type="dict", + options=junos_provider_spec, + removed_at_date="2022-06-01", + removed_from_collection="junipernetworks.junos", + ) +} + + +def tostring(element, encoding="UTF-8"): + if HAS_LXML: + return xml_to_string(element, encoding="unicode") + else: + return to_text(xml_to_string(element, encoding), encoding=encoding) + + +def get_provider_argspec(): + return junos_provider_spec + + +def get_connection(module): + if hasattr(module, "_junos_connection"): + return module._junos_connection + + capabilities = get_capabilities(module) + network_api = capabilities.get("network_api") + if network_api == "cliconf": + module._junos_connection = Connection(module._socket_path) + elif network_api == "netconf": + module._junos_connection = NetconfConnection(module._socket_path) + else: + module.fail_json(msg="Invalid connection type %s" % network_api) + + return module._junos_connection + + +def get_capabilities(module): + if hasattr(module, "_junos_capabilities"): + return module._junos_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._junos_capabilities = json.loads(capabilities) + return module._junos_capabilities + + +def get_device(module): + provider = module.params.get("provider") or {} + host = provider.get("host") + + kwargs = { + "port": provider.get("port") or 830, + "user": provider.get("username"), + } + + if "password" in provider: + kwargs["passwd"] = provider.get("password") + + if "ssh_keyfile" in provider: + kwargs["ssh_private_key_file"] = provider.get("ssh_keyfile") + + if module.params.get("ssh_config"): + kwargs["ssh_config"] = module.params["ssh_config"] + + if module.params.get("ssh_private_key_file"): + kwargs["ssh_private_key_file"] = module.params["ssh_private_key_file"] + + kwargs["gather_facts"] = False + + try: + device = Device(host, **kwargs) + device.open() + device.timeout = provider.get("timeout") or 10 + except ConnectError as exc: + module.fail_json("unable to connect to %s: %s" % (host, to_text(exc))) + + return device + + +def is_netconf(module): + capabilities = get_capabilities(module) + return True if capabilities.get("network_api") == "netconf" else False + + +def _validate_rollback_id(module, value): + try: + if not 0 <= int(value) <= 49: + raise ValueError + except ValueError: + module.fail_json(msg="rollback must be between 0 and 49") + + +def load_configuration( + module, candidate=None, action="merge", rollback=None, format="xml" +): + + if all((candidate is None, rollback is None)): + module.fail_json(msg="one of candidate or rollback must be specified") + + elif all((candidate is not None, rollback is not None)): + module.fail_json(msg="candidate and rollback are mutually exclusive") + + if format not in FORMATS: + module.fail_json(msg="invalid format specified") + + if format == "json" and action not in JSON_ACTIONS: + module.fail_json(msg="invalid action for format json") + elif format in ("text", "xml") and action not in ACTIONS: + module.fail_json(msg="invalid action format %s" % format) + if action == "set" and format != "text": + module.fail_json(msg="format must be text when action is set") + + conn = get_connection(module) + try: + if rollback is not None: + _validate_rollback_id(module, rollback) + obj = Element("load-configuration", {"rollback": str(rollback)}) + conn.execute_rpc(tostring(obj)) + else: + return conn.load_configuration( + config=candidate, action=action, format=format + ) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + +def get_configuration( + module, compare=False, format="xml", rollback="0", filter=None +): + if format not in CONFIG_FORMATS: + module.fail_json(msg="invalid config format specified") + + conn = get_connection(module) + try: + if compare: + xattrs = {"format": format} + _validate_rollback_id(module, rollback) + xattrs["compare"] = "rollback" + xattrs["rollback"] = str(rollback) + reply = conn.execute_rpc( + tostring(Element("get-configuration", xattrs)) + ) + else: + reply = conn.get_configuration(format=format, filter=filter) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return reply + + +def commit_configuration( + module, + confirm=False, + check=False, + comment=None, + confirm_timeout=None, + synchronize=False, + at_time=None, +): + conn = get_connection(module) + try: + if check: + reply = conn.validate() + else: + if is_netconf(module): + reply = conn.commit( + confirmed=confirm, + timeout=confirm_timeout, + comment=comment, + synchronize=synchronize, + at_time=at_time, + ) + else: + reply = conn.commit( + comment=comment, + confirmed=confirm, + at_time=at_time, + synchronize=synchronize, + ) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return reply + + +def command(module, cmd, format="text", rpc_only=False): + conn = get_connection(module) + if rpc_only: + cmd += " | display xml rpc" + try: + response = conn.command(command=cmd, format=format) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return response + + +def lock_configuration(module): + conn = get_connection(module) + try: + response = conn.lock() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return response + + +def unlock_configuration(module): + conn = get_connection(module) + try: + response = conn.unlock() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return response + + +@contextmanager +def locked_config(module): + try: + lock_configuration(module) + yield + finally: + unlock_configuration(module) + + +def discard_changes(module): + conn = get_connection(module) + try: + response = conn.discard_changes() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + return response + + +def get_diff(module, rollback="0"): + reply = get_configuration( + module, compare=True, format="text", rollback=rollback + ) + # if warning is received from device diff is empty. + if isinstance(reply, list): + return None + + output = reply.find(".//configuration-output") + if output is not None: + return to_text(output.text, encoding="latin-1").strip() + + +def load_config(module, candidate, warnings, action="merge", format="xml"): + get_connection(module) + if not candidate: + return + + if isinstance(candidate, list): + candidate = "\n".join(candidate) + + reply = load_configuration(module, candidate, action=action, format=format) + if isinstance(reply, list): + warnings.extend(reply) + + module._junos_connection.validate() + return get_diff(module) + + +def map_params_to_obj(module, param_to_xpath_map, param=None): + """ + Creates a new dictionary with key as xpath corresponding + to param and value is a list of dict with metadata and values for + the xpath. + Acceptable metadata keys: + 'value': Value of param. + 'tag_only': Value is indicated by tag only in xml hierarchy. + 'leaf_only': If operation is to be added at leaf node only. + 'value_req': If value(text) is required for leaf node. + 'is_key': If the field is key or not. + eg: Output + { + 'name': [{'value': 'ge-0/0/1'}] + 'disable': [{'value': True, tag_only': True}] + } + + :param module: + :param param_to_xpath_map: Modules params to xpath map + :return: obj + """ + if not param: + param = module.params + + obj = collections.OrderedDict() + for key, attribute in param_to_xpath_map.items(): + if key in param: + is_attribute_dict = False + + value = param[key] + if not isinstance(value, (list, tuple)): + value = [value] + + if isinstance(attribute, dict): + xpath = attribute.get("xpath") + is_attribute_dict = True + else: + xpath = attribute + + if not obj.get(xpath): + obj[xpath] = list() + + for val in value: + if is_attribute_dict: + attr = deepcopy(attribute) + del attr["xpath"] + + attr.update({"value": val}) + obj[xpath].append(attr) + else: + obj[xpath].append({"value": val}) + return obj + + +def map_obj_to_ele(module, want, top, value_map=None, param=None): + if not HAS_LXML: + module.fail_json(msg="lxml is not installed.") + + if not param: + param = module.params + + root = Element("root") + top_ele = top.split("/") + ele = SubElement(root, top_ele[0]) + + if len(top_ele) > 1: + for item in top_ele[1:-1]: + ele = SubElement(ele, item) + container = ele + state = param.get("state") + active = param.get("active") + if active: + oper = "active" + else: + oper = "inactive" + + # build xml subtree + if container.tag != top_ele[-1]: + node = SubElement(container, top_ele[-1]) + else: + node = container + + for fxpath, attributes in want.items(): + for attr in attributes: + tag_only = attr.get("tag_only", False) + leaf_only = attr.get("leaf_only", False) + value_req = attr.get("value_req", False) + is_key = attr.get("is_key", False) + parent_attrib = attr.get("parent_attrib", True) + value = attr.get("value") + field_top = attr.get("top") + + # operation 'delete' is added as element attribute + # only if it is key or leaf only node + if state == "absent" and not (is_key or leaf_only): + continue + + # convert param value to device specific value + if value_map and fxpath in value_map: + value = value_map[fxpath].get(value) + + if (value is not None) or tag_only or leaf_only: + ele = node + if field_top: + # eg: top = 'system/syslog/file' + # field_top = 'system/syslog/file/contents' + # + # test + # + # + # + ele_list = root.xpath(top + "/" + field_top) + + if not len(ele_list): + fields = field_top.split("/") + ele = node + for item in fields: + inner_ele = root.xpath(top + "/" + item) + if len(inner_ele): + ele = inner_ele[0] + else: + ele = SubElement(ele, item) + else: + ele = ele_list[0] + + if value is not None and not isinstance(value, bool): + value = to_text(value, errors="surrogate_then_replace") + + if fxpath: + tags = fxpath.split("/") + for item in tags: + ele = SubElement(ele, item) + + if tag_only: + if state == "present": + if not value: + # if value of tag_only node is false, delete the node + ele.set("delete", "delete") + + elif leaf_only: + if state == "present": + ele.set(oper, oper) + ele.text = value + else: + ele.set("delete", "delete") + # Add value of leaf node if required while deleting. + # in some cases if value is present while deleting, it + # can result in error, hence the check + if value_req: + ele.text = value + if is_key: + par = ele.getparent() + par.set("delete", "delete") + else: + ele.text = value + par = ele.getparent() + + if parent_attrib: + if state == "present": + # set replace attribute at parent node + if not par.attrib.get("replace"): + par.set("replace", "replace") + + # set active/inactive at parent node + if not par.attrib.get(oper): + par.set(oper, oper) + else: + par.set("delete", "delete") + + return root.getchildren()[0] + + +def to_param_list(module): + aggregate = module.params.get("aggregate") + if aggregate: + if isinstance(aggregate, dict): + return [aggregate] + else: + return aggregate + else: + return [module.params] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/utils.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/utils.py new file mode 100644 index 00000000..672d036b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/utils/utils.py @@ -0,0 +1,33 @@ +# +# -*- 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_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + tostring, +) + +try: + from ncclient.xml_ import new_ele, to_ele + + HAS_NCCLIENT = True +except ImportError: + HAS_NCCLIENT = False + + +def get_resource_config(connection, config_filter=None, attrib=None): + + if attrib is None: + attrib = {"inherit": "inherit"} + + get_ele = new_ele("get-configuration", attrib) + if config_filter: + get_ele.append(to_ele(config_filter)) + + return connection.execute_rpc(tostring(get_ele)) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acl_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acl_interfaces.py new file mode 100644 index 00000000..9dc55924 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acl_interfaces.py @@ -0,0 +1,364 @@ +#!/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 junos_acl_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_acl_interfaces +short_description: ACL interfaces resource module +description: +- This module manages adding and removing Access Control Lists (ACLs) from interfaces + on devices running Juniper JUNOS. +version_added: 1.0.0 +author: Daniel Mellado (@dmellado) +requirements: +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) +notes: +- This module requires the netconf system service be enabled on the device being managed. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- Tested against JunOS v18.4R1 +options: + config: + description: A dictionary of ACL options for interfaces. + type: list + elements: dict + suboptions: + name: + description: + - Name/Identifier for the interface. + type: str + access_groups: + type: list + elements: dict + description: + - Specifies ACLs attached to the interface. + suboptions: + afi: + description: + - Specifies the AFI for the ACL(s) to be configured on this interface. + type: str + choices: [ipv4, ipv6] + acls: + type: list + description: + - Specifies the ACLs for the provided AFI. + elements: dict + suboptions: + name: + description: + - Specifies the name of the IPv4/IPv4 ACL for the interface. + type: str + direction: + description: + - Specifies the direction of packets that the ACL will be applied + on. + type: str + choices: [in, out] + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the Junos device + by executing the command B(show interfaces). + - 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 + - rendered + - parsed + default: merged +""" +EXAMPLES = """ +# Using deleted + +# Before state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface with filter"; +# unit 0 { +# family inet { +# filter { +# input inbound_acl; +# output outbound_acl; +# } +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + +- name: Delete JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + - name: outbound_acl + direction: out + state: deleted + +# After state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface with filter"; +# unit 0 { +# family inet { +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + + +# Using merged + +# Before state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface without filter"; +# unit 0 { +# family inet { +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + +- name: Merge JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + - name: outbound_acl + direction: out + state: merged + +# After state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface with filter"; +# unit 0 { +# family inet { +# filter { +# input inbound_acl; +# output outbound_acl; +# } +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + + +# Using overridden + +# Before state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface without filter"; +# unit 0 { +# family inet { +# filter { +# input foo_acl; +# } +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + +- name: Override JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + - name: outbound_acl + direction: out + state: overridden + +# After state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface with filter"; +# unit 0 { +# family inet { +# filter { +# input inbound_acl; +# output outbound_acl; +# } +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + + +# Using replaced + +# Before state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface without filter"; +# unit 0 { +# family inet { +# filter { +# input foo_acl; +# output outbound_acl; +# } +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + +- name: Replace JUNOS L3 interface filter + junipernetworks.junos.junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: inbound_acl + direction: in + state: replaced + +# After state: +# ------------- +# +# admin# show interfaces +# ge-1/0/0 { +# description "L3 interface with filter"; +# unit 0 { +# family inet { +# filter { +# input inbound_acl; +# output outbound_acl; +# } +# address 100.64.0.1/10; +# address 100.64.0.2/10; +# } +# family inet6; +# } + + +""" +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: ['command 1', 'command 2', 'command 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.acl_interfaces.acl_interfaces import ( + Acl_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + module = AnsibleModule( + argument_spec=Acl_interfacesArgs.argument_spec, + required_if=required_if, + 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/junipernetworks/junos/plugins/modules/junos_acls.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acls.py new file mode 100644 index 00000000..f6ab56fe --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_acls.py @@ -0,0 +1,341 @@ +#!/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 junos_acls +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_acls +short_description: ACLs resource module +description: This module provides declarative management of acls/filters on Juniper + JUNOS devices +version_added: 1.0.0 +author: Daniel Mellado (@dmellado) +requirements: +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) +notes: +- This module requires the netconf system service be enabled on the device being managed. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- Tested against JunOS v18.4R1 +options: + config: + description: A dictionary of acls options + type: list + elements: dict + suboptions: + afi: + description: + - Protocol family to use by the acl filter + type: str + required: true + choices: + - ipv4 + - ipv6 + acls: + description: + - List of Access Control Lists (ACLs). + type: list + elements: dict + suboptions: + name: + description: + - Name to use for the acl filter + type: str + required: true + aces: + description: + - List of Access Control Entries (ACEs) for this Access Control List (ACL). + type: list + elements: dict + suboptions: + name: + description: + - Filter term name + type: str + required: true + grant: + description: + - Action to take after matching condition (allow, discard/reject) + type: str + choices: [permit, deny] + source: + type: dict + description: + - Specifies the source for the filter + suboptions: + address: + description: + - IP source address to use for the filter + type: str + prefix_list: + description: + - IP source prefix list to use for the filter + type: list + elements: dict + suboptions: + name: + description: Name of the list + 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 + range: + description: + - Match only packets in the range of port numbers + type: dict + suboptions: + start: + description: + - Specify the start of the port range + type: int + end: + description: + - Specify the end of the port range + type: int + destination: + type: dict + description: + - Specifies the destination for the filter + suboptions: + address: + description: + - Match IP destination address + type: str + prefix_list: + description: + - Match IP destination prefixes in named list + type: list + elements: dict + suboptions: + name: + description: Name of the list + type: str + port_protocol: + description: + - Specify the destination port or protocol. + type: dict + suboptions: + eq: + description: + - Match only packets 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: int + end: + description: + - Specify the end of the port range + type: int + protocol: + description: + - Specify the protocol to match. + - Refer to vendor documentation for valid values. + type: str + protocol_options: + description: All possible suboptions for the protocol chosen. + type: dict + suboptions: + icmp: + description: ICMP protocol options. + type: dict + suboptions: + 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 + 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 + net_redirect: + description: Network redirect + type: bool + net_tos_redirect: + description: Net redirect for TOS + type: bool + network_unknown: + description: Network unknown + type: bool + port_unreachable: + description: Port unreachable + 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_route_failed: + description: Source route failed + type: bool + time_exceeded: + description: All time exceeded. + type: bool + ttl_exceeded: + description: TTL exceeded + type: bool + state: + description: + - The state the configuration should be left in + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + default: merged +""" +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# +# admin# show firewall + +- name: Merge JUNOS acl + junipernetworks.junos.junos_acls: + config: + - afi: ipv4 + acls: + - name: allow_ssh_acl + aces: + - name: ssh_rule + source: + port_protocol: + eq: ssh + protocol: tcp + state: merged + +# After state: +# ------------- +# admin# show firewall +# family inet { +# filter allow_ssh_acl { +# term ssh_rule { +# from { +# protocol tcp; +# source-port ssh; +# } +# } +# } +# } + +""" +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: ['command 1', 'command 2', 'command 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.acls.acls import ( + AclsArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.acls.acls import ( + Acls, +) + + +def main(): + """ + Main entry point for module execution + + :returns: the result form module invocation + """ + module = AnsibleModule( + argument_spec=AclsArgs.argument_spec, 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/junipernetworks/junos/plugins/modules/junos_banner.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_banner.py new file mode 100644 index 00000000..099918c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_banner.py @@ -0,0 +1,201 @@ +#!/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: junos_banner +author: Ganesh Nalawade (@ganeshrn) +short_description: Manage multiline banners on Juniper JUNOS devices +description: +- This will configure both login and motd banners on network devices. It allows playbooks + to add or remote banner text from the active running configuration. +version_added: 1.0.0 +options: + banner: + description: + - Specifies which banner that should be configured on the remote device. Value + C(login) indicates system login message prior to authenticating, C(motd) is + login announcement after successful authentication. + type: str + required: true + choices: + - login + - motd + text: + description: + - The banner text that should be present in the remote device running configuration. This + argument accepts a multiline string, with no empty lines. Requires I(state=present). + type: str + state: + description: + - Specifies whether or not the configuration is present in the current devices + active running configuration. + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + default: yes +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure the login banner + junipernetworks.junos.junos_banner: + banner: login + text: | + this is my login banner + that contains a multiline + string + state: present + +- name: remove the motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: absent + +- name: deactivate the motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: present + active: false + +- name: activate the motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: present + active: true + +- name: Configure banner from file + junipernetworks.junos.junos_banner: + banner: motd + text: "{{ lookup('file', './config_partial/raw_banner.cfg') }}" + state: present +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit system login] + + message \"this is my login banner\"; +""" +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_param_values(module, obj): + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(module.params.get(key), module) + + +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"]), + active=dict(default=True, type="bool"), + ) + + argument_spec.update(junos_argument_spec) + + required_if = [("state", "present", ("text",))] + + module = AnsibleModule( + argument_spec=argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "system/login" + + param_to_xpath_map = collections.OrderedDict() + + param_to_xpath_map.update( + [ + ( + "text", + { + "xpath": "message" + if module.params["banner"] == "login" + else "announcement", + "leaf_only": True, + }, + ) + ] + ) + + validate_param_values(module, param_to_xpath_map) + + want = map_params_to_obj(module, param_to_xpath_map) + ele = map_obj_to_ele(module, want, top) + + with locked_config(module): + diff = load_config(module, tostring(ele), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_bgp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_bgp_global.py new file mode 100644 index 00000000..3f63f3a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_bgp_global.py @@ -0,0 +1,1747 @@ +#!/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 junos_bgp_global +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} + +DOCUMENTATION = """ +--- +module: junos_bgp_global +version_added: "1.3.0" +short_description: Manages BGP Global configuration on devices running Juniper JUNOS. +description: + - This module manages global bgp configuration on devices running Juniper JUNOS. +author: Rohit Thakur (@rohitthakur) +requirements: + - ncclient (>=v0.6.4) + - xmltodict (>=0.12.0) +notes: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). + - Tested against JunOS v18.4R1 +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 NX-OS device + by executing the command B(show running-config | section '^router bgp'). + - 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 BGP process configuration. + type: dict + suboptions: + as_number: + description: Specify Autonomous system number. + type: str + accept_remote_nexthop: + description: Allow import policy to specify a non-directly connected next-hop. + type: bool + add_path_display_ipv4_address: + description: Display add-path path-id in IPv4 address format. + type: bool + advertise_bgp_static: + description: Advertise bgp-static routes. + type: dict + suboptions: + set: + description: Set Advertise bgp-static routes. + type: bool + policy: + description: Specify static route advertisement policy. + type: str + advertise_external: + description: Advertise best external routes. + type: dict + suboptions: + set: + description: Set Advertise best external routes. + type: bool + conditional: + description: Route matches active route upto med-comparison rule. + type: bool + advertise_from_main_vpn_tables: + description: Advertise VPN routes from bgp.Xvpn.0 tables in master instance. + type: bool + advertise_inactive: + description: Advertise inactive routes. + type: bool + advertise_peer_as: + description: Advertise routes received from the same autonomous system. + type: bool + authentication_algorithm: + description: Specify authentication algorithm name. + type: str + choices: ["aes-128-cmac-96", "hmac-sha-1-96", "md5"] + authentication_key: + description: Specify MD5 authentication key. + type: str + authentication_key_chain: + description: Specify authentication key chain name. + type: str + bfd_liveness_detection: + description: Bidirectional Forwarding Detection (BFD) options. + type: dict + suboptions: + authentication: + description: Authentication options. + type: dict + suboptions: + algorithm: + description: Specify algorithm name. + type: str + choices: ["keyed-md5", "keyed-sha-1", "meticulous-keyed-md5", "meticulous-keyed-sha-1", "simple-password"] + key_chain: + description: Specify Key chain name. + type: str + loose_check: + description: Verify authentication only if authentication is negotiated. + type: bool + detection_time: + description: Specify Detection-time optionss. + type: dict + suboptions: + threshold: + description: Specify high detection-time triggering a trap (milliseconds). + type: int + holddown_interval: + description: Specify time to hold the session-UP notification to the client. + type: int + minimum_interval: + description: Specify minimum transmit and receive interval. + type: int + minimum_receive_interval: + description: Specify minimum receive interval. + type: int + multiplier: + description: Specify detection time multiplier. + type: int + no_adaptation: + description: Disable adaptation. + type: bool + session_mode: + description: BFD single-hop or multihop session-mode. + type: str + choices: ["automatic", "multihop", "single-hop"] + transmit_interval: + description: Transmit-interval options. + type: dict + suboptions: + minimum_interval: + description: Specify Minimum transmit interval. + type: int + threshold: + description: Specify high transmit interval triggering a trap. + type: int + version: + description: Specify BFD protocol version number. + type: str + choices: ["0", "1", "automatic"] + bgp_error_tolerance: + description: Handle BGP malformed updates softly. + type: dict + suboptions: + set: + description: Set BGP malformed updates softly. + type: bool + malformed_route_limit: + description: Maximum number of malformed routes from a peer. + type: int + malformed_update_log_interval: + description: Time used when logging malformed update. + type: int + no_malformed_route_limit: + description: Specify no malformed route limit. + type: bool + bmp: + description: Specific settings to override the routing-options settings. + type: dict + suboptions: + monitor: + description: Enable/Disable monitoring. + type: bool + route_monitoring: + description: Control route monitoring settings. + type: dict + suboptions: + none: + description: Do not send route montoring messages. + type: bool + post_policy: + description: Send post policy route montoring messages. + type: bool + post_policy_exclude_non_eligible: + description: Send post policy route montoring messages and exclude unresolved routes, etc. + type: bool + pre_policy: + description: Send pre policy route montoring messages. + type: bool + post_policy_exclude_non_feasible: + description: Send pre policy route montoring messages and exclude looped routes, etc. + type: bool + cluster_id: + description: Specify cluster identifier. + type: str + damping: + description: Enable route flap damping. + type: bool + description: + description: Specify text description. + type: str + disable: + description: Disable BGP. + type: bool + egress_te: + description: Use Egress Peering traffic engineering. + type: dict + suboptions: + backup_path: + description: The 'egress-te-backup-paths template' to use for this peer. + type: str + egress_te_backup_paths: + description: Backup-path for Egress-TE peer interface failure. + type: dict + suboptions: + template: + description: Specify Backup-path template. + type: dict + suboptions: + path_name: + description: Name of Egress-TE backup path. + type: str + ip_forward: + description: Use IP-forward backup path for Egress TE. + type: dict + suboptions: + set: + description: Set use IP-forward backup path for Egress TE. + type: bool + rti_name: + description: Routing-instance to use as IP forward backup-path. + type: str + peer_addr: + description: Specify address of BGP peer to use as backup next-hop. + type: str + remote_nexthop: + description: Specify address of remote-nexthop to use as backup path. + type: str + egress_te_set_segment: + description: Configure BGP-Peer-Set segment. + type: dict + suboptions: + name: + description: The BGP-Peer-Set segment name. + type: str + label: + description: Backup segment label value from static label pool. + type: int + egress_te_backup_segment_label: + description: BGP-Peer-Set SID label value from static label pool. + type: int + egress_te_sid_stats: + description: Create BGP-Peer-SID sensor. + type: bool + enforce_first_as: + description: Enforce neighbor AS is the first AS in AS-PATH attribute (EBGP). + type: bool + export: + description: Specify export policy. + type: str + forwarding_context: + description: Specify routing-instance used for data-forwarding and transport-session. + type: str + graceful_restart: + description: BGP graceful restart options. + type: dict + suboptions: + set: + description: Set BGP graceful restart options. + type: bool + disable: + description: Disable graceful restart. + type: bool + dont_help_shared_fate_bfd_down: + description: Honor BFD-Down(C=0) if GR-restart not in progress. + type: bool + forwarding_state_bit: + description: Control forwarding-state flag negotiation. + type: dict + suboptions: + as_rr_client: + description: As for a route reflector client. + type: bool + from_fib: + description: Always use state of associated FIB(s). + type: bool + long_lived: + description: Long-lived graceful restart options. + type: dict + suboptions: + advertise_to_non_llgr_neighbor: + description: Advertise stale routes to non-LLGR neighbors. + type: dict + suboptions: + set: + description: Set Advertise stale routes to non-LLGR neighbors. + type: bool + omit_no_export: + description: Set Advertise stale routes to non-LLGR neighbors. + type: bool + receiver_disable: + description: Disable receiver (helper) functionality. + type: bool + restart_time: + description: Restart time used when negotiating with a peer. + type: int + stale_routes_time: + description: Maximum time for which stale routes are kept. + type: int + hold_time: + description: Specify hold time used when negotiating with a peer. + type: int + holddown_all_stale_labels: + description: Hold all BGP stale-labels, facilating make-before-break for new label advertisements. + type: bool + idle_after_switch_over: + description: Stop peer session from coming up after nonstop-routing switch-over. + type: dict + suboptions: + timeout: + description: Specify timeout value, in seconds, for starting peer after switch over. + type: int + forever: + description: Idle the peer until the user intervenes. + type: bool + import: + description: Specify import policy. + type: str + include_mp_next_hop: + description: Include NEXT-HOP attribute in multiprotocol updates. + type: bool + ipsec_sa: + description: Specify IPSec SA name. + type: str + keep: + description: Specify how to retain routes in the routing table. + type: str + choices: ["all", "none"] + local_address: + description: Specify Address of local end of BGP session. + type: str + local_as: + description: Local autonomous system number. + type: dict + suboptions: + set: + description: Set local autonomous system number. + type: bool + as_num: + description: Autonomous system number in plain number or (asdot notation) format. + type: str + alias: + description: Treat this AS as an alias to the system AS. + type: bool + loops: + description: Maximum number of times this AS can be in an AS path. + type: int + no_prepend_global_as: + description: Maximum number of times this AS can be in an AS path. + type: bool + private: + description: Hide this local AS in paths learned from this peering. + type: bool + local_interface: + description: Specify Local interface for IPv6 link local EBGP peering. + type: str + local_preference: + description: Specify value of LOCAL_PREF path attribute. + type: str + log_updown: + description: Enable log a message for peer state transitions. + type: bool + metric_out: + description: Specify route metric sent in MED. + type: dict + suboptions: + metric_value: + description: Specify metric value. + type: int + igp: + description: Track the IGP metric. + type: dict + suboptions: + set: + description: Set track the IGP metric. + type: bool + metric_offset: + description: Specify metric offset for MED. + type: int + delay_med_update: + description: Delay updating MED when IGP metric increases. + type: bool + minimum_igp: + description: Track the minimum IGP metric. + type: dict + suboptions: + set: + description: Set track the minimum IGP metric. + type: bool + metric_offset: + description: Specify metric offset for MED. + type: int + mtu_discovery: + description: Enable TCP path MTU discovery. + type: bool + multihop: + description: Configure an EBGP multihop session. + type: dict + suboptions: + set: + description: Set an EBGP multihop session. + type: bool + no_nexthop_change: + description: Do not change next hop to self in advertisements. + type: bool + ttl: + description: TTL value for the session. + type: int + multipath: + description: Allow load sharing among multiple BGP paths. + type: dict + suboptions: + set: + description: Set allow load sharing among multiple BGP paths. + type: bool + disable: + description: Disable Multipath. + type: bool + multiple_as: + description: Disable Multipath. + type: bool + multipath_build_priority: + description: Configure the multipath build priority. + type: str + choices: ["low", "medium"] + no_advertise_peer_as: + description: Allows to not advertise routes received from the same autonomous system. + type: bool + no_aggregator_id: + description: Set router ID in aggregator path attribute to 0. + type: bool + no_client_reflect: + description: Disable intracluster route redistribution. + type: bool + no_precision_timers: + description: Specify not to use precision timers for scheduling keepalives. + type: bool + out_delay: + description: Specify how long before exporting routes from routing table. + type: int + outbound_route_filter: + description: Dynamically negotiated cooperative route filtering. + type: dict + suboptions: + bgp_orf_cisco_mode: + description: Using BGP ORF capability code 130 and Prefix ORF type 128. + type: bool + prefix_based: + description: Prefix-based outbound route filtering. + type: dict + suboptions: + set: + description: Set prefix-based outbound route filtering. + type: bool + accept: + description: Honor Prefix-based ORFs from remote peers. + type: dict + suboptions: + set: + description: Set honor Prefix-based ORFs from remote peers. + type: bool + inet: + description: Honor IPv4 prefix filters. + type: bool + inet6: + description: Honor IPv6 prefix filters. + type: bool + output_queue_priority: + description: BGP output queue priority scheduler for updates. + type: dict + suboptions: + defaults: + description: Map policy's priority class and BGP output-queue. + type: dict + suboptions: + high: + description: Assign the 'high' priority class to this output-queue. + type: dict + suboptions: + expedited: + description: Expedited queue; highest priority. + type: bool + priority: + description: Specify output queue priorit. + type: bool + low: + description: Assign the 'low' priority class to this output-queue. + type: dict + suboptions: + expedited: + description: Expedited queue; highest priority. + type: bool + priority: + description: Specify output queue priorit. + type: bool + medium: + description: Assign the 'medium' priority class to this output-queue. + type: dict + suboptions: + expedited: + description: Expedited queue; highest priority. + type: bool + priority: + description: Specify output queue priorit. + type: bool + expedited: + description: Expedited queue; highest priority. + type: dict + suboptions: + set: + description: Set expedited queue; highest priority. + type: bool + update_tokens: + description: Specify Number of tokens. + type: int + priority: + description: Output queue priority; higher is better. + type: int + passive: + description: Specify to not send open messages to a peer. + type: bool + path_selection: + description: Configure path selection strategy. + type: dict + suboptions: + always_compare_med: + description: Compare MED on paths from different AS. + type: bool + as_path_ignore: + description: Ignore AS path comparison during path selection. + type: bool + cisco_non_deterministic: + description: Use Cisco IOS nondeterministic path selection algorithm. + type: bool + external_router_id: + description: Compare router ID on BGP externals. + type: bool + l2vpn_use_bgp_rules: + description: Use standard BGP rules during L2VPN path selection. + type: bool + med_plus_igp: + description: Add IGP cost to next-hop to MED before comparing MED values. + type: dict + suboptions: + igp_multiplier: + description: Specify multiplier for IGP cost to next-hop. + type: int + med_multiplier: + description: Specify Multiplier for MED. + type: int + peer_as: + description: Specify Autonomous system number in plain number or 'higher 16bits'.'Lower 16 bits' format. + type: str + precision_timers: + description: Use precision timers for scheduling keepalives. + type: bool + preference: + description: Specify preference value. + type: str + remove_private: + description: Remove well-known private AS numbers. + type: dict + suboptions: + set: + description: Remove well-known private AS numbers. + type: bool + all: + description: Remove all private AS numbers and do not stop at the first public AS number. + type: bool + replace: + description: Specify private AS replacement. + type: dict + suboptions: + set: + description: Replace private AS numbers with the BGP Group's local AS number. + type: bool + nearest: + description: Use closest public AS number to replace a private AS number. + type: bool + no_peer_loop_check: + description: Remove peer loop-check. + type: bool + rfc6514_compliant_safi129: + description: Specify Compliance with RFC6514 SAFI129 format. + type: bool + route_server_client: + description: Enable route server client behavior. + type: bool + send_addpath_optimization: + description: Enable BGP addpath advertisement optimization. + type: bool + snmp_options: + description: Customize SNMP behaviors specifically for BGP MIBs. + type: dict + suboptions: + backward_traps_only_from_established: + description: Limit traps for backward transitions to only those moving from Established state. + type: bool + emit_inet_address_length_in_oid: + description: Emit Length in OID for InetAddress MIB type. + type: bool + sr_preference_override: + description: Replace received segment routing traffic engineering preference value with override value. + type: str + stale_labels_holddown_period: + description: Specify duration (sec) MPLS labels allocated by BGP are kept after they go stale. + type: int + tcp_aggressive_transmission: + description: Enable aggressive transmission of pure TCP ACKs and retransmissions. + type: bool + tcp_mss: + description: Specify maximum TCP segment size. + type: int + traceoptions: + description: Configure trace options for BGP. + type: dict + suboptions: + file: + description: Specify trace file options. + type: dict + suboptions: + file_name: + description: Specify name of file in which to write trace information. + type: str + files: + description: Specify maximum number of trace files. + type: int + no_world_readable: + description: Don't allow any user to read the log file. + type: bool + world_readable: + description: Allow any user to read the log file. + type: bool + size: + description: Specify maximum trace file size. + type: int + flag: + description: Specify tracing parameters. + type: dict + suboptions: + byte_as: + description: Specify trace 4 byte AS events. + type: dict + suboptions: + set: + description: Set trace 4 byte AS events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + add_path: + description: Specify trace add-path events. + type: dict + suboptions: + set: + description: Set trace add-path events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + all: + description: Specify to trace everything. + type: dict + suboptions: + set: + description: Set Trace everything. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + bfd: + description: Trace BFD events. + type: dict + suboptions: + set: + description: Set BFD events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + damping: + description: Trace BGP damping information. + type: dict + suboptions: + set: + description: Set Trace BGP damping information. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + filter: + description: Filter to apply to this flag. + type: dict + suboptions: + set: + description: Set filter to apply to this flag. + type: bool + match_on_prefix: + description: Specify filter based on prefix. + type: bool + policy: + description: Specify filter policy. + type: str + egress_te: + description: Specify Egress Peering Traffic-Engineering events. + type: dict + suboptions: + set: + description: Set Egress Peering Traffic-Engineering events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + general: + description: Trace general events. + type: dict + suboptions: + set: + description: Set trace general events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + graceful_restart: + description: Trace Graceful Restart events. + type: dict + suboptions: + set: + description: Set Trace Graceful Restart events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + keepalive: + description: Trace BGP keepalive packets. + type: dict + suboptions: + set: + description: Set Trace BGP keepalive packets. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + normal: + description: Trace normal events. + type: dict + suboptions: + set: + description: Set Trace normal events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + nsr_synchronization: + description: Trace NSR synchronization events. + type: dict + suboptions: + set: + description: Set Trace NSR synchronization events. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + open: + description: Trace BGP open packets. + type: dict + suboptions: + set: + description: Set Trace BGP open packets. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + packets: + description: Trace all BGP protocol packets. + type: dict + suboptions: + set: + description: Set Trace all BGP protocol packets. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + policy: + description: Trace policy processing. + type: dict + suboptions: + set: + description: Set Trace policy processing. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + refresh: + description: Trace BGP refresh packets. + type: dict + suboptions: + set: + description: Set Trace BGP refresh packets. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + route: + description: Trace routing information. + type: dict + suboptions: + set: + description: Set Trace routing information. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + filter: + description: Filter to apply to this flag. + type: dict + suboptions: + set: + description: Set filter to apply to this flag. + type: bool + match_on_prefix: + description: Specify filter based on prefix. + type: bool + policy: + description: Specify filter policy. + type: str + state: + description: Trace state transitions. + type: dict + suboptions: + set: + description: Set Trace state transitions. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + thread_update_io: + description: Trace threaded update I/O processing. + type: dict + suboptions: + set: + description: Set Trace threaded update I/O processing. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + thread_io: + description: Trace threaded I/O processing. + type: dict + suboptions: + set: + description: Set Trace threaded I/O processing. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + timer: + description: Trace routing protocol timer processing. + type: dict + suboptions: + set: + description: Set Trace routing protocol timer processing. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + update: + description: Trace BGP update packets. + type: dict + suboptions: + set: + description: Trace BGP update packets. + type: bool + detail: + description: Trace detailed information. + type: bool + disable: + description: Disable this trace flag. + type: bool + receive: + description: Trace received packets. + type: bool + send: + description: Trace transmitted packets. + type: bool + traffic_statistics_labeled_path: + description: Collect periodic ingress labeled statistics for BGP label-switched paths. + type: dict + suboptions: + file: + description: Specify statistics file options. + type: dict + suboptions: + file_name: + description: Specify name of file in which to write trace information. + type: str + files: + description: Specify maximum number of trace files. + type: int + no_world_readable: + description: Don't allow any user to read the log file. + type: bool + world_readable: + description: Allow any user to read the log file. + type: bool + size: + description: Specify maximum trace file size. + type: int + interval: + description: Specify time interval to collect statistics. + type: int + ttl: + description: Specify TTL value for the single-hop peer. + type: int + unconfigured_peer_graceful_restart: + description: Specify BGP unconfigured peer graceful restart options. + type: bool + vpn_apply_export: + description: Apply BGP export policy when exporting VPN routes. + type: bool + state: + description: + - The state the configuration should be left in. + type: str + choices: + - purged + - merged + - replaced + - deleted + - gathered + - parsed + - rendered + default: merged +""" +EXAMPLES = """ +# Using merged +# +# Before state +# ------------ +# +# admin# show protocols bgp + +- name: Merge Junos BGP interfaces config + junipernetworks.junos.junos_bgp_global: + config: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_bgp_static: + policy: "static-to-bgp" + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: 2 + state: merged + +# After state +# ----------- +# +# admin# show protocols bgp +# precision-timers; +# advertise-from-main-vpn-tables; +# holddown-all-stale-labels; +# description "This is configured with Junos_bgp resource module"; +# accept-remote-nexthop; +# preference 2; +# hold-time 5; +# advertise-inactive; +# no-advertise-peer-as; +# no-aggregator-id; +# out-delay 10; +# log-updown; +# damping; +# bgp-error-tolerance { +# malformed-route-limit 20000000; +# } +# authentication-algorithm md5; +# no-client-reflect; +# include-mp-next-hop; +# bmp { +# monitor enable; +# } +# advertise-bgp-static { +# policy static-to-bgp; +# } +# add-path-display-ipv4-address; +# egress-te-sid-stats; + + +# Using replaced +# +# Before state +# ------------ +# +# admin# show protocols bgp +# precision-timers; +# advertise-from-main-vpn-tables; +# holddown-all-stale-labels; +# description "This is configured with Junos_bgp resource module"; +# accept-remote-nexthop; +# preference 2; +# hold-time 5; +# advertise-inactive; +# no-advertise-peer-as; +# no-aggregator-id; +# out-delay 10; +# log-updown; +# damping; +# bgp-error-tolerance { +# malformed-route-limit 20000000; +# } +# authentication-algorithm md5; +# no-client-reflect; +# include-mp-next-hop; +# bmp { +# monitor enable; +# } +# advertise-bgp-static { +# policy static-to-bgp; +# } +# add-path-display-ipv4-address; +# egress-te-sid-stats; + +- name: Replace Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + advertise_bgp_static: + policy: "static-to-bgp" + advertise_inactive: true + authentication_algorithm: "md5" + bfd_liveness_detection: + minimum_receive_interval: 8 + multiplier: 30 + no_adaptation: true + transmit_interval: + minimum_interval: 4 + version: "automatic" + bgp_error_tolerance: + malformed_route_limit: 40000000 + description: "This is configured with Junos_bgp resource module replace" + egress_te_sid_stats: true + hold_time: 5 + out_delay: 10 + preference: "2" + state: replaced + +# After state +# ----------- +# +# admin# show protocols bgp +# description "This is configured with Junos_bgp resource module replace"; +# preference 2; +# hold-time 5; +# advertise-inactive; +# out-delay 10; +# bgp-error-tolerance { +# malformed-route-limit 40000000; +# } +# authentication-algorithm md5; +# advertise-bgp-static { +# policy static-to-bgp; +# } +# bfd-liveness-detection { +# version automatic; +# minimum-receive-interval 8; +# multiplier 30; +# no-adaptation; +# transmit-interval { +# minimum-interval 4; +# } +# } +# egress-te-sid-stats; + + +# +# Using deleted +# +# Before state +# ------------ +# +# admin# show protocols bgp +# description "This is configured with Junos_bgp resource module replace"; +# preference 2; +# hold-time 5; +# advertise-inactive; +# out-delay 10; +# bgp-error-tolerance { +# malformed-route-limit 40000000; +# } +# authentication-algorithm md5; +# advertise-bgp-static { +# policy static-to-bgp; +# } +# bfd-liveness-detection { +# version automatic; +# minimum-receive-interval 8; +# multiplier 30; +# no-adaptation; +# transmit-interval { +# minimum-interval 4; +# } +# } +# egress-te-sid-stats; + +- name: Delete Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + state: deleted + +# After state +# ----------- + + +# admin# show protocols bgp +# Using gathered +# +# Before state +# ------------ +# +# admin# show protocols bgp +# description "This is configured with Junos_bgp resource module replace"; +# preference 2; +# hold-time 5; +# advertise-inactive; +# out-delay 10; +# bgp-error-tolerance { +# malformed-route-limit 40000000; +# } +# authentication-algorithm md5; +# advertise-bgp-static { +# policy static-to-bgp; +# } +# bfd-liveness-detection { +# version automatic; +# minimum-receive-interval 8; +# multiplier 30; +# no-adaptation; +# transmit-interval { +# minimum-interval 4; +# } +# } +# egress-te-sid-stats; + +- name: Gather Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + state: gathered +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# "gathered": { +# "advertise_bgp_static": { +# "policy": "static-to-bgp" +# }, +# "advertise_inactive": true, +# "authentication_algorithm": "md5", +# "bfd_liveness_detection": { +# "minimum_receive_interval": 8, +# "multiplier": 30, +# "no_adaptation": true, +# "transmit_interval": { +# "minimum_interval": 4 +# }, +# "version": "automatic" +# }, +# "bgp_error_tolerance": { +# "malformed_route_limit": 40000000 +# }, +# "description": "This is configured with Junos_bgp resource module replace", +# "egress_te_sid_stats": true, +# "hold_time": 5, +# "out_delay": 10, +# "preference": "2" +# } +# + +# +# Using purged +# +# Before state +# ------------ +# +# admin# show protocols bgp +# description "This is configured with Junos_bgp resource module replace"; +# preference 2; +# hold-time 5; +# advertise-inactive; +# out-delay 10; +# bgp-error-tolerance { +# malformed-route-limit 40000000; +# } +# authentication-algorithm md5; +# advertise-bgp-static { +# policy static-to-bgp; +# } +# bfd-liveness-detection { +# version automatic; +# minimum-receive-interval 8; +# multiplier 30; +# no-adaptation; +# transmit-interval { +# minimum-interval 4; +# } +# } +# egress-te-sid-stats; + +- name: Purge Junos BGP global config + junipernetworks.junos.junos_bgp_global: + config: + state: purged + +# After state +# ---------- + +# Using rendered +# +# +- name: Render the commands for provided configuration + junipernetworks.junos.junos_bgp_global: + config: + authentication_algorithm: "md5" + bfd_liveness_detection: + minimum_receive_interval: 4 + multiplier: 10 + no_adaptation: true + transmit_interval: + minimum_interval: 2 + version: "automatic" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + state: rendered + +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "rendered": " +# +# +# +# +# md5 +# This is configured with Junos_bgp resource module +# 5 +# +# +# 2 +# +# 4 +# 10 +# +# automatic +# +# +# 20000000 +# +# +# enable +# +# +# " +# +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# 18.4R1-S2.4 +# +# +# +# +# +# This is configured with Junos_bgp resource module +# +# 2 +# 5 +# +# +# +# 10 +# +# +# +# 20000000 +# +# md5 +# +# +# +# +# disable +# +# +# +# +# +# static-to-bgp +# +# +# +# automatic +# 4 +# 10 +# +# +# 2 +# +# +# 300000 +# +# +# +# +# internal +# 8 +# +# +# external +# 9 +# +# +# inboun +# internal +# +# +# ibgp +# internal +# 10.2.2.2 +# static-to-bgp +# +# 10.1.1.1 +# +# +# +# +# +# 0.0.0.100 +# +# 200 +# +# +# so-0/0/0.0 +# 5 +# 3 +# +# +# +# +# +# +# +# 172.16.17.0/24 +# +# +# +# 10.200.16.75 +# +# 65432 +# +# +# +# + + +- name: Parsed the device configuration to get output commands + junipernetworks.junos.junos_bgp_global: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "parsed": { +# "accept_remote_nexthop": true, +# "add_path_display_ipv4_address": true, +# "advertise_bgp_static": { +# "policy": "static-to-bgp" +# }, +# "advertise_from_main_vpn_tables": true, +# "advertise_inactive": true, +# "authentication_algorithm": "md5", +# "bfd_liveness_detection": { +# "detection_time": { +# "threshold": 300000 +# }, +# "minimum_receive_interval": 4, +# "multiplier": 10, +# "no_adaptation": true, +# "transmit_interval": { +# "minimum_interval": 2 +# }, +# "version": "automatic" +# }, +# "bgp_error_tolerance": { +# "malformed_route_limit": 20000000 +# }, +# "bmp": { +# "monitor": false, +# "route_monitoring": { +# "none": true +# } +# }, +# "damping": true, +# "description": "This is configured with Junos_bgp resource module", +# "egress_te_sid_stats": true, +# "hold_time": 5, +# "holddown_all_stale_labels": true, +# "include_mp_next_hop": true, +# "log_updown": true, +# "no_advertise_peer_as": true, +# "no_aggregator_id": true, +# "no_client_reflect": true, +# "out_delay": 10, +# "precision_timers": true, +# "preference": "2" +# } +# + +""" +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: [' + + + + + md5 + This is configured with Junos_bgp resource module + 5 + + + 2 + + 4 + 10 + + automatic + + + 20000000 + + + enable + + + ', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.bgp_global.bgp_global import ( + Bgp_globalArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.bgp_global.bgp_global import ( + Bgp_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",)), + ] + + module = AnsibleModule( + argument_spec=Bgp_globalArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Bgp_global(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py new file mode 100644 index 00000000..60bf46cb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_command.py @@ -0,0 +1,489 @@ +#!/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: junos_command +author: Peter Sprygada (@privateip) +short_description: Run arbitrary commands on an Juniper JUNOS device +description: +- Sends an arbitrary set of commands to an JUNOS 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. +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +options: + commands: + description: + - The commands to send to the remote junos 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 I(retries) has been exceeded. + type: list + elements: str + rpcs: + description: + - The C(rpcs) argument accepts a list of RPCs to be executed over a netconf session + and the results from the RPC execution is return to the playbook via the modules + results dictionary. + type: list + elements: str + wait_for: + description: + - Specifies what to evaluate from the output of the command and what conditionals + to apply. This argument will cause the task to wait for a particular conditional + to be true before moving forward. If the conditional is not true by the configured + retries, the task fails. See examples. + type: list + elements: str + aliases: + - waitfor + 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 I(wait_for) must be satisfied. If + the value is set to C(any) then only one of the values must be satisfied. + type: str + default: all + choices: + - any + - all + retries: + description: + - Specifies the number of retries a command should be tried before it is considered + failed. The command is run on the target device every retry and evaluated against + the I(wait_for) conditionals. + type: int + default: 10 + interval: + description: + - Configures the interval in seconds to wait between retries of the command. If + the command does not pass the specified conditional, the interval indicates + how to long to wait before trying the command again. + type: int + default: 1 + display: + description: + - Encoding scheme to use when serializing output from the device. This handles + how to properly understand the output and apply the conditionals path to the + result set. For I(rpcs) argument default display is C(xml) and for I(commands) + argument default display is C(text). Value C(set) is applicable only for fetching + configuration from device. + type: str + aliases: + - format + - output + choices: + - text + - json + - xml + - set +requirements: +- jxmlease +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(network_cli) connections and with C(local) connections + for legacy playbooks. +""" + +EXAMPLES = """ +- name: run show version on remote devices + junipernetworks.junos.junos_command: + commands: show version + +- name: run show version and check to see if output contains Juniper + junipernetworks.junos.junos_command: + commands: show version + wait_for: result[0] contains Juniper + +- name: run multiple commands on remote nodes + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces + +- name: run multiple commands and evaluate the output + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces + wait_for: + - result[0] contains Juniper + - result[1] contains Loopback0 + +- name: run commands and specify the output format + junipernetworks.junos.junos_command: + commands: show version + display: json + +- name: run rpc on the remote device + junipernetworks.junos.junos_command: + commands: show configuration + display: set + +- name: run rpc on the remote device + junipernetworks.junos.junos_command: + rpcs: get-software-information +""" + +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: [['...', '...'], ['...'], ['...']] +output: + description: The set of transformed xml to json format from the commands responses + returned: If the I(display) is in C(xml) format. + type: list + sample: ['...', '...'] +failed_conditions: + description: The list of conditionals that have failed + returned: failed + type: list + sample: ['...', '...'] +""" +import re +import shlex +import time + +from ansible.module_utils._text import to_text +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.connection import ConnectionError +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + exec_rpc, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + get_configuration, + get_connection, + get_capabilities, + tostring, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import ( + Conditional, + FailedConditionalError, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_lines, +) +from ansible.module_utils.six import iteritems + + +try: + from lxml.etree import Element, SubElement +except ImportError: + from xml.etree.ElementTree import Element, SubElement + +try: + import jxmlease + + HAS_JXMLEASE = True +except ImportError: + HAS_JXMLEASE = False + +USE_PERSISTENT_CONNECTION = True + + +def rpc(module, items): + + responses = list() + for item in items: + name = item["name"] + xattrs = item["xattrs"] + fetch_config = False + + args = item.get("args") + text = item.get("text") + + name = str(name).replace("_", "-") + + if all((module.check_mode, not name.startswith("get"))): + module.fail_json(msg="invalid rpc for running in check_mode") + + if ( + name == "command" + and text == "show configuration" + or name == "get-configuration" + ): + fetch_config = True + + element = Element(name, xattrs) + + if text: + element.text = text + + elif args: + for key, value in iteritems(args): + key = str(key).replace("_", "-") + if isinstance(value, list): + for item in value: + child = SubElement(element, key) + if item is not True: + child.text = item + else: + child = SubElement(element, key) + if value is not True: + child.text = value + if fetch_config: + reply = get_configuration(module, format=xattrs["format"]) + else: + reply = exec_rpc(module, tostring(element), ignore_warning=False) + + if xattrs["format"] == "text": + if fetch_config: + data = reply.find(".//configuration-text") + else: + if text and text.startswith("show configuration"): + data = reply.find(".//configuration-output") + else: + data = reply.find(".//output") + + if data is None: + module.fail_json(msg=tostring(reply)) + + responses.append(data.text.strip()) + + elif xattrs["format"] == "json": + responses.append(module.from_json(reply.text.strip())) + + elif xattrs["format"] == "set": + data = reply.find(".//configuration-set") + if data is None: + module.fail_json( + msg="Display format 'set' is not supported by remote device." + ) + responses.append(data.text.strip()) + + else: + responses.append(tostring(reply)) + + return responses + + +def split(value): + lex = shlex.shlex(value) + lex.quotes = '"' + lex.whitespace_split = True + lex.commenters = "" + return list(lex) + + +def parse_rpcs(module): + items = list() + + for rpc in module.params["rpcs"] or list(): + parts = shlex.split(rpc) + + name = parts.pop(0) + args = dict() + + for item in parts: + key, value = item.split("=") + if str(value).upper() in ["TRUE", "FALSE"]: + args[key] = bool(value) + elif re.match(r"^[0-9]+$", value): + args[key] = int(value) + else: + args[key] = str(value) + + display = module.params["display"] or "xml" + + if display == "set" and rpc != "get-configuration": + module.fail_json( + msg="Invalid display option '%s' given for rpc '%s'" + % ("set", name) + ) + + xattrs = {"format": display} + items.append({"name": name, "args": args, "xattrs": xattrs}) + + return items + + +def parse_commands(module, warnings): + items = list() + + for command in module.params["commands"] or list(): + if module.check_mode and not command.startswith("show"): + warnings.append( + "Only show commands are supported when using check_mode, not " + "executing %s" % command + ) + continue + + parts = command.split("|") + text = parts[0] + + display = module.params["display"] or "text" + + if "| display json" in command: + display = "json" + + elif "| display xml" in command: + display = "xml" + + if display == "set" or "| display set" in command: + if command.startswith("show configuration"): + display = "set" + else: + module.fail_json( + msg="Invalid display option '%s' given for command '%s'" + % ("set", command) + ) + + xattrs = {"format": display} + items.append({"name": "command", "xattrs": xattrs, "text": text}) + + return items + + +def main(): + """entry point for module execution + """ + argument_spec = dict( + commands=dict(type="list", elements="str"), + rpcs=dict(type="list", elements="str"), + display=dict( + choices=["text", "json", "xml", "set"], + aliases=["format", "output"], + ), + 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(junos_argument_spec) + + required_one_of = [("commands", "rpcs")] + + module = AnsibleModule( + argument_spec=argument_spec, + required_one_of=required_one_of, + supports_check_mode=True, + ) + + warnings = list() + conn = get_connection(module) + capabilities = get_capabilities(module) + + if capabilities.get("network_api") == "cliconf": + if any( + ( + module.params["wait_for"], + module.params["match"], + module.params["rpcs"], + ) + ): + module.warn( + "arguments wait_for, match, rpcs are not supported when using transport=cli" + ) + commands = module.params["commands"] + + output = list() + display = module.params["display"] + for cmd in commands: + # if display format is not mentioned in command, add the display format + # from the modules params + if ("display json" not in cmd) and ("display xml" not in cmd): + if display and display != "text": + cmd += " | display {0}".format(display) + try: + output.append(conn.get(command=cmd)) + except ConnectionError as exc: + module.fail_json( + msg=to_text(exc, errors="surrogate_then_replace") + ) + + lines = [out.split("\n") for out in output] + result = {"changed": False, "stdout": output, "stdout_lines": lines} + module.exit_json(**result) + + items = list() + items.extend(parse_commands(module, warnings)) + items.extend(parse_rpcs(module)) + + wait_for = module.params["wait_for"] or list() + conditionals = [Conditional(c) for c in wait_for] + + retries = module.params["retries"] + interval = module.params["interval"] + match = module.params["match"] + + while retries > 0: + responses = rpc(module, items) + transformed = list() + output = list() + for item, resp in zip(items, responses): + if item["xattrs"]["format"] == "xml": + if not HAS_JXMLEASE: + module.fail_json( + msg="jxmlease is required but does not appear to be installed. " + "It can be installed using `pip install jxmlease`" + ) + + try: + json_resp = jxmlease.parse(resp) + transformed.append(json_resp) + output.append(json_resp) + except Exception: + raise ValueError(resp) + else: + transformed.append(resp) + + for item in list(conditionals): + try: + if item(transformed): + if match == "any": + conditionals = list() + break + conditionals.remove(item) + except FailedConditionalError: + pass + + 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 = { + "changed": False, + "warnings": warnings, + "stdout": responses, + "stdout_lines": list(to_lines(responses)), + } + + if output: + result["output"] = output + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py new file mode 100644 index 00000000..b97ee716 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_config.py @@ -0,0 +1,502 @@ +#!/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: junos_config +author: Peter Sprygada (@privateip) +short_description: Manage configuration on devices running Juniper JUNOS +description: +- This module provides an implementation for working with the active configuration + running on Juniper JUNOS devices. It provides a set of arguments for loading configuration, + performing rollback operations and zeroing the active configuration on the device. +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +options: + lines: + description: + - This argument takes a list of C(set) or C(delete) configuration lines to push + into the remote device. Each line must start with either C(set) or C(delete). This + argument is mutually exclusive with the I(src) argument. + type: list + aliases: + - commands + elements: str + src: + description: + - The I(src) argument provides a path to the configuration file to load into the + remote system. The path can either be a full system path to the configuration + file if the value starts with / or relative to the root of the implemented role + or playbook. This argument is mutually exclusive with the I(lines) argument. + type: path + src_format: + description: + - The I(src_format) argument specifies the format of the configuration found int + I(src). If the I(src_format) argument is not provided, the module will attempt + to determine the format of the configuration file specified in I(src). + type: str + choices: + - xml + - set + - text + - json + rollback: + description: + - The C(rollback) argument instructs the module to rollback the current configuration + to the identifier specified in the argument. If the specified rollback identifier + does not exist on the remote device, the module will fail. To rollback to the + most recent commit, set the C(rollback) argument to 0. + type: int + zeroize: + description: + - The C(zeroize) argument is used to completely sanitize the remote device configuration + back to initial defaults. This argument will effectively remove all current + configuration statements on the remote device. + type: bool + confirm: + description: + - The C(confirm) argument will configure a time out value in minutes for the commit + to be confirmed before it is automatically rolled back. If the C(confirm) argument + is set to False, this argument is silently ignored. If the value for this argument + is set to 0, the commit is confirmed immediately. + type: int + default: 0 + comment: + description: + - The C(comment) argument specifies a text string to be used when committing the + configuration. If the C(confirm) argument is set to False, this argument is + silently ignored. + default: configured by junos_config + type: str + replace: + description: + - The C(replace) argument will instruct the remote device to replace the current + configuration hierarchy with the one specified in the corresponding hierarchy + of the source configuration loaded from this module. + - Note this argument should be considered deprecated. To achieve the equivalent, + set the I(update) argument to C(replace). This argument will be removed in a + future release. The C(replace) and C(update) argument is mutually exclusive. + type: bool + default: no + 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 + update: + description: + - This argument will decide how to load the configuration data particularly when + the candidate configuration and loaded configuration contain conflicting statements. + Following are accepted values. C(merge) combines the data in the loaded configuration + with the candidate configuration. If statements in the loaded configuration + conflict with statements in the candidate configuration, the loaded statements + replace the candidate ones. C(override) discards the entire candidate configuration + and replaces it with the loaded configuration. C(replace) substitutes each hierarchy + level in the loaded configuration for the corresponding level. C(update) is + similar to the override option. The new configuration completely replaces the + existing configuration. The difference comes when the configuration is later + committed. This option performs a 'diff' between the new candidate configuration + and the existing committed configuration. It then only notifies system processes + responsible for the changed portions of the configuration, and only marks the + actual configuration changes as 'changed'. + type: str + default: merge + choices: + - merge + - override + - replace + - update + confirm_commit: + description: + - This argument will execute commit operation on remote device. It can be used + to confirm a previous commit. + type: bool + default: no + check_commit: + description: + - This argument will check correctness of syntax; do not apply changes. + - Note that this argument can be used to confirm verified configuration done via + commit confirmed operation + type: bool + default: no + 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 +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- 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). +- Loading JSON-formatted configuration I(json) is supported starting in Junos OS Release + 16.1 onwards. +- Update C(override) not currently compatible with C(set) notation. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +""" + +EXAMPLES = """ +- name: load configure file into device + junipernetworks.junos.junos_config: + src: srx.cfg + comment: update config + +- name: load configure lines into device + junipernetworks.junos.junos_config: + lines: + - set interfaces ge-0/0/1 unit 0 description "Test interface" + - set vlans vlan01 description "Test vlan" + comment: update config + +- name: Set routed VLAN interface (RVI) IPv4 address + junipernetworks.junos.junos_config: + lines: + - set vlans vlan01 vlan-id 1 + - set interfaces irb unit 10 family inet address 10.0.0.1/24 + - set vlans vlan01 l3-interface irb.10 + +- name: Check correctness of commit configuration + junipernetworks.junos.junos_config: + check_commit: yes + +- name: rollback the configuration to id 10 + junipernetworks.junos.junos_config: + rollback: 10 + +- name: zero out the current configuration + junipernetworks.junos.junos_config: + zeroize: yes + +- name: Set VLAN access and trunking + junipernetworks.junos.junos_config: + lines: + - set vlans vlan02 vlan-id 6 + - set interfaces ge-0/0/6.0 family ethernet-switching interface-mode access vlan + members vlan02 + - set interfaces ge-0/0/6.0 family ethernet-switching interface-mode trunk vlan + members vlan02 + +- name: confirm a previous commit + junipernetworks.junos.junos_config: + confirm_commit: yes + +- name: for idempotency, use full-form commands + junipernetworks.junos.junos_config: + lines: + # - set int ge-0/0/1 unit 0 desc "Test interface" + - set interfaces ge-0/0/1 unit 0 description "Test interface" + +- name: configurable backup path + junipernetworks.junos.junos_config: + src: srx.cfg + backup: yes + backup_options: + filename: backup.cfg + dir_path: /home/user +""" + +RETURN = """ +backup_path: + description: The full path to the backup file + returned: when backup is yes + type: str + sample: /playbooks/ansible/backup/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: junos01_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/junos01_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 +import json + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + exec_rpc, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + get_diff, + load_config, + get_configuration, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + load_configuration, + tostring, +) +from ansible.module_utils.six import string_types +from ansible.module_utils._text import to_native, to_text + +try: + from lxml.etree import Element, fromstring +except ImportError: + from xml.etree.ElementTree import Element, fromstring + +try: + from lxml.etree import ParseError +except ImportError: + try: + from xml.etree.ElementTree import ParseError + except ImportError: + # for Python < 2.7 + from xml.parsers.expat import ExpatError + + ParseError = ExpatError + +USE_PERSISTENT_CONNECTION = True +DEFAULT_COMMENT = "configured by junos_config" + + +def check_args(module, warnings): + if module.params["replace"] is not None: + module.fail_json(msg="argument replace is deprecated, use update") + + +def zeroize(module): + return exec_rpc( + module, + tostring(Element("request-system-zeroize")), + ignore_warning=False, + ) + + +def rollback(ele, id="0"): + return get_diff(ele, id) + + +def guess_format(config): + try: + json.loads(config) + return "json" + except ValueError: + pass + + try: + fromstring(config) + return "xml" + except ParseError: + pass + + if config.startswith("set") or config.startswith("delete"): + return "set" + + return "text" + + +def filter_delete_statements(module, candidate): + reply = get_configuration(module, format="set") + match = reply.find(".//configuration-set") + if match is None: + # Could not find configuration-set in reply, perhaps device does not support it? + return candidate + config = to_native(match.text, encoding="latin-1") + + modified_candidate = candidate[:] + for index, line in reversed(list(enumerate(candidate))): + if line.startswith("delete"): + newline = re.sub("^delete", "set", line) + if newline not in config: + del modified_candidate[index] + + return modified_candidate + + +def configure_device(module, warnings, candidate): + + kwargs = {} + config_format = None + + if module.params["src"]: + config_format = module.params["src_format"] or guess_format( + str(candidate) + ) + if config_format == "set": + kwargs.update({"format": "text", "action": "set"}) + else: + kwargs.update( + {"format": config_format, "action": module.params["update"]} + ) + + if isinstance(candidate, string_types): + candidate = candidate.split("\n") + + # this is done to filter out `delete ...` statements which map to + # nothing in the config as that will cause an exception to be raised + if any((module.params["lines"], config_format == "set")): + candidate = filter_delete_statements(module, candidate) + kwargs["format"] = "text" + kwargs["action"] = "set" + + return load_config(module, candidate, warnings, **kwargs) + + +def main(): + """ main entry point for module execution + """ + backup_spec = dict(filename=dict(), dir_path=dict(type="path")) + argument_spec = dict( + lines=dict(aliases=["commands"], type="list", elements="str"), + src=dict(type="path"), + src_format=dict(choices=["xml", "text", "set", "json"]), + # update operations + update=dict( + default="merge", choices=["merge", "override", "replace", "update"] + ), + # deprecated replace in Ansible 2.3 + replace=dict(type="bool"), + confirm=dict(default=0, type="int"), + comment=dict(default=DEFAULT_COMMENT), + confirm_commit=dict(type="bool", default=False), + check_commit=dict(type="bool", default=False), + # config operations + backup=dict(type="bool", default=False), + backup_options=dict(type="dict", options=backup_spec), + rollback=dict(type="int"), + zeroize=dict(default=False, type="bool"), + ) + + argument_spec.update(junos_argument_spec) + + mutually_exclusive = [("lines", "src", "rollback", "zeroize")] + + module = AnsibleModule( + argument_spec=argument_spec, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + warnings = list() + check_args(module, warnings) + + candidate = module.params["lines"] or module.params["src"] + commit = not module.check_mode + + result = {"changed": False, "warnings": warnings} + + if module.params["backup"]: + for conf_format in ["set", "text"]: + reply = get_configuration(module, format=conf_format) + match = reply.find(".//configuration-%s" % conf_format) + if match is not None: + break + else: + module.fail_json(msg="unable to retrieve device configuration") + + result["__backup__"] = match.text.strip() + + rollback_id = module.params["rollback"] + if rollback_id: + diff = rollback(module, rollback_id) + if commit: + kwargs = {"comment": module.params["comment"]} + with locked_config(module): + load_configuration(module, rollback=rollback_id) + commit_configuration(module, **kwargs) + if module._diff: + result["diff"] = {"prepared": diff} + result["changed"] = True + + elif module.params["zeroize"]: + if commit: + zeroize(module) + result["changed"] = True + + else: + if candidate: + with locked_config(module): + diff = configure_device(module, warnings, candidate) + if diff: + if commit: + kwargs = { + "comment": module.params["comment"], + "check": module.params["check_commit"], + } + + confirm = module.params["confirm"] + if confirm > 0: + kwargs.update( + { + "confirm": True, + "confirm_timeout": to_text( + confirm, + errors="surrogate_then_replace", + ), + } + ) + commit_configuration(module, **kwargs) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + elif module.params["check_commit"]: + commit_configuration(module, check=True) + + elif module.params["confirm_commit"]: + with locked_config(module): + # confirm a previous commit + commit_configuration(module) + + result["changed"] = True + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py new file mode 100644 index 00000000..50bd1b68 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_facts.py @@ -0,0 +1,147 @@ +#!/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: junos_facts +author: Nathaniel Case (@Qalthos) +short_description: Collect facts from remote devices running Juniper Junos +description: +- Collects fact information from a remote device running the Junos operating system. By + default, the module will collect basic fact information from the device to be included + with the hostvars. Additional fact information can be collected based on the configured + set of arguments. +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +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(!) to specify that a specific subset should not be collected. + To maintain backward compatibility old style facts can be retrieved by explicitly + adding C(ofacts) to value, this requires junos-eznc to be installed as a prerequisite. + Valid value of gather_subset are default, hardware, config, interfaces, ofacts. + If C(ofacts) is present in the list it fetches the old style facts (fact keys + without 'ansible_' prefix) and it requires junos-eznc library to be installed + on control node and the device login credentials must be given in C(provider) + option. + required: false + default: + - '!config' + type: list + elements: str + config_format: + description: + - The I(config_format) argument specifies the format of the configuration when + serializing output from the device. This argument is applicable only when C(config) + value is present in I(gather_subset). The I(config_format) should be supported + by the junos version running on device. This value is not applicable while fetching + old style facts that is when C(ofacts) value is present in value if I(gather_subset) + value. This option is valid only for C(gather_subset) values. + type: str + required: false + default: text + choices: + - xml + - text + - set + - json + gather_network_resources: + description: + - When supplied, this argument will restrict the facts collected to a given subset. + Possible values for this argument include all and the resources like interfaces, + vlans etc. Can specify a list of values to include a larger subset. Values can + also be used with an initial C(!) to specify that a specific subset should + not be collected. Valid subsets are 'all', 'interfaces', 'lacp', 'lacp_interfaces', + 'lag_interfaces', 'l2_interfaces', 'l3_interfaces', 'lldp_global', 'lldp_interfaces', + 'vlans'. + required: false + type: list + elements: str +requirements: +- ncclient (>=v0.5.2) +notes: +- Ensure I(config_format) used to retrieve configuration from device is supported + by junos version running on device. +- With I(config_format = json), configuration in the results will be a dictionary(and + not a JSON string) +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +- Fetching old style facts requires junos-eznc library to be installed on control + node and the device login credentials must be given in provider option. +""" + +EXAMPLES = """ +- name: collect default set of facts + junipernetworks.junos.junos_facts: + +- name: collect default set of facts and configuration + junipernetworks.junos.junos_facts: + gather_subset: config + +- name: Gather legacy and resource facts + junipernetworks.junos.junos_facts: + gather_subset: all + gather_network_resources: all +""" + +RETURN = """ +ansible_facts: + description: Returns the facts collect from the device + returned: always + type: dict +""" +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.facts.facts import ( + FactsArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.facts import ( + Facts, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, +) + + +def main(): + """ + Main entry point for module execution + + :returns: ansible_facts + """ + argument_spec = FactsArgs.argument_spec + argument_spec.update(junos_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/junipernetworks/junos/plugins/modules/junos_interface.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interface.py new file mode 100644 index 00000000..f289c7ec --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interface.py @@ -0,0 +1,545 @@ +#!/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: junos_interface +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage Interface on Juniper + JUNOS network devices +description: +- This module provides declarative management of Interfaces on Juniper JUNOS network + devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_interfaces) instead. + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the Interface. + type: str + description: + description: + - Description of Interface. + type: str + enabled: + description: + - Configure interface link status. + type: bool + default: True + speed: + description: + - Interface link speed. + type: str + mtu: + description: + - Maximum size of transmit packet. + type: int + duplex: + description: + - Interface link status. + type: str + choices: + - full + - half + - auto + 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 + neighbors: + description: + - Check the operational state of given interface C(name) for LLDP neighbor. + - The following suboptions are available. + type: list + elements: dict + suboptions: + host: + description: + - LLDP neighbor host for given interface C(name). + type: str + port: + description: + - LLDP neighbor port to which given interface C(name) is connected. + 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 + default: 10 + aggregate: + description: List of Interfaces definitions. + type: list + elements: dict + suboptions: + name: + description: + - Name of the Interface. + required: true + type: str + description: + description: + - Description of Interface. + type: str + enabled: + description: + - Configure interface link status. + type: bool + speed: + description: + - Interface link speed. + type: str + mtu: + description: + - Maximum size of transmit packet. + type: int + duplex: + description: + - Interface link status. + type: str + choices: + - full + - half + - auto + 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 + neighbors: + description: + - Check the operational state of given interface C(name) for LLDP neighbor. + - The following suboptions are available. + type: list + elements: dict + suboptions: + host: + description: + - LLDP neighbor host for given interface C(name). + type: str + port: + description: + - LLDP neighbor port to which given interface C(name) is connected. + 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) indicates present and operationally + up and C(down) indicates present and operationally C(down) + type: str + choices: + - present + - absent + - up + - down + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + state: + description: + - State of the Interface configuration, C(up) indicates present and operationally + up and C(down) indicates present and operationally C(down) + type: str + default: present + choices: + - present + - absent + - up + - down + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure interface + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + +- name: remove interface + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: absent + +- name: make interface down + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + enabled: false + +- name: make interface up + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + enabled: true + +- name: Deactivate interface config + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: present + active: false + +- name: Activate interface config + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: present + active: true + +- name: Configure interface speed, mtu, duplex + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: present + speed: 1g + mtu: 256 + duplex: full + +- name: Create interface using aggregate + junipernetworks.junos.junos_interface: + aggregate: + - name: ge-0/0/1 + description: test-interface-1 + - name: ge-0/0/2 + description: test-interface-2 + speed: 1g + duplex: full + mtu: 512 + +- name: Delete interface using aggregate + junipernetworks.junos.junos_interface: + aggregate: + - name: ge-0/0/1 + - name: ge-0/0/2 + state: absent + +- name: Check intent arguments + junipernetworks.junos.junos_interface: + name: '{{ name }}' + state: up + tx_rate: ge(0) + rx_rate: le(0) + +- name: Check neighbor intent + junipernetworks.junos.junos_interface: + name: xe-0/1/1 + neighbors: + - port: Ethernet1/0/1 + host: netdev + +- name: Config + intent + junipernetworks.junos.junos_interface: + name: '{{ name }}' + enabled: false + state: down +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit interfaces] + + ge-0/0/1 { + + description test-interface; + + } +""" +import collections + +from copy import deepcopy +from time import sleep + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + exec_rpc, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + conditional, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, + to_param_list, +) + +try: + from lxml.etree import Element, SubElement +except ImportError: + from xml.etree.ElementTree import Element, SubElement + +USE_PERSISTENT_CONNECTION = True + + +def validate_mtu(value, module): + if value and not 256 <= value <= 9192: + module.fail_json(msg="mtu must be between 256 and 9192") + + +def validate_param_values(module, obj, param=None): + if not param: + param = module.params + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(param.get(key), module) + + +def main(): + """ main entry point for module execution + """ + neighbors_spec = dict(host=dict(), port=dict()) + + element_spec = dict( + name=dict(), + description=dict(), + enabled=dict(default=True, type="bool"), + speed=dict(type="str"), + mtu=dict(type="int"), + duplex=dict(choices=["full", "half", "auto"]), + tx_rate=dict(), + rx_rate=dict(), + neighbors=dict(type="list", elements="dict", options=neighbors_spec), + delay=dict(default=10, type="int"), + state=dict( + default="present", choices=["present", "absent", "up", "down"] + ), + active=dict(default=True, type="bool"), + ) + + 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(junos_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, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "interfaces/interface" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True}), + ("description", "description"), + ("speed", "speed"), + ("mtu", "mtu"), + ("duplex", "link-mode"), + ("disable", {"xpath": "disable", "tag_only": True}), + ] + ) + + choice_to_value_map = { + "link-mode": { + "full": "full-duplex", + "half": "half-duplex", + "auto": "automatic", + } + } + + params = to_param_list(module) + + requests = list() + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + state = item.get("state") + item["disable"] = True if not item.get("enabled") else False + + if state in ("present", "up", "down"): + item["state"] = "present" + + validate_param_values(module, param_to_xpath_map, param=item) + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append( + map_obj_to_ele( + module, want, top, value_map=choice_to_value_map, param=item + ) + ) + + diff = None + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + # issue commit after last configuration change is done + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + failed_conditions = [] + neighbors = None + for item in params: + state = item.get("state") + tx_rate = item.get("tx_rate") + rx_rate = item.get("rx_rate") + want_neighbors = item.get("neighbors") + + if ( + state not in ("up", "down") + and tx_rate is None + and rx_rate is None + and want_neighbors is None + ): + continue + + element = Element("get-interface-information") + intf_name = SubElement(element, "interface-name") + intf_name.text = item.get("name") + + if result["changed"]: + sleep(item.get("delay")) + + reply = exec_rpc(module, tostring(element), ignore_warning=False) + if state in ("up", "down"): + admin_status = reply.xpath( + "interface-information/physical-interface/admin-status" + ) + if not admin_status or not conditional( + state, admin_status[0].text.strip() + ): + failed_conditions.append("state " + "eq(%s)" % state) + + if tx_rate: + output_bps = reply.xpath( + "interface-information/physical-interface/traffic-statistics/output-bps" + ) + if not output_bps or not conditional( + tx_rate, output_bps[0].text.strip(), cast=int + ): + failed_conditions.append("tx_rate " + tx_rate) + + if rx_rate: + input_bps = reply.xpath( + "interface-information/physical-interface/traffic-statistics/input-bps" + ) + if not input_bps or not conditional( + rx_rate, input_bps[0].text.strip(), cast=int + ): + failed_conditions.append("rx_rate " + rx_rate) + + if want_neighbors: + if neighbors is None: + element = Element("get-lldp-interface-neighbors") + intf_name = SubElement(element, "interface-device") + intf_name.text = item.get("name") + + reply = exec_rpc( + module, tostring(element), ignore_warning=False + ) + have_host = [ + item.text + for item in reply.xpath( + "lldp-neighbors-information/lldp-neighbor-information/lldp-remote-system-name" + ) + ] + have_port = [ + item.text + for item in reply.xpath( + "lldp-neighbors-information/lldp-neighbor-information/lldp-remote-port-id" + ) + ] + + for neighbor in want_neighbors: + host = neighbor.get("host") + port = neighbor.get("port") + if host and host not in have_host: + failed_conditions.append("host " + host) + if port and port not in have_port: + failed_conditions.append("port " + port) + if failed_conditions: + msg = "One or more conditional statements have not been satisfied" + module.fail_json(msg=msg, failed_conditions=failed_conditions) + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py new file mode 100644 index 00000000..3d59064d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_interfaces.py @@ -0,0 +1,542 @@ +#!/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 junos_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_interfaces +short_description: Junos Interfaces resource module +description: This module manages the interfaces on Juniper Junos OS network devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: The provided configuration + type: list + elements: dict + suboptions: + name: + description: + - Full name of interface, e.g. ge-0/0/0. + type: str + required: true + description: + description: + - Interface description. + type: str + duplex: + description: + - Interface link status. Applicable for Ethernet interfaces only, either in + half duplex, full duplex or in automatic state which negotiates the duplex + automatically. + type: str + choices: + - automatic + - full-duplex + - half-duplex + enabled: + default: true + description: + - Administrative state of the interface. + - Set the value to C(true) to administratively enabled the interface or C(false) + to disable it. + type: bool + hold_time: + description: + - The hold time for given interface name. + type: dict + suboptions: + down: + description: + - The link down hold time in milliseconds. + type: int + up: + description: + - The link up hold time in milliseconds. + type: int + mtu: + description: + - MTU for a specific interface. + - Applicable for Ethernet interfaces only. + type: int + speed: + description: + - Interface link speed. Applicable for Ethernet interfaces only. + 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 Junos device + by executing the command B(show interfaces). + - 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 + - gathered + - parsed + - rendered + default: merged + description: + - The state of the configuration after module completion + type: str +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 18.4R1. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +""" +EXAMPLES = """ +# Using deleted + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible-1"; +# speed 1g; +# mtu 1800 +# } +# ge-0/0/2 { +# description "Configured by Ansible-2"; +# ether-options { +# auto-negotiation; +# } +# } + +- name: "Delete given options for the interface (Note: This won't delete the interface itself if any other values are configured for interface)" + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/1 + description: Configured by Ansible-1 + speed: 1g + mtu: 1800 + - name: ge-0/0/2 + description: Configured by Ansible -2 + state: deleted + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# auto-negotiation; +# } +# } + + +# Using merged + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "test interface"; +# speed 1g; +# } + +- name: Merge provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/1 + description: Configured by Ansible-1 + enabled: true + mtu: 1800 + - name: ge-0/0/2 + description: Configured by Ansible-2 + enabled: false + state: merged + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible-1"; +# speed 1g; +# mtu 1800 +# } +# ge-0/0/2 { +# disable; +# description "Configured by Ansible-2"; +# } + + +# Using overridden + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible-1"; +# speed 1g; +# mtu 1800 +# } +# ge-0/0/2 { +# disable; +# description "Configured by Ansible-2"; +# ether-options { +# auto-negotiation; +# } +# } +# ge-0/0/11 { +# description "Configured by Ansible-11"; +# } + +- name: Override device configuration of all interfaces with provided configuration + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansible-2 + enabled: false + mtu: 2800 + - name: ge-0/0/3 + description: Configured by Ansible-3 + state: overridden + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/2 { +# disable; +# description "Configured by Ansible-2"; +# mtu 2800 +# } +# ge-0/0/3 { +# description "Configured by Ansible-3"; +# } + + +# Using replaced + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible-1"; +# speed 1g; +# mtu 1800 +# } +# ge-0/0/2 { +# disable; +# mtu 1800; +# speed 1g; +# description "Configured by Ansible-2"; +# ether-options { +# auto-negotiation; +# } +# } +# ge-0/0/11 { +# description "Configured by Ansible-11"; +# } + +- name: Replaces device configuration of listed interfaces with provided configuration + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansible-2 + enabled: false + mtu: 2800 + - name: ge-0/0/3 + description: Configured by Ansible-3 + state: replaced + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible-1"; +# speed 1g; +# mtu 1800 +# } +# ge-0/0/2 { +# disable; +# description "Configured by Ansible-2"; +# mtu 2800 +# } +# ge-0/0/3 { +# description "Configured by Ansible-3"; +# } +# ge-0/0/11 { +# description "Configured by Ansible-11"; +# } +# Using gathered +# Before state: +# ------------ +# +# user@junos01# show interfaces +# gr-0/0/0 { +# description "test gre interface"; +# } +# fxp0 { +# unit 0 { +# family inet { +# dhcp; +# } +# } +# } +# pp0 { +# unit 0 { +# pppoe-options { +# idle-timeout 100; +# access-concentrator ispl.com; +# service-name "video@ispl.com"; +# auto-reconnect 100; +# client; +# ## Warning: missing mandatory statement(s): 'underlying-interface' +# } +# } +# } +# +- name: Gather junos interfaces as in given arguments + junipernetworks.junos.junos_interfaces: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "description": "test gre interface", +# "enabled": true, +# "name": "gr-0/0/0" +# }, +# { +# "enabled": true, +# "name": "fxp0" +# }, +# { +# "enabled": true, +# "name": "pp0" +# } +# ] +# After state: +# ------------ +# +# user@junos01# show interfaces +# gr-0/0/0 { +# description "test gre interface"; +# } +# fxp0 { +# unit 0 { +# family inet { +# dhcp; +# } +# } +# } +# pp0 { +# unit 0 { +# pppoe-options { +# idle-timeout 100; +# access-concentrator ispl.com; +# service-name "video@ispl.com"; +# auto-reconnect 100; +# client; +# ## Warning: missing mandatory statement(s): 'underlying-interface' +# } +# } +# } +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# ge-0/0/1 +# Configured by Ansible +# +# 100m +# 1024 +# +# 2000 +# 2200 +# +# full-duplex +# +# 0 +# +# +# access +# +# vlan100 +# +# +# +# +# +# +# +# +# - name: Convert interfaces config to argspec without connecting to the appliance +# junipernetworks.junos.junos_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "description": "Configured by Ansible", +# "duplex": "full-duplex", +# "enabled": false, +# "hold_time": { +# "down": 2200, +# "up": 2000 +# }, +# "mtu": 1024, +# "name": "ge-0/0/1", +# "speed": "100m" +# } +# ] +# +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansibull + mtu: 2048 + speed: 20m + hold_time: + up: 3200 + down: 3200 + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": +# +# ge-0/0/2 +# Configured by Ansibull +# 20m +# 2048 +# +# 3200 +# 3200 +# +# +# " + +""" +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. +xml: + description: The set of xml rpc payload pushed to the remote device. + returned: always + type: list + sample: [' + + + + + ge-0/0/1 + Configured by Ansible + + 100m + 1024 + + 2000 + 2200 + + full-duplex + + 0 + + + access + + vlan100 + + + + + + + +', 'xml 2', 'xml 3'] +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.interfaces.interfaces import ( + InterfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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",)), + ] + + module = AnsibleModule( + argument_spec=InterfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interface.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interface.py new file mode 100644 index 00000000..127b52dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interface.py @@ -0,0 +1,418 @@ +#!/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: junos_l2_interface +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage L2 Interface on Juniper + JUNOS network devices +description: +- This module provides declarative management of Layer-2 interface on Juniper JUNOS + network devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_l2_interfaces) instead. + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the interface excluding any logical unit number. + type: str + description: + description: + - Description of Interface. + type: str + aggregate: + description: + - List of Layer-2 interface definitions. + type: list + elements: dict + suboptions: + name: + description: + - Name of the interface excluding any logical unit number. + type: str + required: true + description: + description: + - Description of Interface. + type: str + mode: + description: + - Mode in which interface needs to be configured. + choices: + - access + - trunk + type: str + access_vlan: + description: + - Configure given VLAN in access port. The value of C(access_vlan) should be vlan + name. + type: str + trunk_vlans: + description: + - List of VLAN names to be configured in trunk port. The value of C(trunk_vlans) + should be list of vlan names. + type: list + elements: str + native_vlan: + description: + - Native VLAN to be configured in trunk port. The value of C(native_vlan) should + be vlan id. + type: int + enhanced_layer: + description: + - True if your device has Enhanced Layer 2 Software (ELS). + type: bool + unit: + description: + - Logical interface number. Value of C(unit) should be of type integer. + type: int + filter_input: + description: + - The name of input filter of ethernet-switching. + type: str + filter_output: + description: + - The name of output filter of ethernet-switching. + type: str + state: + description: + - State of the Layer-2 Interface configuration. + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + mode: + description: + - Mode in which interface needs to be configured. + choices: + - access + - trunk + type: str + access_vlan: + description: + - Configure given VLAN in access port. The value of C(access_vlan) should be vlan + name. + type: str + trunk_vlans: + description: + - List of VLAN names to be configured in trunk port. The value of C(trunk_vlans) + should be list of vlan names. + type: list + elements: str + native_vlan: + description: + - Native VLAN to be configured in trunk port. The value of C(native_vlan) should + be vlan id. + type: int + enhanced_layer: + description: + - True if your device has Enhanced Layer 2 Software (ELS). + default: true + type: bool + unit: + description: + - Logical interface number. Value of C(unit) should be of type integer. + default: 0 + type: int + filter_input: + description: + - The name of input filter of ethernet-switching. + type: str + filter_output: + description: + - The name of output filter of ethernet-switching. + type: str + state: + description: + - State of the Layer-2 Interface configuration. + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: Configure interface in access mode + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: interface-access + mode: access + access_vlan: red + active: true + state: present + +- name: Configure interface in trunk mode + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + +- name: Configure interface in access and trunk mode using aggregate + junipernetworks.junos.junos_l2_interface: + aggregate: + - name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + - name: ge-0/0/2 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present +""" + +RETURN = """ +diff: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit interfaces] + + ge-0/0/1 { + + description "l2 interface configured by Ansible"; + + unit 0 { + + family ethernet-switching { + + interface-mode access; + + vlan { + + members red; + + } + + } + + } + + } +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, + to_param_list, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_vlan_id(value, module): + if value and not 0 <= value <= 4094: + module.fail_json(msg="vlan_id must be between 1 and 4094") + + +def validate_param_values(module, obj, param=None): + if not param: + param = module.params + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(param.get(key), module) + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(), + mode=dict(choices=["access", "trunk"]), + access_vlan=dict(), + native_vlan=dict(type="int"), + trunk_vlans=dict(type="list", elements="str"), + unit=dict(default=0, type="int"), + filter_input=dict(), + filter_output=dict(), + description=dict(), + enhanced_layer=dict(default=True, type="bool"), + state=dict(default="present", choices=["present", "absent"]), + active=dict(default=True, type="bool"), + ) + + 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) + + required_one_of = [["name", "aggregate"]] + mutually_exclusive = [ + ["name", "aggregate"], + ["access_vlan", "trunk_vlans"], + ["access_vlan", "native_vlan"], + ] + + required_if = [ + ("mode", "access", ("access_vlan",)), + ("mode", "trunk", ("trunk_vlans",)), + ] + + 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(junos_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + required_one_of=required_one_of, + required_if=required_if, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "interfaces/interface" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True}), + ("unit", {"xpath": "name", "top": "unit", "is_key": True}), + ( + "mode", + { + "xpath": "interface-mode", + "top": "unit/family/ethernet-switching", + }, + ), + ( + "access_vlan", + { + "xpath": "members", + "top": "unit/family/ethernet-switching/vlan", + }, + ), + ( + "trunk_vlans", + { + "xpath": "members", + "top": "unit/family/ethernet-switching/vlan", + }, + ), + ( + "filter_input", + { + "xpath": "input", + "top": "unit/family/ethernet-switching/filter", + }, + ), + ( + "filter_output", + { + "xpath": "output", + "top": "unit/family/ethernet-switching/filter", + }, + ), + ("native_vlan", {"xpath": "native-vlan-id"}), + ("description", "description"), + ] + ) + + params = to_param_list(module) + + requests = list() + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + + validate_param_values(module, param_to_xpath_map, param=item) + + param_to_xpath_map["mode"]["xpath"] = ( + "interface-mode" if param["enhanced_layer"] else "port-mode" + ) + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append(map_obj_to_ele(module, want, top, param=item)) + + diff = None + with locked_config(module): + for req in requests: + diff = load_config( + module, tostring(req), warnings, action="replace" + ) + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interfaces.py new file mode 100644 index 00000000..9123e153 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l2_interfaces.py @@ -0,0 +1,695 @@ +#!/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 junos_l2_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_l2_interfaces +short_description: L2 interfaces resource module +description: This module provides declarative management of a Layer-2 interface on + Juniper JUNOS devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: A dictionary of Layer-2 interface options + type: list + elements: dict + suboptions: + name: + description: + - Full name of interface, e.g. ge-0/0/1. + type: str + required: true + unit: + description: + - Logical interface number. Value of C(unit) should be of type integer. + type: int + access: + description: + - Configure the interface as a Layer 2 access mode. + type: dict + suboptions: + vlan: + description: + - Configure the access VLAN ID. + type: str + trunk: + description: + - Configure the interface as a Layer 2 trunk mode. + type: dict + suboptions: + allowed_vlans: + description: + - List of VLANs to be configured in trunk port. It's used as the VLAN + range to ADD or REMOVE from the trunk. + type: list + elements: str + native_vlan: + description: + - Native VLAN to be configured in trunk port. It is used as the trunk + native VLAN ID. + type: str + enhanced_layer: + description: + - True if your device has Enhanced Layer 2 Software (ELS). If the l2 configuration + is under C(interface-mode) the value is True else if the l2 configuration + is under C(port-mode) value is False + 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 Junos device + by executing the command B(show interfaces). + - 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 + - gathered + - parsed + - rendered + default: merged + description: + - The state of the configuration after module completion + type: str +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 18.4R1. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +""" +EXAMPLES = """ +# Using deleted + +# Before state: +# ------------- +# +# ansible@junos01# show interfaces +# ge-0/0/1 { +# description "L2 interface"; +# speed 1g; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members vlan30; +# } +# } +# } +#} +#ge-0/0/2 { +# description "non L2 interface"; +# unit 0 { +# family inet { +# address 192.168.56.14/24; +# } +# } + +- name: "Delete L2 attributes of given interfaces (Note: This won't delete the + interface itself)." + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + state: deleted + +# After state: +# ------------ +# +# ansible@junos01# show interfaces +# ge-0/0/1 { +# description "L2 interface"; +# speed 1g; +# } +#ge-0/0/2 { +# description "non L2 interface"; +# unit 0 { +# family inet { +# address 192.168.56.14/24; +# } +# } + + +# Using merged + +# Before state: +# ------------- +# ansible@junos01# show interfaces +# ge-0/0/3 { +# description "test interface"; +# speed 1g; +#} +# ge-0/0/4 { +# description interface-trunk; +# native-vlan-id 100; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan40 ]; +# } +# } +# } +# } + +- name: Merge provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + state: merged + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/3 { +# description "test interface"; +# speed 1g; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members v101; +# } +# } +# } +# } +# ge-0/0/4 { +# description interface-trunk; +# native-vlan-id 50; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan40 vlan30 ]; +# } +# } +# } +# } + + +# Using overridden + +# Before state: +# ------------- +# ansible@junos01# show interfaces +# ge-0/0/3 { +# description "test interface"; +# speed 1g; +#} +# ge-0/0/4 { +# description interface-trunk; +# native-vlan-id 100; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan40 ]; +# } +# } +# } +# } +# ge-0/0/5 { +# description "Configured by Ansible-11"; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members v101; +# } +# } +# } +# } + +- name: Override provided configuration with device configuration + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + state: overridden + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/3 { +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members v101; +# } +# } +# } +# } +# ge-0/0/4 { +# description interface-trunk; +# native-vlan-id 50; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan30 ]; +# } +# } +# } +# } + + +# Using replaced + +# Before state: +# ------------- +# ansible@junos01# show interfaces +# ge-0/0/3 { +# description "test interface"; +# speed 1g; +#} +# ge-0/0/4 { +# description interface-trunk; +# native-vlan-id 100; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan40 ]; +# } +# } +# } +# } + +- name: Replace provided configuration with device configuration + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/3 + access: + vlan: v101 + - name: ge-0/0/4 + trunk: + allowed_vlans: + - vlan30 + native_vlan: 50 + state: replaced + +# After state: +# ------------ +# user@junos01# show interfaces +# ge-0/0/3 { +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members v101; +# } +# } +# } +# } +# ge-0/0/4 { +# description interface-trunk; +# native-vlan-id 50; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan30 ]; +# } +# } +# } +# } +# Using gathered +# Before state: +# ------------ +# +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible"; +# disable; +# speed 100m; +# mtu 1024; +# hold-time up 2000 down 2200; +# link-mode full-duplex; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members vlan100; +# } +# } +# } +# } +# ge-0/0/2 { +# description "Configured by Ansible"; +# native-vlan-id 400; +# speed 10m; +# mtu 2048; +# hold-time up 3000 down 3200; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan200 vlan300 ]; +# } +# } +# } +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +- name: Gather junos layer 2 interfaces as in given arguments + junipernetworks.junos.junos_l2_interfaces: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "access": { +# "vlan": "vlan100" +# }, +# "enhanced_layer": true, +# "name": "ge-0/0/1", +# "unit": 0 +# }, +# { +# "enhanced_layer": true, +# "name": "ge-0/0/2", +# "trunk": { +# "allowed_vlans": [ +# "vlan200", +# "vlan300" +# ], +# "native_vlan": "400" +# }, +# "unit": 0 +# } +# ] +# After state: +# ------------ +# +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible"; +# disable; +# speed 100m; +# mtu 1024; +# hold-time up 2000 down 2200; +# link-mode full-duplex; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members vlan100; +# } +# } +# } +# } +# ge-0/0/2 { +# description "Configured by Ansible"; +# native-vlan-id 400; +# speed 10m; +# mtu 2048; +# hold-time up 3000 down 3200; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan200 vlan300 ]; +# } +# } +# } +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# ge-0/0/1 +# Configured by Ansible +# +# 100m +# 1024 +# +# 2000 +# 2200 +# +# full-duplex +# +# 0 +# +# +# access +# +# vlan100 +# +# +# +# +# +# +# +# +# - name: Convert interfaces config to argspec without connecting to the appliance +# junipernetworks.junos.junos_l2_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "access": { +# "vlan": "vlan100" +# }, +# "enhanced_layer": true, +# "name": "ge-0/0/1", +# "unit": 0 +# }, +# { +# "enhanced_layer": true, +# "name": "ge-0/0/2", +# "trunk": { +# "allowed_vlans": [ +# "vlan200", +# "vlan300" +# ], +# "native_vlan": "400" +# }, +# "unit": 0 +# } +# ] +# +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/1 + access: + vlan: vlan100 + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# ge-0/0/1 +# +# 0 +# +# +# access +# +# vlan100 +# +# +# +# +# +# +# ge-0/0/2 +# +# 0 +# +# +# trunk +# +# vlan200 +# vlan300 +# +# +# +# +# 400 +# +# " + +""" +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: [' + + ge-0/0/1 + + 0 + + + access + + vlan100 + + + + + + + ge-0/0/2 + + 0 + + + trunk + + vlan200 + vlan300 + + + + + 400 + + ', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.l2_interfaces.l2_interfaces import ( + L2_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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",)), + ] + + module = AnsibleModule( + argument_spec=L2_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = L2_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interface.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interface.py new file mode 100644 index 00000000..4b7fc3c5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interface.py @@ -0,0 +1,338 @@ +#!/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: junos_l3_interface +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage L3 interfaces on + Juniper JUNOS network devices +description: +- This module provides declarative management of L3 interfaces on Juniper JUNOS network + devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_l3_interfaces) instead. + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the L3 interface. + type: str + ipv4: + description: + - IPv4 of the L3 interface. + type: str + ipv6: + description: + - IPv6 of the L3 interface. + type: str + unit: + description: + - Logical interface number. + type: int + default: 0 + filter_input: + description: + - The name of input filter. + type: str + filter_output: + description: + - The name of output filter. + type: str + filter6_input: + description: + - The name of input filter for ipv6. + type: str + filter6_output: + description: + - The name of output filter for ipv6. + type: str + aggregate: + description: List of L3 interfaces definitions + type: list + elements: dict + suboptions: + name: + description: + - Name of the L3 interface. + required: true + type: str + ipv4: + description: + - IPv4 of the L3 interface. + type: str + ipv6: + description: + - IPv6 of the L3 interface. + type: str + unit: + description: + - Logical interface number. + type: int + default: 0 + filter_input: + description: + - The name of input filter. + type: str + filter_output: + description: + - The name of output filter. + type: str + filter6_input: + description: + - The name of input filter for ipv6. + type: str + filter6_output: + description: + - The name of output filter for ipv6. + type: str + state: + description: + - State of the L3 interface configuration. + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + state: + description: + - State of the L3 interface configuration. + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: Set ge-0/0/1 IPv4 address + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.168.0.1 + +- name: Remove ge-0/0/1 IPv4 address + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + state: absent + +- name: Set ipv4 address using aggregate + junipernetworks.junos.junos_l3_interface: + aggregate: + - name: ge-0/0/1 + ipv4: 192.0.2.1 + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + +- name: Delete ipv4 address using aggregate + junipernetworks.junos.junos_l3_interface: + aggregate: + - name: ge-0/0/1 + ipv4: 192.0.2.1 + - name: ge-0/0/2 + ipv4: 192.0.2.2 + state: absent +""" + +RETURN = """ +diff: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit interfaces ge-0/0/1 unit 0 family inet] + + address 192.0.2.1/32; + [edit interfaces ge-0/0/1 unit 0 family inet6] + + address fd5d:12c9:2201:1::1/128; +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, + to_param_list, +) + +USE_PERSISTENT_CONNECTION = True + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(), + ipv4=dict(), + ipv6=dict(), + filter_input=dict(), + filter_output=dict(), + filter6_input=dict(), + filter6_output=dict(), + unit=dict(default=0, type="int"), + state=dict( + type="str", default="present", choices=["present", "absent"] + ), + active=dict(default=True, type="bool"), + ) + + 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(junos_argument_spec) + + required_one_of = [["name", "aggregate"]] + mutually_exclusive = [["name", "aggregate"]] + + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + mutually_exclusive=mutually_exclusive, + required_one_of=required_one_of, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "interfaces/interface" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ( + "name", + {"xpath": "name", "parent_attrib": False, "is_key": True}, + ), + ( + "unit", + { + "xpath": "name", + "top": "unit", + "parent_attrib": False, + "is_key": True, + }, + ), + ( + "ipv4", + { + "xpath": "inet/address/name", + "top": "unit/family", + "is_key": True, + }, + ), + ( + "ipv6", + { + "xpath": "inet6/address/name", + "top": "unit/family", + "is_key": True, + }, + ), + ( + "filter_input", + {"xpath": "inet/filter/input", "top": "unit/family"}, + ), + ( + "filter_output", + {"xpath": "inet/filter/output", "top": "unit/family"}, + ), + ( + "filter6_input", + {"xpath": "inet6/filter/input", "top": "unit/family"}, + ), + ( + "filter6_output", + {"xpath": "inet6/filter/output", "top": "unit/family"}, + ), + ] + ) + + params = to_param_list(module) + + requests = list() + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + if not item["ipv4"] and not item["ipv6"]: + module.fail_json(msg="one of the following is required: ipv4,ipv6") + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append(map_obj_to_ele(module, want, top, param=item)) + + diff = None + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interfaces.py new file mode 100644 index 00000000..e4e1f124 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_l3_interfaces.py @@ -0,0 +1,775 @@ +#!/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 junos_l3_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_l3_interfaces +short_description: L3 interfaces resource module +description: This module provides declarative management of a Layer 3 interface on + Juniper JUNOS devices +version_added: 1.0.0 +author: Daniel Mellado (@dmellado) +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the device being managed. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- Tested against JunOS v18.4R1 +options: + config: + description: A dictionary of Layer 3 interface options + type: list + elements: dict + suboptions: + name: + description: + - Full name of interface, e.g. ge-0/0/1 + type: str + required: true + unit: + description: + - Logical interface number. Value of C(unit) should be of type integer + default: 0 + type: int + ipv4: + description: + - IPv4 addresses to be set for the Layer 3 logical interface mentioned in + I(name) option. The address format is /. The mask is + number in range 0-32 for example, 192.0.2.1/24, or C(dhcp) to query DHCP + for an IP address + type: list + elements: dict + suboptions: + address: + description: + - IPv4 address to be set for the specific interface + type: str + ipv6: + description: + - IPv6 addresses to be set for the Layer 3 logical interface mentioned in + I(name) option. The address format is /, the mask is + number in range 0-128 for example, 2001:db8:2201:1::1/64 or C(auto-config) + to use SLAAC + type: list + elements: dict + suboptions: + address: + description: + - IPv6 address to be set for the specific 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 Junos device + by executing the command B(show interfaces). + - 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 + - gathered + - rendered + - parsed + default: merged +""" +EXAMPLES = """ +# Using deleted + +# Before state: +# ------------- +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 10.200.16.10/24; +# } +# } +# } +# ge-0/0/2 { +# description "non L3 interface"; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members 2; +# } +# } +# } +# } + +- name: Delete JUNOS L3 logical interface + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + state: deleted + +# After state: +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "deleted L3 interface"; +# } +# ge-0/0/2 { +# description "non L3 interface"; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members 2; +# } +# } +# } +# } +# Using merged +# Before state +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 10.200.16.10/24; +# } +# } +# } +# ge-0/0/2 { +# description "non configured interface"; +# unit 0; +# } +- name: Merge provided configuration with device configuration (default operation is merge) + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + ipv4: + - address: 192.168.1.10/24 + ipv6: + - address: 8d8d:8d01::1/64 + - name: ge-0/0/2 + ipv4: + - address: dhcp + state: merged + +# After state: +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 10.200.16.10/24; +# address 192.168.1.10/24; +# } +# family inet6 { +# address 8d8d:8d01::1/64; +# } +# } +# } +# ge-0/0/2 { +# description "L3 interface with dhcp"; +# unit 0 { +# family inet { +# dhcp; +# } +# } +# } + + +# Using overridden + +# Before state +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 10.200.16.10/24; +# } +# } +# } +# ge-0/0/2 { +# description "L3 interface with dhcp"; +# unit 0 { +# family inet { +# dhcp; +# } +# } +# } +# ge-0/0/3 { +# description "another L3 interface"; +# unit 0 { +# family inet { +# address 192.168.1.10/24; +# } +# } +# } + +- name: Override provided configuration with device configuration + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + ipv4: + - address: 192.168.1.10/24 + ipv6: + - address: 8d8d:8d01::1/64 + - name: ge-0/0/2 + ipv6: + - address: 2001:db8:3000::/64 + state: overridden + +# After state: +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 192.168.1.10/24; +# } +# family inet6 { +# address 8d8d:8d01::1/64; +# } +# } +# } +# ge-0/0/2 { +# description "L3 interface with ipv6"; +# unit 0 { +# family inet6 { +# address 2001:db8:3000::/64; +# } +# } +# } +# ge-0/0/3 { +# description "overridden L3 interface"; +# unit 0; +# } + + +# Using replaced + +# Before state +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 10.200.16.10/24; +# } +# } +# } +# ge-0/0/2 { +# description "non configured interface"; +# unit 0; +# } +# ge-0/0/3 { +# description "another L3 interface"; +# unit 0 { +# family inet { +# address 192.168.1.10/24; +# } +# } +# } + +- name: Replace provided configuration with device configuration + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-0/0/1 + ipv4: + - address: 192.168.1.10/24 + ipv6: + - address: 8d8d:8d01::1/64 + - name: ge-0/0/2 + ipv4: + - address: dhcp + state: replaced + +# After state: +# ------------ +# +# admin# show interfaces +# ge-0/0/1 { +# description "L3 interface"; +# unit 0 { +# family inet { +# address 192.168.1.10/24; +# } +# family inet6 { +# address 8d8d:8d01::1/64; +# } +# } +# } +# ge-0/0/2 { +# description "L3 interface with dhcp"; +# unit 0 { +# family inet { +# dhcp; +# } +# } +# } +# ge-0/0/3 { +# description "another L3 interface"; +# unit 0 { +# family inet { +# address 192.168.1.10/24; +# } +# } +# } +# Using gathered +# Before state: +# ------------ +# +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible"; +# disable; +# speed 100m; +# mtu 1024; +# hold-time up 2000 down 2200; +# link-mode full-duplex; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members vlan100; +# } +# } +# } +# } +# ge-0/0/2 { +# description "Configured by Ansible"; +# native-vlan-id 400; +# speed 10m; +# mtu 2048; +# hold-time up 3000 down 3200; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan200 vlan300 ]; +# } +# } +# } +# } +# ge-1/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.1/24; +# address 10.200.16.20/24; +# } +# family inet6; +# } +# } +# ge-2/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.2/24; +# address 10.200.16.21/24; +# } +# family inet6; +# } +# } +# ge-3/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.3/24; +# address 10.200.16.22/24; +# } +# family inet6; +# } +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +- name: Gather junos layer3 interfaces as in given arguments + junipernetworks.junos.junos_l3_interfaces: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "ipv4": [ +# { +# "address": "192.168.100.1/24" +# }, +# { +# "address": "10.200.16.20/24" +# } +# ], +# "name": "ge-1/0/0", +# "unit": "0" +# }, +# { +# "ipv4": [ +# { +# "address": "192.168.100.2/24" +# }, +# { +# "address": "10.200.16.21/24" +# } +# ], +# "name": "ge-2/0/0", +# "unit": "0" +# }, +# { +# "ipv4": [ +# { +# "address": "192.168.100.3/24" +# }, +# { +# "address": "10.200.16.22/24" +# } +# ], +# "name": "ge-3/0/0", +# "unit": "0" +# }, +# { +# "ipv4": [ +# { +# "address": "10.8.38.38/24" +# } +# ], +# "name": "fxp0", +# "unit": "0" +# } +# ] +# After state: +# ------------ +# +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Configured by Ansible"; +# disable; +# speed 100m; +# mtu 1024; +# hold-time up 2000 down 2200; +# link-mode full-duplex; +# unit 0 { +# family ethernet-switching { +# interface-mode access; +# vlan { +# members vlan100; +# } +# } +# } +# } +# ge-0/0/2 { +# description "Configured by Ansible"; +# native-vlan-id 400; +# speed 10m; +# mtu 2048; +# hold-time up 3000 down 3200; +# unit 0 { +# family ethernet-switching { +# interface-mode trunk; +# vlan { +# members [ vlan200 vlan300 ]; +# } +# } +# } +# } +# ge-1/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.1/24; +# address 10.200.16.20/24; +# } +# family inet6; +# } +# } +# ge-2/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.2/24; +# address 10.200.16.21/24; +# } +# family inet6; +# } +# } +# ge-3/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.3/24; +# address 10.200.16.22/24; +# } +# family inet6; +# } +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# ge-1/0/0 +# +# 0 +# +# +#
+# 192.168.100.1/24 +#
+#
+# 10.200.16.20/24 +#
+#
+# +#
+#
+#
+# +# ge-2/0/0 +# +# 0 +# +# +#
+# 192.168.100.2/24 +#
+#
+# 10.200.16.21/24 +#
+#
+# +#
+#
+#
+#
+#
+#
+# - name: Convert interfaces config to argspec without connecting to the appliance +# junipernetworks.junos.junos_l3_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "ipv4": [ +# { +# "address": "192.168.100.1/24" +# }, +# { +# "address": "10.200.16.20/24" +# } +# ], +# "name": "ge-1/0/0", +# "unit": "0" +# }, +# { +# "ipv4": [ +# { +# "address": "192.168.100.2/24" +# }, +# { +# "address": "10.200.16.21/24" +# } +# ], +# "name": "ge-2/0/0", +# "unit": "0" +# } +# ] +# +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-1/0/0 + ipv4: + - address: 192.168.100.1/24 + - address: 10.200.16.20/24 + unit: 0 + + - name: ge-2/0/0 + ipv4: + - address: 192.168.100.2/24 + - address: 10.200.16.21/24 + unit: 0 + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# ge-1/0/0 +# +# 0 +# +# +# +# 192.168.100.1/24 +# +# +# 10.200.16.20/24 +# +# +# +# +# +# +# ge-2/0/0 +# +# 0 +# +# +# +# 192.168.100.2/24 +# +# +# 10.200.16.21/24 +# +# +# +# +# +# " + +""" +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + sample: > + The configuration returned will always be in the same format + of the parameters above. + type: list +after: + description: The configuration as structured data after module completion. + returned: when changed + sample: > + The configuration returned will always be in the same format + of the parameters above. + type: list +commands: + description: The set of commands pushed to the remote device. + returned: always + type: list + sample: [' + + ge-1/0/0 + + 0 + + + + 192.168.100.1/24 + + + 10.200.16.20/24 + + + + +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.l3_interfaces.l3_interfaces import ( + L3_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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",)), + ] + + module = AnsibleModule( + argument_spec=L3_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = L3_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp.py new file mode 100644 index 00000000..c50a3292 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp.py @@ -0,0 +1,303 @@ +#!/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 junos_lacp +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_lacp +short_description: Global Link Aggregation Control Protocol (LACP) Junos resource + module +description: This module provides declarative management of global LACP on Juniper + Junos network devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: A dictionary of LACP global options + type: dict + suboptions: + system_priority: + description: + - LACP priority for the system. + type: int + link_protection: + description: + - Enable LACP link-protection for the system. If the value is set to C(non-revertive) + it will not revert links when a better priority link comes up. By default + the link will be reverted. + type: str + choices: + - revertive + - non-revertive + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the Junos device + by executing the command B(show chassis aggregated-devices ethernet 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 + - gathered + - rendered + - parsed + default: merged +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 18.1R1. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +""" +EXAMPLES = """ +# Using deleted + +# Before state: +# ------------- +# user@junos01# show chassis aggregated-devices ethernet lacp +# system-priority 63; +# link-protection { +# non-revertive; +# } + +- name: Delete global LACP attributes + junipernetworks.junos.junos_lacp: + state: deleted + +# After state: +# ------------ +# user@junos01# show chassis aggregated-devices ethernet lacp +# + + +# Using merged + +# Before state: +# ------------- +# user@junos01# show chassis aggregated-devices ethernet lacp +# + +- name: Merge global LACP attributes + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: revertive + state: merged + +# After state: +# ------------ +# user@junos01# show chassis aggregated-devices ethernet lacp +# system-priority 63; +# link-protection { +# non-revertive; +# } + + +# Using replaced + +# Before state: +# ------------- +# user@junos01# show chassis aggregated-devices ethernet lacp +# system-priority 63; +# link-protection { +# non-revertive; +# } + +- name: Replace global LACP attributes + junipernetworks.junos.junos_lacp: + config: + system_priority: 30 + link_protection: non-revertive + state: replaced + +# After state: +# ------------ +# user@junos01# show chassis aggregated-devices ethernet lacp +# system-priority 30; +# link-protection; +# +# Using gathered +# Before state: +# ------------ +# +# ansible@cm123456tr21# show chassis aggregated-devices ethernet lacp +# system-priority 63; +# link-protection; + +- name: Gather junos lacp as in given arguments + junipernetworks.junos.junos_lacp: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": { +# "link_protection": "revertive", +# "system_priority": 63 +# } +# After state: +# ------------ +# +# ansible@cm123456tr21# show chassis aggregated-devices ethernet lacp +# system-priority 63; +# link-protection; +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: revertive + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# +# +# 63 +# +# +# +# +# +# +# +# +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# +# +# 63 +# +# +# +# +# +# +# +# +# - name: Convert lacp config to argspec without connecting to the appliance +# junipernetworks.junos.junos_lacp: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": { +# "link_protection": "revertive", +# "system_priority": 63 +# } + +""" +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. +xml: + description: The set of xml rpc payload pushed to the remote device. + returned: always + type: list + sample: [' + + + + 63 + + + + + + +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lacp.lacp import ( + LacpArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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",)), + ] + + module = AnsibleModule( + argument_spec=LacpArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Lacp(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp_interfaces.py new file mode 100644 index 00000000..cee8d078 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lacp_interfaces.py @@ -0,0 +1,965 @@ +#!/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 junos_lacp_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_lacp_interfaces +short_description: LACP interfaces resource module +description: +- This module manages Link Aggregation Control Protocol (LACP) attributes of interfaces + on Juniper JUNOS devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: The list of dictionaries of LACP interfaces options. + type: list + elements: dict + suboptions: + name: + description: + - Name Identifier of the interface or link aggregation group. + type: str + period: + description: + - Timer interval for periodic transmission of LACP packets. If the value is + set to C(fast) the packets are received every second and if the value is + C(slow) the packets are received every 30 seconds. This value is applicable + for aggregate interface only. + type: str + choices: + - fast + - slow + sync_reset: + description: + - The argument notifies minimum-link failure out of sync to peer. If the value + is C(disable) it disables minimum-link failure handling at LACP level and + if value is C(enable) it enables minimum-link failure handling at LACP level. + This value is applicable for aggregate interface only. + type: str + choices: + - disable + - enable + force_up: + description: + - This is a boolean argument to control if the port should be up in absence + of received link Aggregation Control Protocol Data Unit (LACPDUS). This + value is applicable for member interfaces only. + type: bool + port_priority: + description: + - Priority of the member port. This value is applicable for member interfaces + only. + - Refer to vendor documentation for valid values. + type: int + system: + description: + - This dict object contains configurable options related to LACP system parameters + for the link aggregation group. This value is applicable for aggregate interface + only. + 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: dict + 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 Junos device + by executing the command B(show 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 of the configuration after module completion. + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - parsed + - rendered + default: merged +""" +EXAMPLES = """ +# Using merged +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad ae4; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad ae0; +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +- name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + - name: ge-0/0/3 + port_priority: 100 + force_up: true + state: merged + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad ae4; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae0; +# } +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# periodic fast; +# sync-reset enable; +# system-priority 100; +# system-id 00:00:00:00:00:02; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +# Using replaced +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad ae4; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae0; +# } +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# periodic fast; +# sync-reset enable; +# system-priority 100; +# system-id 00:00:00:00:00:02; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +- name: Replace device LACP interfaces configuration with provided configuration + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + period: slow + state: replaced + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad ae4; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae0; +# } +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# periodic slow; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +# Using overridden +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad ae4; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae0; +# } +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# periodic slow; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +- name: Overrides all device LACP interfaces configuration with provided configuration + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + system: + priority: 300 + mac: + address: 00:00:00:00:00:03 + - name: ge-0/0/2 + port_priority: 200 + force_up: false + state: overridden + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad { +# lacp { +# port-priority 200; +# } +# ae4; +# } +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae0; +# } +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# system-priority 300; +# system-id 00:00:00:00:00:03; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +# Using deleted +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad { +# lacp { +# port-priority 200; +# } +# ae4; +# } +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae0; +# } +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# system-priority 300; +# system-id 00:00:00:00:00:03; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } + +- name: "Delete LACP interfaces attributes of given interfaces (Note: This won't delete the interface itself)" + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae0 + - name: ge-0/0/3 + - name: ge-0/0/2 + state: deleted + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/2 { +# ether-options { +# 802.3ad ae4; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad ae0; +# } +# } +# ae0 { +# description "lag interface merged"; +# aggregated-ether-options { +# lacp { +# passive; +# } +# } +# } +# ae4 { +# description "test aggregate interface"; +# aggregated-ether-options { +# lacp { +# passive; +# link-protection; +# } +# } +# } +# Using gathered +# Before state: +# ------------ +# +# user@junos01# show interfaces +# ansible@cm123456tr21# show interfaces +# ge-0/0/1 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae1; +# } +# } +# } +# ge-0/0/2 { +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad ae2; +# } +# } +# ge-0/0/4 { +# ether-options { +# 802.3ad ae2; +# } +# } +# ge-1/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.1/24; +# address 10.200.16.20/24; +# } +# family inet6; +# } +# } +# ge-2/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.2/24; +# address 10.200.16.21/24; +# } +# family inet6; +# } +# } +# ge-3/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.3/24; +# address 10.200.16.22/24; +# } +# family inet6; +# } +# } +# ae1 { +# description "Configured by Ansible"; +# aggregated-ether-options { +# lacp { +# periodic fast; +# sync-reset enable; +# system-priority 100; +# system-id 00:00:00:00:00:02; +# } +# } +# } +# ae2 { +# description "Configured by Ansible"; +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +- name: Gather junos lacp interfaces as in given arguments + junipernetworks.junos.junos_lacp_interfaces: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "force_up": true, +# "name": "ge-0/0/1", +# "port_priority": 100 +# }, +# { +# "name": "ae1", +# "period": "fast", +# "sync_reset": "enable", +# "system": { +# "mac": { +# "address": "00:00:00:00:00:02" +# }, +# "priority": 100 +# } +# } +# ] +# After state: +# ------------ +# +# ansible@cm123456tr21# show interfaces +# ge-0/0/1 { +# ether-options { +# 802.3ad { +# lacp { +# force-up; +# port-priority 100; +# } +# ae1; +# } +# } +# } +# ge-0/0/2 { +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad ae2; +# } +# } +# ge-0/0/4 { +# ether-options { +# 802.3ad ae2; +# } +# } +# ge-1/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.1/24; +# address 10.200.16.20/24; +# } +# family inet6; +# } +# } +# ge-2/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.2/24; +# address 10.200.16.21/24; +# } +# family inet6; +# } +# } +# ge-3/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.3/24; +# address 10.200.16.22/24; +# } +# family inet6; +# } +# } +# ae1 { +# description "Configured by Ansible"; +# aggregated-ether-options { +# lacp { +# periodic fast; +# sync-reset enable; +# system-priority 100; +# system-id 00:00:00:00:00:02; +# } +# } +# } +# ae2 { +# description "Configured by Ansible"; +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# ge-0/0/1 +# +# +# +# +# 100 +# +# ae1 +# +# +# +# +# ge-0/0/2 +# +# +# ae1 +# +# +# +# +# ge-0/0/3 +# +# +# ae2 +# +# +# +# +# ge-0/0/4 +# +# +# ae2 +# +# +# +# +# ge-1/0/0 +# +# 0 +# +# +#
+# 192.168.100.1/24 +#
+#
+# 10.200.16.20/24 +#
+#
+# +# +#
+#
+#
+# +# ge-2/0/0 +# +# 0 +# +# +#
+# 192.168.100.2/24 +#
+#
+# 10.200.16.21/24 +#
+#
+# +# +#
+#
+#
+# +# ge-3/0/0 +# +# 0 +# +# +#
+# 192.168.100.3/24 +#
+#
+# 10.200.16.22/24 +#
+#
+# +# +#
+#
+#
+# +# ae1 +# Configured by Ansible +# +# +# fast +# enable +# 100 +# 00:00:00:00:00:02 +# +# +# +# +# ae2 +# Configured by Ansible +# +# +# em1 +# TEST +# +# +# fxp0 +# ANSIBLE +# 1g +# automatic +# +# 0 +# +# +#
+# 10.8.38.38/24 +#
+#
+#
+#
+#
+#
+#
+#
+# - name: Convert interfaces config to argspec without connecting to the appliance +# junipernetworks.junos.junos_lacp_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "force_up": true, +# "name": "ge-0/0/1", +# "port_priority": 100 +# }, +# { +# "name": "ae1", +# "period": "fast", +# "sync_reset": "enable", +# "system": { +# "mac": { +# "address": "00:00:00:00:00:02" +# }, +# "priority": 100 +# } +# } +# ] +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# ae1 +# +# +# fast +# enable +# 00:00:00:00:00:02 +# 100 +# +# +# +# +# ge-0/0/1 +# +# +# +# 100 +# +# +# +# +# +# " + +""" + +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: [' + + ae1 + + + fast + enable + 00:00:00:00:00:02 + 100 + + + + + ge-0/0/1 + + + + 100 + + + + + +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lacp_interfaces.lacp_interfaces import ( + Lacp_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + module = AnsibleModule( + argument_spec=Lacp_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Lacp_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lag_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lag_interfaces.py new file mode 100644 index 00000000..6aa5b1a6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lag_interfaces.py @@ -0,0 +1,885 @@ +#!/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 junos_lag_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_lag_interfaces +short_description: Link Aggregation Juniper JUNOS resource module +description: This module manages properties of Link Aggregation Group on Juniper JUNOS + devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: A list of link aggregation group configurations. + type: list + elements: dict + suboptions: + name: + description: + - Name of the link aggregation group (LAG). + type: str + required: true + mode: + description: + - LAG mode. A value of C(passive) will enable LACP in C(passive) mode that + is it will respond to LACP packets and C(active) configures the link to + initiate transmission of LACP packets. + type: str + choices: + - active + - passive + link_protection: + description: + - This boolean option indicates if link protection should be enabled for the + LAG interface. If value is C(True) link protection is enabled on LAG and + if value is C(False) link protection is disabled. + type: bool + members: + description: + - List of member interfaces of the link aggregation group. The value can be + single interface or list of interfaces. + type: list + elements: dict + suboptions: + member: + description: + - Name of the member interface. + type: str + link_type: + description: + - The value of this options configures the member link as either C(primary) + or C(backup). Value C(primary) configures primary interface for link-protection + mode and C(backup) configures backup interface for link-protection mode. + type: str + choices: + - primary + - backup + running_config: + description: + - This option is used only with state I(parsed). + - The value of this option should be the output received from the Junos device + by executing the command B(show interfaces). + - 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 + - gathered + - rendered + - parsed + default: merged +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 18.4R1. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +""" +EXAMPLES = """ +# Using merged + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# ether-options { +# 802.3ad ae0; +# } +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# ether-options { +# 802.3ad ae0; +# } +# } +# ae0 { +# description "lag interface"; +# } +# ae1 { +# description "lag interface 1"; +# } + +- name: "Delete LAG attributes of given interfaces (Note: This won't delete the interface itself)" + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + - name: ae1 + state: deleted + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# } + + +# Using merged + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# } + +- name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + members: + - member: ge-0/0/1 + link_type: primary + - member: ge-0/0/2 + link_type: backup + state: merged + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# ether-options { +# 802.3ad { +# ae0; +# primary; +# } +# } +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# ether-options { +# 802.3ad { +# ae0; +# backup; +# } +# } +# } + + +# Using merged + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# ether-options { +# 802.3ad ae0; +# } +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# ether-options { +# 802.3ad ae0; +# } +# } +# ae0 { +# description "lag interface"; +# } +# ae3 { +# description "lag interface 3"; +# } + +- name: Overrides all device LAG configuration with provided configuration + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + members: + - member: ge-0/0/2 + - name: ae1 + members: + - member: ge-0/0/1 + mode: passive + state: overridden + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# ether-options { +# 802.3ad ae0; +# } +# } +# ae0 { +# description "lag interface"; +# } +# ae1 { +# aggregated-ether-options { +# lacp { +# active; +# } +# } +# } + + +# Using merged + +# Before state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# } +# ge-0/0/3 { +# description "Ansible configured interface 3"; +# } + +- name: Replace device LAG configuration with provided configuration + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae0 + members: + - member: ge-0/0/1 + mode: active + state: replaced + +# After state: +# ------------- +# user@junos01# show interfaces +# ge-0/0/1 { +# description "Ansible configured interface 1"; +# ether-options { +# 802.3ad ae0; +# } +# } +# ge-0/0/2 { +# description "Ansible configured interface 2"; +# } +# ae0 { +# aggregated-ether-options { +# lacp { +# active; +# } +# } +# } +# ge-0/0/3 { +# description "Ansible configured interface 3"; +# } +# Using gathered +# Before state: +# ------------ +# +# ansible@cm123456tr21# show interfaces +# ge-0/0/1 { +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/2 { +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# ae2; +# primary; +# } +# } +# } +# ge-0/0/4 { +# ether-options { +# 802.3ad { +# ae2; +# backup; +# } +# } +# } +# ge-1/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.1/24; +# address 10.200.16.20/24; +# } +# family inet6; +# } +# } +# ge-2/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.2/24; +# address 10.200.16.21/24; +# } +# family inet6; +# } +# } +# ge-3/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.3/24; +# address 10.200.16.22/24; +# } +# family inet6; +# } +# } +# ae1 { +# description "Configured by Ansible"; +# aggregated-ether-options { +# lacp { +# active; +# } +# } +# } +# ae2 { +# description "Configured by Ansible"; +# aggregated-ether-options { +# link-protection; +# lacp { +# passive; +# } +# } +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +- name: Gather junos lag interfaces as in given arguments + junipernetworks.junos.junos_lag_interfaces: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "members": [ +# { +# "member": "ge-0/0/1" +# }, +# { +# "member": "ge-0/0/2" +# } +# ], +# "mode": "active", +# "name": "ae1" +# }, +# { +# "link_protection": true, +# "members": [ +# { +# "link_type": "primary", +# "member": "ge-0/0/3" +# }, +# { +# "link_type": "backup", +# "member": "ge-0/0/4" +# } +# ], +# "mode": "passive", +# "name": "ae2" +# } +# ] +# After state: +# ------------ +# +# ansible@cm123456tr21# show interfaces +# ge-0/0/1 { +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/2 { +# ether-options { +# 802.3ad ae1; +# } +# } +# ge-0/0/3 { +# ether-options { +# 802.3ad { +# ae2; +# primary; +# } +# } +# } +# ge-0/0/4 { +# ether-options { +# 802.3ad { +# ae2; +# backup; +# } +# } +# } +# ge-1/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.1/24; +# address 10.200.16.20/24; +# } +# family inet6; +# } +# } +# ge-2/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.2/24; +# address 10.200.16.21/24; +# } +# family inet6; +# } +# } +# ge-3/0/0 { +# unit 0 { +# family inet { +# address 192.168.100.3/24; +# address 10.200.16.22/24; +# } +# family inet6; +# } +# } +# ae1 { +# description "Configured by Ansible"; +# aggregated-ether-options { +# lacp { +# active; +# } +# } +# } +# ae2 { +# description "Configured by Ansible"; +# aggregated-ether-options { +# link-protection; +# lacp { +# passive; +# } +# } +# } +# em1 { +# description TEST; +# } +# fxp0 { +# description ANSIBLE; +# speed 1g; +# link-mode automatic; +# unit 0 { +# family inet { +# address 10.8.38.38/24; +# } +# } +# } +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# ge-0/0/1 +# +# +# ae1 +# +# +# +# +# ge-0/0/2 +# +# +# ae1 +# +# +# +# +# ge-0/0/3 +# +# +# ae2 +# +# +# +# +# +# ge-0/0/4 +# +# +# ae2 +# +# +# +# +# +# ge-1/0/0 +# +# 0 +# +# +#
+# 192.168.100.1/24 +#
+#
+# 10.200.16.20/24 +#
+#
+# +# +#
+#
+#
+# +# ge-2/0/0 +# +# 0 +# +# +#
+# 192.168.100.2/24 +#
+#
+# 10.200.16.21/24 +#
+#
+# +# +#
+#
+#
+# +# ge-3/0/0 +# +# 0 +# +# +#
+# 192.168.100.3/24 +#
+#
+# 10.200.16.22/24 +#
+#
+# +# +#
+#
+#
+# +# ae1 +# Configured by Ansible +# +# +# +# +# +# +# +# ae2 +# Configured by Ansible +# +# +# +# +# +# +# +# +# +# em1 +# TEST +# +# +# fxp0 +# ANSIBLE +# 1g +# automatic +# +# 0 +# +# +#
+# 10.8.38.38/24 +#
+#
+#
+#
+#
+#
+#
+#
+# - name: Convert interfaces config to argspec without connecting to the appliance +# junipernetworks.junos.junos_lag_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "members": [ +# { +# "member": "ge-0/0/1" +# }, +# { +# "member": "ge-0/0/2" +# } +# ], +# "mode": "active", +# "name": "ae1" +# }, +# { +# "link_protection": true, +# "members": [ +# { +# "link_type": "primary", +# "member": "ge-0/0/3" +# }, +# { +# "link_type": "backup", +# "member": "ge-0/0/4" +# } +# ], +# "mode": "passive", +# "name": "ae2" +# } +# ] +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae1 + members: + - member: ge-0/0/1 + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + - member: ge-0/0/3 + link_type: primary + - member: ge-0/0/4 + link_type: backup + mode: passive +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# ae1 +# +# +# +# +# +# +# +# ge-0/0/1 +# +# +# ae1 +# +# +# +# +# ge-0/0/2 +# +# +# ae1 +# +# +# +# +# ae2 +# +# +# +# +# +# +# +# +# ge-0/0/3 +# +# +# ae2 +# +# +# +# +# +# ge-0/0/4 +# +# +# ae2 +# +# +# +# +# " + +""" +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. +xml: + description: The set of xml rpc payload pushed to the remote device. + returned: always + type: list + sample: [' + + ae1 + + + + + + + + ge-0/0/1 + + + ae1 + + + + + ge-0/0/2 + + + ae1 + + + + + ae2 + + + + + + + + + ge-0/0/3 + + + ae2 + + + + + + ge-0/0/4 + + + ae2 + + + + +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lag_interfaces.lag_interfaces import ( + Lag_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + module = AnsibleModule( + argument_spec=Lag_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Lag_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_linkagg.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_linkagg.py new file mode 100644 index 00000000..4c01fc9f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_linkagg.py @@ -0,0 +1,451 @@ +#!/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: junos_linkagg +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage link aggregation + groups on Juniper JUNOS network devices +description: +- This module provides declarative management of link aggregation groups on Juniper + JUNOS network devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_lag_interfaces) instead. + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the link aggregation group. + type: str + mode: + description: + - Mode of the link aggregation group. A value of C(on) will enable LACP in C(passive) + mode. C(active) configures the link to actively information about the state + of the link, or it can be configured in C(passive) mode ie. send link state + information only when received them from another link. A value of C(off) will + disable LACP. + type: str + default: "on" + choices: ["on", "off", "active", "passive"] + members: + description: + - List of members interfaces of the link aggregation group. The value can be single + interface or list of interfaces. + type: list + elements: str + min_links: + description: + - Minimum members that should be up before bringing up the link aggregation group. + type: int + device_count: + description: + - Number of aggregated ethernet devices that can be configured. Acceptable integer + value is between 1 and 128. + type: int + description: + description: + - Description of Interface. + type: str + aggregate: + description: List of link aggregation definitions. + type: list + elements: dict + suboptions: + name: + description: + - Name of the link aggregation group. + type: str + required: true + mode: + description: + - Mode of the link aggregation group. A value of C(on) will enable LACP in C(passive) + mode. C(active) configures the link to actively information about the state + of the link, or it can be configured in C(passive) mode ie. send link state + information only when received them from another link. A value of C(off) will + disable LACP. + type: str + choices: ["on", "off", "active", "passive"] + members: + description: + - List of members interfaces of the link aggregation group. The value can be single + interface or list of interfaces. + type: list + elements: str + min_links: + description: + - Minimum members that should be up before bringing up the link aggregation group. + type: int + device_count: + description: + - Number of aggregated ethernet devices that can be configured. Acceptable integer + value is between 1 and 128. + type: int + description: + description: + - Description of Interface. + type: str + state: + description: + - State of the link aggregation group. + type: str + choices: + - present + - absent + - up + - down + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + state: + description: + - State of the link aggregation group. + type: str + default: present + choices: + - present + - absent + - up + - down + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: present + +- name: delete link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: delete + +- name: deactivate link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: present + active: false + +- name: Activate link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + members: + - ge-0/0/5 + - ge-0/0/6 + - ge-0/0/7 + lacp: active + device_count: 4 + state: present + active: true + +- name: Disable link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + state: down + +- name: Enable link aggregation + junipernetworks.junos.junos_linkagg: + name: ae11 + state: up +""" + +RETURN = """ +diff: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit interfaces] + + ge-0/0/6 { + + ether-options { + + 802.3ad ae0; + + } + + } + [edit interfaces ge-0/0/7] + + ether-options { + + 802.3ad ae0; + + } + [edit interfaces] + + ae0 { + + description "configured by junos_linkagg"; + + aggregated-ether-options { + + lacp { + + active; + + } + + } + + } +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, + to_param_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, + get_configuration, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_device_count(value, module): + if value and not 1 <= value <= 128: + module.fail_json(msg="device_count must be between 1 and 128") + + +def validate_min_links(value, module): + if value and not 1 <= value <= 8: + module.fail_json(msg="min_links must be between 1 and 8") + + +def validate_param_values(module, obj, item): + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(item.get(key), module) + + +def configure_lag_params(module, requests, item): + top = "interfaces/interface" + param_lag_to_xpath_map = collections.OrderedDict() + param_lag_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True}), + ("description", "description"), + ( + "min_links", + {"xpath": "minimum-links", "top": "aggregated-ether-options"}, + ), + ("disable", {"xpath": "disable", "tag_only": True}), + ( + "mode", + { + "xpath": item["mode"], + "tag_only": True, + "top": "aggregated-ether-options/lacp", + }, + ), + ] + ) + + validate_param_values(module, param_lag_to_xpath_map, item) + + want = map_params_to_obj(module, param_lag_to_xpath_map, param=item) + ele = map_obj_to_ele(module, want, top, param=item) + requests.append(ele) + + if item["device_count"]: + top = "chassis/aggregated-devices/ethernet" + device_count_to_xpath_map = { + "device_count": {"xpath": "device-count", "leaf_only": True} + } + + validate_param_values(module, device_count_to_xpath_map, item) + + want = map_params_to_obj(module, device_count_to_xpath_map, param=item) + ele = map_obj_to_ele(module, want, top, param=item) + requests.append(ele) + + +def configure_member_params(module, requests, item): + top = "interfaces/interface" + members = item["members"] + + if members: + member_to_xpath_map = collections.OrderedDict() + member_to_xpath_map.update( + [ + ( + "name", + {"xpath": "name", "is_key": True, "parent_attrib": False}, + ), + ( + "bundle", + { + "xpath": "bundle", + "leaf_only": True, + "top": "ether-options/ieee-802.3ad", + "is_key": True, + }, + ), + ] + ) + + # link aggregation bundle assigned to member + item["bundle"] = item["name"] + + for member in members: + + if item["state"] == "absent": + # if link aggregate bundle is not assigned to member, trying to + # delete it results in rpc-reply error, hence if is not assigned + # skip deleting it and continue to next member. + resp = get_configuration(module) + bundle = resp.xpath( + "configuration/interfaces/interface[name='%s']/ether-options/" + "ieee-802.3ad[bundle='%s']" % (member, item["bundle"]) + ) + if not bundle: + continue + # Name of member to be assigned to link aggregation bundle + item["name"] = member + + validate_param_values(module, member_to_xpath_map, item) + + want = map_params_to_obj(module, member_to_xpath_map, param=item) + ele = map_obj_to_ele(module, want, top, param=item) + requests.append(ele) + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(), + mode=dict(default="on", choices=["on", "off", "active", "passive"]), + members=dict(type="list", elements="str"), + min_links=dict(type="int"), + device_count=dict(type="int"), + description=dict(), + state=dict( + default="present", choices=["present", "absent", "up", "down"] + ), + active=dict(default=True, type="bool"), + ) + + 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(junos_argument_spec) + + required_one_of = [["name", "aggregate"]] + mutually_exclusive = [["name", "aggregate"]] + + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + required_one_of=required_one_of, + mutually_exclusive=mutually_exclusive, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + params = to_param_list(module) + requests = list() + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + state = item.get("state") + item["disable"] = True if state == "down" else False + + if state in ("present", "up", "down"): + item["state"] = "present" + + else: + item["disable"] = True + + mode = item.get("mode") + if mode == "off": + item["mode"] = "" + elif mode == "on": + item["mode"] = "passive" + + configure_lag_params(module, requests, item) + configure_member_params(module, requests, item) + + diff = None + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp.py new file mode 100644 index 00000000..7a484a75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp.py @@ -0,0 +1,229 @@ +#!/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: junos_lldp +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage LLDP configuration + on Juniper JUNOS network devices +description: +- This module provides declarative management of LLDP service on Juniper JUNOS network + devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_lldp_global) instead. + removed_at_date: '2022-06-01' +options: + interval: + description: + - Frequency at which LLDP advertisements are sent (in seconds). + type: int + transmit_delay: + description: + - Specify the number of seconds the device waits before sending advertisements + to neighbors after a change is made in local system. + type: int + hold_multiplier: + description: + - Specify the number of seconds that LLDP information is held before it is discarded. + The multiplier value is used in combination with the C(interval) value. + type: int + state: + description: + - Value of C(present) ensures given LLDP configuration is present on device and + LLDP is enabled, for value of C(absent) LLDP configuration is deleted and LLDP + is in disabled state. Value C(enabled) ensures LLDP protocol is enabled and + LLDP configuration if any is configured on remote device, for value of C(disabled) + it ensures LLDP protocol is disabled any LLDP configuration if any is still + present. + default: present + type: str + choices: + - present + - absent + - enabled + - disabled + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: Enable LLDP service + junipernetworks.junos.junos_lldp: + state: enabled + +- name: Disable LLDP service + junipernetworks.junos.junos_lldp: + state: disabled + +- name: Set LLDP parameters + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 30 + state: present + +- name: Delete LLDP parameters + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 30 + state: absent +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit] + + protocols { + + lldp { + + disable; + + } + + } +""" +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_interval(value, module): + if not 5 <= value <= 32768: + module.fail_json(msg="interval must be between 5 and 32768") + + +def validate_hold_multiplier(value, module): + if not 5 <= value <= 32768: + module.fail_json(msg="hold_multiplier must be between 2 and 10") + + +def validate_transmit_delay(value, module): + if not 1 <= value <= 8192: + module.fail_json(msg="transmit_delay must be between 2 and 10") + + +def validate_param_values(module, obj): + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(module.params.get(key), module) + + +def main(): + """ main entry point for module execution + """ + argument_spec = dict( + interval=dict(type="int"), + transmit_delay=dict(type="int"), + hold_multiplier=dict(type="int"), + state=dict( + default="present", + choices=["present", "absent", "enabled", "disabled"], + ), + active=dict(default=True, type="bool"), + ) + + argument_spec.update(junos_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "protocols/lldp" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ( + "interval", + {"xpath": "advertisement-interval", "leaf_only": True}, + ), + ("transmit_delay", {"xpath": "transmit-delay", "leaf_only": True}), + ( + "hold_multiplier", + {"xpath": "hold-multiplier", "leaf_only": True}, + ), + ( + "disable", + {"xpath": "disable", "tag_only": True, "is_key": True}, + ), + ] + ) + + item = module.params.copy() + state = item.get("state") + + item["disable"] = True if state in ("disabled", "absent") else False + + if state in ("enabled", "disabled"): + item["state"] = "present" + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + ele = map_obj_to_ele(module, want, top, param=item) + + with locked_config(module): + diff = load_config(module, tostring(ele), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_global.py new file mode 100644 index 00000000..b09e5833 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_global.py @@ -0,0 +1,329 @@ +#!/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 junos_lldp_global +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_lldp_global +short_description: LLDP resource module +description: +- This module manages link layer discovery protocol (LLDP) attributes on Juniper JUNOS + devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: The list of link layer discovery protocol attribute configurations + type: dict + suboptions: + enabled: + description: + - This argument is a boolean value to enabled or disable LLDP. + type: bool + interval: + description: + - Frequency at which LLDP advertisements are sent (in seconds). + type: int + address: + description: + - This argument sets the management address from LLDP. + type: str + transmit_delay: + description: + - Specify the number of seconds the device waits before sending advertisements + to neighbors after a change is made in local system. + type: int + hold_multiplier: + description: + - Specify the number of seconds that LLDP information is held before it is + discarded. The multiplier value is used in combination with the C(interval) + value. + 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 Junos device + by executing the command B(show protocols 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 + - gathered + - rendered + - parsed + default: merged +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 18.4R1. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +""" +EXAMPLES = """ +# Using merged +# Before state: +# ------------- +# user@junos01# # show protocols lldp +# +- name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + +# After state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# transmit-delay 400; +# hold-multiplier 10; + +# Using replaced +# Before state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# transmit-delay 400; +# hold-multiplier 10; + +- name: Replace provided configuration with device configuration + junipernetworks.junos.junos_lldp_global: + config: + address: 20.2.2.2 + hold_multiplier: 30 + enabled: false + state: replaced + +# After state: +# ------------- +# user@junos01# show protocols lldp +# disable; +# management-address 20.2.2.2; +# hold-multiplier 30; + +# Using deleted +# Before state: +# ------------- +# user@junos01# show protocols lldp +# management-address 20.2.2.2; +# hold-multiplier 30; + +- name: Delete lldp configuration (this will by default remove all lldp configuration) + junipernetworks.junos.junos_lldp_global: + state: deleted + +# After state: +# ------------- +# user@junos01# # show protocols lldp +# +# +# Using gathered +# Before state: +# ------------ +# +# ansible@cm123456tr21# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# transmit-delay 400; +# hold-multiplier 10; +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } +- name: Gather junos lldp_global as in given arguments + junipernetworks.junos.junos_lldp_global: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": { +# "address": "10.1.1.1", +# "hold_multiplier": 10, +# "interval": 10000, +# "transmit_delay": 400 +# } +# After state: +# ------------ +# +# ansible@cm123456tr21# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# transmit-delay 400; +# hold-multiplier 10; +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# 10.1.1.1 +# 10000 +# 400 +# 10 +# +# +# " +# +# parsed.cfg +# ------------ +# +# +# +# +# +# +# +# 0.0.0.0 +# +# ge-0/0/0.0 +# +# +# +# +# 10.1.1.1 +# 10000 +# 400 +# 10 +# +# ge-0/0/1 +# +# +# ge-0/0/2 +# +# +# +# +# +# +# - name: Convert lldp global config to argspec without connecting to the appliance +# junipernetworks.junos.junos_lldp_global: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": { +# "address": "10.1.1.1", +# "hold_multiplier": 10, +# "interval": 10000, +# "transmit_delay": 400 +# } +""" +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: [' + + 10.1.1.1 + 10000 + 400 + 10 + + +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lldp_global.lldp_global import ( + Lldp_globalArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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",)), + ] + + module = AnsibleModule( + argument_spec=Lldp_globalArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Lldp_global(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interface.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interface.py new file mode 100644 index 00000000..e71ea887 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interface.py @@ -0,0 +1,186 @@ +#!/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: junos_lldp_interface +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage LLDP interfaces configuration + on Juniper JUNOS network devices +description: +- This module provides declarative management of LLDP interfaces configuration on + Juniper JUNOS network devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_lldp_interfaces) instead. + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the interface LLDP should be configured on. + type: str + state: + description: + - Value of C(present) ensures given LLDP configured on given I(interfaces) and + is enabled, for value of C(absent) LLDP configuration on given I(interfaces) + deleted. Value C(enabled) ensures LLDP protocol is enabled on given I(interfaces) + and for value of C(disabled) it ensures LLDP is disabled on given I(interfaces). + type: str + default: present + choices: + - present + - absent + - enabled + - disabled + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: Configure LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + +- name: Disable LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: disabled + +- name: Enable LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: enabled + +- name: Delete LLDP configuration on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + +- name: Deactivate LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + active: false + +- name: Activate LLDP on specific interfaces + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + active: true +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit protocols lldp] + + interface ge-0/0/5; +""" +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def main(): + """ main entry point for module execution + """ + argument_spec = dict( + name=dict(), + state=dict( + default="present", + choices=["present", "absent", "enabled", "disabled"], + ), + active=dict(default=True, type="bool"), + ) + + argument_spec.update(junos_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "protocols/lldp/interface" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True}), + ("disable", {"xpath": "disable", "tag_only": True}), + ] + ) + + item = module.params.copy() + state = item.get("state") + item["disable"] = True if state in ("disabled", "absent") else False + + if state in ("enabled", "disabled"): + item["state"] = "present" + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + ele = map_obj_to_ele(module, want, top, param=item) + + with locked_config(module): + diff = load_config(module, tostring(ele), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interfaces.py new file mode 100644 index 00000000..cb0925a3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_lldp_interfaces.py @@ -0,0 +1,357 @@ +#!/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 junos_lldp_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_lldp_interfaces +short_description: LLDP interfaces resource module +description: +- This module manages link layer discovery protocol (LLDP) attributes of interfaces + on Juniper JUNOS devices. +version_added: 1.0.0 +author: Ganesh Nalawade (@ganeshrn) +options: + config: + description: The list of link layer discovery protocol interface attribute configurations + type: list + elements: dict + suboptions: + name: + description: + - Name of the interface LLDP needs to be configured on. + type: str + required: true + enabled: + description: + - This is a boolean value to control disabling of LLDP on the interface C(name) + 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 Junos device + by executing the command B(show protocols 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 + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged +""" +EXAMPLES = """ +# Using merged +# Before state: +# ------------- +# user@junos01# # show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; + +- name: Merge provided configuration with device configuration + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + enabled: false + state: merged + +# After state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } + +# Using replaced +# Before state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } + +- name: Replace provided configuration with device configuration + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/2 + disable: false + - name: ge-0/0/3 + enabled: false + state: replaced + +# After state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/1; +# interface ge-0/0/2; +# interface ge-0/0/3 { +# disable; +# } + +# Using overridden +# Before state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } + +- name: Override provided configuration with device configuration + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/2 + enabled: false + state: overridden + +# After state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/2 { +# disable; +# } + +# Using deleted +# Before state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/1; +# interface ge-0/0/2; +# interface ge-0/0/3 { +# disable; +# } +- name: Delete lldp interface configuration (this will not delete other lldp configuration) + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/3 + state: deleted + +# After state: +# ------------- +# user@junos01# show protocols lldp +# management-address 10.1.1.1; +# advertisement-interval 10000; +# interface ge-0/0/2; +# interface ge-0/0/1; +# Using gathered +# Before state: +# ------------ +# +#ansible@cm123456tr21# show protocols lldp +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } +- name: Gather junos lldp interfaces as in given arguments + junipernetworks.junos.junos_lldp_interfaces: + state: gathered +# Task Output (redacted) +# ----------------------- +# +# "gathered": [ +# { +# "name": "ge-0/0/1" +# }, +# { +# "enabled": false, +# "name": "ge-0/0/2" +# } +# ] +# After state: +# ------------ +# +#ansible@cm123456tr21# show protocols lldp +# interface ge-0/0/1; +# interface ge-0/0/2 { +# disable; +# } +# Using rendered +- name: Render platform specific xml from task input using rendered state + junipernetworks.junos.junos_lldp_interfaces: + config: + - name: ge-0/0/1 + - name: ge-0/0/2 + enabled: false + state: rendered +# Task Output (redacted) +# ----------------------- +# "rendered": " +# +# +# ge-0/0/1 +# +# +# +# ge-0/0/2 +# +# +# +# " +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# +# 0.0.0.0 +# +# ge-0/0/0.0 +# +# +# +# +# +# ge-0/0/1 +# +# +# ge-0/0/2 +# +# +# +# +# +# +# - name: Convert lldp interfaces config to argspec without connecting to the appliance +# junipernetworks.junos.junos_lldp_interfaces: +# running_config: "{{ lookup('file', './parsed.cfg') }}" +# state: parsed +# Task Output (redacted) +# ----------------------- +# "parsed": [ +# { +# "name": "ge-0/0/1" +# }, +# { +# "enabled": false, +# "name": "ge-0/0/2" +# } +# ] +""" + +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: [' + + + ge-0/0/1 + + + + ge-0/0/2 + + + +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.lldp_interfaces.lldp_interfaces import ( + Lldp_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + module = AnsibleModule( + argument_spec=Lldp_interfacesArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Lldp_interfaces(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_logging.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_logging.py new file mode 100644 index 00000000..8d6b7ed4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_logging.py @@ -0,0 +1,398 @@ +#!/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: junos_logging +author: Ganesh Nalawade (@ganeshrn) +short_description: Manage logging on network devices +description: +- This module provides declarative management of logging on Juniper JUNOS devices. +version_added: 1.0.0 +options: + dest: + description: + - Destination of the logs. + choices: + - console + - host + - file + - user + type: str + name: + description: + - If value of C(dest) is I(file) it indicates file-name, for I(user) it indicates + username and for I(host) indicates the host name to be notified. + type: str + facility: + description: + - Set logging facility. + type: str + level: + description: + - Set logging severity levels. + type: str + aggregate: + description: + - List of logging definitions. + type: list + elements: dict + suboptions: + dest: + description: + - Destination of the logs. + choices: + - console + - host + - file + - user + type: str + name: + description: + - If value of C(dest) is I(file) it indicates file-name, for I(user) it indicates + username and for I(host) indicates the host name to be notified. + type: str + facility: + description: + - Set logging facility. + type: str + level: + description: + - Set logging severity levels. + type: str + state: + description: + - State of the logging configuration. + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + rotate_frequency: + description: + - Rotate log frequency in minutes, this is applicable if value of I(dest) is C(file). + The acceptable value is in range of 1 to 59. This controls the frequency after + which log file is rotated. + type: int + required: false + size: + description: + - Size of the file in archive, this is applicable if value of I(dest) is C(file). + The acceptable value is in range from 65536 to 1073741824 bytes. + type: int + required: false + files: + description: + - Number of files to be archived, this is applicable if value of I(dest) is C(file). + The acceptable value is in range from 1 to 1000. + type: int + required: false + state: + description: + - State of the logging configuration. + default: present + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool + rotate_frequency: + description: + - Rotate log frequency in minutes, this is applicable if value of I(dest) is C(file). + The acceptable value is in range of 1 to 59. This controls the frequency after + which log file is rotated. + type: int + required: false + size: + description: + - Size of the file in archive, this is applicable if value of I(dest) is C(file). + The acceptable value is in range from 65536 to 1073741824 bytes. + required: false + type: int + files: + description: + - Number of files to be archived, this is applicable if value of I(dest) is C(file). + The acceptable value is in range from 1 to 1000. + type: int + required: false +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure console logging + junipernetworks.junos.junos_logging: + dest: console + facility: any + level: critical + +- name: remove console logging configuration + junipernetworks.junos.junos_logging: + dest: console + state: absent + +- name: configure file logging + junipernetworks.junos.junos_logging: + dest: file + name: test + facility: pfe + level: error + +- name: configure logging parameter + junipernetworks.junos.junos_logging: + files: 30 + size: 65536 + rotate_frequency: 10 + +- name: Configure file logging using aggregate + junipernetworks.junos.junos_logging: + dest: file + aggregate: + - name: test-1 + facility: pfe + level: critical + - name: test-2 + facility: kernel + level: emergency + active: true + +- name: Delete file logging using aggregate + junipernetworks.junos.junos_logging: + aggregate: + - {dest: file, name: test-1, facility: pfe, level: critical} + - {dest: file, name: test-2, facility: kernel, level: emergency} + state: absent +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit system syslog] + + [edit system syslog] + file interactive-commands { ... } + + file test { + + pfe critical; + + } +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, + to_param_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_files(value, module): + if value and not 1 <= value <= 1000: + module.fail_json(msg="files must be between 1 and 1000") + + +def validate_size(value, module): + if value and not 65536 <= value <= 1073741824: + module.fail_json(msg="size must be between 65536 and 1073741824") + + +def validate_rotate_frequency(value, module): + if value and not 1 <= value <= 59: + module.fail_json(msg="rotate_frequency must be between 1 and 59") + + +def validate_param_values(module, obj, param=None): + if not param: + param = module.params + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(param.get(key), module) + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + dest=dict(choices=["console", "host", "file", "user"]), + name=dict(), + facility=dict(), + level=dict(), + rotate_frequency=dict(type="int"), + size=dict(type="int"), + files=dict(type="int"), + state=dict(default="present", choices=["present", "absent"]), + active=dict(default=True, type="bool"), + ) + + aggregate_spec = deepcopy(element_spec) + + # 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(junos_argument_spec) + + required_if = [ + ("dest", "host", ["name", "facility", "level"]), + ("dest", "file", ["name", "facility", "level"]), + ("dest", "user", ["name", "facility", "level"]), + ("dest", "console", ["facility", "level"]), + ] + + module = AnsibleModule( + argument_spec=argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + params = to_param_list(module) + + requests = list() + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + module._check_required_if(required_if, param) + + item = param.copy() + dest = item.get("dest") + if dest == "console" and item.get("name"): + module.fail_json( + msg="%s and %s are mutually exclusive" % ("console", "name") + ) + + top = "system/syslog" + is_facility_key = False + field_top = None + if dest: + if dest == "console": + field_top = dest + is_facility_key = True + else: + field_top = dest + "/contents" + is_facility_key = False + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True, "top": dest}), + ( + "facility", + { + "xpath": "name", + "is_key": is_facility_key, + "top": field_top, + }, + ), + ( + "size", + { + "xpath": "size", + "leaf_only": True, + "is_key": True, + "top": "archive", + }, + ), + ( + "files", + { + "xpath": "files", + "leaf_only": True, + "is_key": True, + "top": "archive", + }, + ), + ( + "rotate_frequency", + {"xpath": "log-rotate-frequency", "leaf_only": True}, + ), + ] + ) + + if item.get("level"): + param_to_xpath_map["level"] = { + "xpath": item.get("level"), + "tag_only": True, + "top": field_top, + } + + validate_param_values(module, param_to_xpath_map, param=item) + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append(map_obj_to_ele(module, want, top, param=item)) + + diff = None + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_netconf.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_netconf.py new file mode 100644 index 00000000..ff710d21 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_netconf.py @@ -0,0 +1,196 @@ +#!/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: junos_netconf +author: Peter Sprygada (@privateip) +short_description: Configures the Junos Netconf system service +description: +- This module provides an abstraction that enables and configures the netconf system + service running on Junos devices. 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. If the C(netconf_port) is not mentioned + in the task by default netconf will be enabled on port 830 only. +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +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 + default: 830 + aliases: + - listens_on + type: int + state: + description: + - Specifies the state of the C(junos_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: +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(network_cli). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +- If C(netconf_port) value is not mentioned in task by default it will be enabled + on port 830 only. Although C(netconf_port) value can be from 1 through 65535, avoid + configuring access on a port that is normally assigned for another service. This + practice avoids potential resource conflicts. +""" + +EXAMPLES = """ +- name: enable netconf service on port 830 + junipernetworks.junos.junos_netconf: + listens_on: 830 + state: present + +- name: disable netconf service + junipernetworks.junos.junos_netconf: + state: absent +""" + +RETURN = """ +commands: + description: Returns the command sent to the remote device + returned: when changed is True + type: str + sample: 'set system services netconf ssh port 830' +""" +import re + +from ansible.module_utils._text import to_text +from ansible.module_utils.connection import ConnectionError +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + get_connection, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible.module_utils.six import iteritems + +USE_PERSISTENT_CONNECTION = True + + +def map_obj_to_commands(updates, module): + want, have = updates + commands = list() + + if want["state"] == "absent": + if have["state"] == "present": + commands.append("delete system services netconf") + else: + if have["state"] == "absent" or want["netconf_port"] != have.get( + "netconf_port" + ): + commands.append( + "set system services netconf ssh port %s" + % want["netconf_port"] + ) + + return commands + + +def parse_port(config): + match = re.search(r"port (\d+)", config) + if match: + return int(match.group(1)) + + +def map_config_to_obj(module): + conn = get_connection(module) + out = conn.get(command="show configuration system services netconf") + if out is None: + module.fail_json(msg="unable to retrieve current config") + config = str(out).strip() + + obj = {"state": "absent"} + if "ssh" in config: + obj.update({"state": "present", "netconf_port": parse_port(config)}) + 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"], + "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 load_config(module, config, commit=False): + conn = get_connection(module) + try: + resp = conn.edit_config(to_list(config) + ["top"], commit) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + diff = resp.get("diff", "") + return to_text(diff, errors="surrogate_then_replace").strip() + + +def main(): + """main entry point for module execution + """ + argument_spec = dict( + netconf_port=dict(type="int", default=830, aliases=["listens_on"]), + state=dict(default="present", choices=["present", "absent"]), + ) + + argument_spec.update(junos_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), module) + result["commands"] = commands + + if commands: + commit = not module.check_mode + diff = load_config(module, commands, commit=commit) + if diff: + if module._diff: + result["diff"] = {"prepared": diff} + result["changed"] = True + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospf_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospf_interfaces.py new file mode 100644 index 00000000..c3f06193 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospf_interfaces.py @@ -0,0 +1,614 @@ +#!/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 junos_ospf_interfaces +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +ANSIBLE_METADATA = { + "metadata_version": "1.1", + "status": ["preview"], + "supported_by": "network", +} + +DOCUMENTATION = """ +--- +module: junos_ospf_interfaces +version_added: 1.3.0 +short_description: OSPF Interfaces Resource Module. +description: + - This module manages OSPF(v2/v3) configuration of interfaces on devices running Juniper JUNOS. +author: Rohit Thakur (@rohitthakur2590) +requirements: + - ncclient (>=v0.6.4) + - xmltodict (>=0.12.0) +notes: + - This module requires the netconf system service be enabled on the device being managed. + - This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). + - Tested against JunOS v18.4R1 +options: + config: + description: A list of OSPF configuration for interfaces. + type: list + elements: dict + suboptions: + router_id: + description: + - The OSPFv3 router id. + type: str + required: true + name: + description: + - Name/Identifier 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: dict + suboptions: + area: + description: Specify the area-id + type: dict + suboptions: + area_id: + description: Specify area id. + type: str + authentication: + description: Specify authentication type + type: dict + suboptions: + simple_password: + description: + - Specify password for authentication. + type: str + md5: + description: + - Specify md5 based authentication. + type: dict + suboptions: + key_id: + description: Specify md5 key-id + type: str + key_value: + description: Specify key value + type: str + start_time: + description: Specify start time for key transmission + type: str + interface_type: + description: Specify type of interface + type: str + choices: ["nbma", "p2mp", "p2p"] + bandwidth_based_metrics: + description: Specify list of bandwidth based metrics + type: list + elements: dict + suboptions: + bandwidth: + description: + - BW to apply metric to. + type: str + choices: [1g, 10g] + metric: + description: Specify metric + type: int + priority: + description: + - Priority for the interface. + type: int + metric: + description: + - Metric applied to the interface. + type: int + te_metric: + description: + - Traffic engineering metric applied to the interface. + type: int + mtu: + description: + - Maximum OSPF packet size + type: int + ipsec_sa: + description: + - IPSec security association name + type: str + secondary: + description: + - Treat interface as secondary + type: bool + flood_reduction: + description: + - Enable flood reduction. + type: bool + demand_circuit: + description: + - Interface functions as a demand circuit. + type: bool + no_advertise_adjacency_segment: + description: + - Do not advertise an adjacency segment for this interface. + type: bool + no_eligible_backup: + description: + - Not eligible to backup traffic from protected interfaces. + type: bool + no_eligible_remote_backup: + description: + - Not eligible for Remote-LFA backup traffic from protected interfaces. + type: bool + no_interface_state_traps: + description: + - Do not send interface state change traps. + type: bool + no_neighbor_down_notification: + description: + - Don't inform other protocols about neighbor down events. + type: bool + node_link_protection: + description: + - Protect interface from both link and node faults. + type: str + dead_interval: + description: + - Dead interval (seconds). + type: int + hello_interval: + description: + - Hello interval (seconds). + type: int + poll_interval: + description: + - Poll interval (seconds). + type: int + retransmit_interval: + description: + - Retransmit interval (seconds). + type: int + transit_delay: + description: + - Transit delay (seconds). + 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 Junos device + by executing the command B(show protocols 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 + - overridden + - deleted + - parsed + - gathered + - rendered + default: merged +""" +EXAMPLES = """ +# Using merged +# +# Before state +# ------------ +# +# admin# show protocols ospf + +- name: Merge Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: merged + +# After state +# ----------- +# +# admin# show protocols ospf +# area 0.0.0.2 { +# interface ge-0/0/2.0 { +# metric 5; +# priority 3; +# } +# } + +# Using replaced +# +# Before state +# ------------ +# +# admin# show protocols ospf +# area 0.0.0.2 { +# interface ge-0/0/2.0 { +# metric 5; +# priority 3; +# } +# } +- name: Replace Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 6 + metric: 6 + state: replaced + +# After state +# ----------- +# +# admin# show protocols ospf +# area 0.0.0.1 { +# interface ge-0/0/2.0 { +# metric 6; +# priority 6; +# } +# } + +# Using overridden +# +# Before state +# ------------ +# +# admin# show protocols ospf +# area 0.0.0.3 { +# interface ge-0/0/3.0 { +# metric 5; +# priority 3; +# } +# } +# area 0.0.0.2 { +# interface ge-0/0/2.0 { +# metric 5; +# priority 3; +# } +# } + +- name: Override Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/1.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 3 + metric: 5 + state: overridden + +# After state +# ----------- +# +# admin# show protocols ospf +# area 0.0.0.1 { +# interface ge-0/0/1.0 { +# metric 5; +# priority 3; +# } +# } + +# +# Using deleted +# +# Before state +# ------------ +# +# admin# show protocols ospf +# area 0.0.0.1 { +# interface ge-0/0/1.0 { +# metric 5; +# priority 3; +# } +# } + +- name: Delete Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/1.0' + state: deleted + +# After state +# ----------- +# +# admin# show protocols ospf +# Using gathered +# +# Before state +# ------------ +# +# admin# show protocols ospf +# area 0.0.0.3 { +# interface ge-0/0/3.0 { +# metric 5; +# priority 3; +# } +# } +# area 0.0.0.2 { +# interface ge-0/0/2.0 { +# metric 5; +# priority 3; +# } +# } + +- name: Gather Junos OSPF interfaces config + junipernetworks.junos.junos_ospf_interfaces: + config: + state: gathered +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# "gathered": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "processes": { +# "area": { +# "area_id": "0.0.0.3" +# }, +# "metric": 5, +# "priority": 3 +# } +# } +# ], +# "name": "ge-0/0/3.0", +# "router_id": "10.200.16.75" +# }, +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "processes": { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "metric": 5, +# "priority": 3 +# } +# } +# ], +# "name": "ge-0/0/2.0", +# "router_id": "10.200.16.75" +# } +# ] +# +# Using rendered +# +# +- name: Render the commands for provided configuration + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: rendered + +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "rendered": " +# +# +# +# 0.0.0.2 +# +# ge-0/0/2.0 +# 3 +# 5 +# +# +# +# " +# +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# +# +# +# 0.0.0.2 +# +# 200 +# +# +# ge-0/0/2.0 +# 5 +# 3 +# +# +# +# +# +# 10.200.16.75 +# +# +# + + +- name: Parsed the device configuration to get output commands + junipernetworks.junos.junos_ospf_interfaces: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "parsed": [ +# { +# "address_family": [ +# { +# "afi": "ipv4", +# "processes": { +# "area": { +# "area_id": "0.0.0.2" +# }, +# "metric": 5, +# "priority": 3 +# } +# } +# ], +# "name": "ge-0/0/2.0", +# "router_id": "10.200.16.75" +# } +# ] +# +""" +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: [' + + + 0.0.0.3 + + ge-0/0/3.0 + 3 + 5 + + + + 0.0.0.2 + + ge-0/0/2.0 + 3 + 5 + + + +", + " + + 10.200.16.75 + 10.200.16.75 +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.ospf_interfaces.ospf_interfaces import ( + Ospf_interfacesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospf_interfaces.ospf_interfaces import ( + Ospf_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",)), + ] + module = AnsibleModule( + argument_spec=Ospf_interfacesArgs.argument_spec, + required_if=required_if, + 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/junipernetworks/junos/plugins/modules/junos_ospfv2.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv2.py new file mode 100644 index 00000000..e77fc28d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv2.py @@ -0,0 +1,345 @@ +#!/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 junos_ospfv2 +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_ospfv2 +short_description: OSPFv2 resource module +description: +- This module manages global OSPFv2 configuration on devices running Juniper JUNOS. +version_added: 1.0.0 +author: Daniel Mellado (@dmellado) +requirements: +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) +notes: +- This module requires the netconf system service be enabled on the device being managed. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- Tested against JunOS v18.4R1 +options: + config: + description: A list of OSPFv2 process configuration. + type: list + elements: dict + suboptions: + router_id: + description: + - The OSPFv2 router id. + type: str + required: true + areas: + description: + - A list of OSPFv2 areas' configuration. + type: list + elements: dict + suboptions: + area_id: + description: + - The Area ID as an integer or IP Address. + type: str + required: true + area_range: + description: + - Configure an address range for the area. + type: str + stub: + description: + - Settings for configuring the area as a stub. + type: dict + suboptions: + default_metric: + description: + - Metric for the default route in this area. + type: int + set: + description: + - Configure the area as a stub. + type: bool + interfaces: + description: + - List of interfaces in this area. + type: list + elements: dict + suboptions: + authentication: + description: Specify authentication type + type: dict + suboptions: + type: + description: + - Type of authentication to use. + type: dict + bandwidth_based_metrics: + description: Specify list of bandwidth based metrics + type: list + elements: dict + suboptions: + bandwidth: + description: + - BW to apply metric to. + type: str + choices: [1g, 10g] + metric: + description: Specify metric + type: int + name: + description: + - Name of the interface. + type: str + required: true + priority: + description: + - Priority for the interface. + type: int + metric: + description: + - Metric applied to the interface. + type: int + flood_reduction: + description: + - Enable flood reduction. + type: bool + passive: + description: Specify passive + type: bool + timers: + description: Specify timers + type: dict + suboptions: + dead_interval: + description: + - Dead interval (seconds). + type: int + hello_interval: + description: + - Hello interval (seconds). + type: int + poll_interval: + description: + - Poll interval (seconds). + type: int + retransmit_interval: + description: + - Retransmit interval (seconds). + type: int + transit_delay: + description: + - Transit delay (seconds). + type: int + external_preference: + description: + - Preference of external routes. + type: int + overload: + description: Specify time for overload mode reset + type: dict + suboptions: + timeout: + description: + - Time after which overload mode is reset (seconds). + type: int + preference: + description: + - Preference of internal routes. + type: int + prefix_export_limit: + description: + - Maximum number of external prefixes that can be exported. + type: int + reference_bandwidth: + description: + - Bandwidth for calculating metric defaults. + type: str + choices: [1g, 10g] + rfc1583compatibility: + description: + - Set RFC1583 compatibility + type: bool + spf_options: + description: + - Configure options for SPF. + type: dict + suboptions: + delay: + description: + - Time to wait before running an SPF (seconds). + type: int + holddown: + description: + - Time to hold down before running an SPF (seconds). + type: int + rapid_runs: + description: + - Number of maximum rapid SPF runs before holddown (seconds). + 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 Junos device + by executing the command B(show protocols 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 + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged +""" +EXAMPLES = """ +# Using merged +# +# Before state +# ------------ +# +# admin# show protocols ospf + +- name: Merge Junos OSPFv2 config + junipernetworks.junos.junos_ospfv2: + config: + - router_id: 10.200.16.75 + reference_bandwidth: 10g + areas: + - area_id: 0.0.0.100 + area_range: 10.200.16.0/24 + stub: + default_metric: 100 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: false + passive: true + bandwidth_based_metrics: + - bandwidth: 1g + metric: 5 + - bandwidth: 10g + metric: 40 + timers: + dead_interval: 4 + hello_interval: 2 + poll_interval: 2 + retransmit_interval: 2 + rfc1583compatibility: false + state: merged + +# After state +# ----------- +# +# admin# show protocols ospf +# reference-bandwidth 10g; +# no-rfc-1583; +# area 0.0.0.100 { +# stub default-metric 100; +# area-range 10.200.16.0/24; +# interface so-0/0/0.0 { +# passive; +# bandwidth-based-metrics { +# bandwidth 1g metric 5; +# bandwidth 10g metric 40; +# } +# metric 5; +# priority 3; +# retransmit-interval 2; +# hello-interval 2; +# dead-interval 4; +# poll-interval 2; +# } +# } + +""" +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: ['command 1', 'command 2', 'command 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.ospf.ospf import ( + OspfArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospf.ospf import ( + Ospf, +) + + +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",)), + ] + module = AnsibleModule( + argument_spec=OspfArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + result = Ospf(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv3.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv3.py new file mode 100644 index 00000000..168f3c9f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ospfv3.py @@ -0,0 +1,699 @@ +#!/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 junos_ospfv3 +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_ospfv3 +short_description: OSPFv3 resource module +description: +- This module manages global OSPFv3 configuration on devices running Juniper JUNOS. +version_added: 1.2.0 +author: Rohit Thakur (@rohitthakur2590) +requirements: +- ncclient (>=v0.6.4) +- xmltodict (>=0.12.0) +notes: +- This module requires the netconf system service be enabled on the device being managed. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- Tested against JunOS v18.4R1 +options: + config: + description: A list of OSPFv3 process configuration. + type: list + elements: dict + suboptions: + router_id: + description: + - The OSPFv3 router id. + type: str + required: true + areas: + description: + - A list of OSPFv3 areas' configuration. + type: list + elements: dict + suboptions: + area_id: + description: + - The Area ID as an integer or IP Address. + type: str + required: true + area_range: + description: + - Configure an address range for the area. + type: str + stub: + description: + - Settings for configuring the area as a stub. + type: dict + suboptions: + default_metric: + description: + - Metric for the default route in this area. + type: int + set: + description: + - Configure the area as a stub. + type: bool + interfaces: + description: + - List of interfaces in this area. + type: list + elements: dict + suboptions: + authentication: + description: Specify authentication type + type: dict + suboptions: + type: + description: + - Type of authentication to use. + type: dict + bandwidth_based_metrics: + description: Specify list of bandwidth based metrics + type: list + elements: dict + suboptions: + bandwidth: + description: + - BW to apply metric to. + type: str + choices: [1g, 10g] + metric: + description: Specify metric + type: int + name: + description: + - Name of the interface. + type: str + required: true + priority: + description: + - Priority for the interface. + type: int + metric: + description: + - Metric applied to the interface. + type: int + flood_reduction: + description: + - Enable flood reduction. + type: bool + passive: + description: Specify passive + type: bool + timers: + description: Specify timers + type: dict + suboptions: + dead_interval: + description: + - Dead interval (seconds). + type: int + hello_interval: + description: + - Hello interval (seconds). + type: int + poll_interval: + description: + - Poll interval (seconds). + type: int + retransmit_interval: + description: + - Retransmit interval (seconds). + type: int + transit_delay: + description: + - Transit delay (seconds). + type: int + external_preference: + description: + - Preference of external routes. + type: int + overload: + description: Specify time for overload mode reset + type: dict + suboptions: + timeout: + description: + - Time after which overload mode is reset (seconds). + type: int + preference: + description: + - Preference of internal routes. + type: int + prefix_export_limit: + description: + - Maximum number of external prefixes that can be exported. + type: int + reference_bandwidth: + description: + - Bandwidth for calculating metric defaults. + type: str + choices: [1g, 10g] + rfc1583compatibility: + description: + - Set RFC1583 compatibility + type: bool + spf_options: + description: + - Configure options for SPF. + type: dict + suboptions: + delay: + description: + - Time to wait before running an SPF (seconds). + type: int + holddown: + description: + - Time to hold down before running an SPF (seconds). + type: int + rapid_runs: + description: + - Number of maximum rapid SPF runs before holddown (seconds). + 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 Junos device + by executing the command B(show protocols 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 + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged +""" +EXAMPLES = """ +# Using merged +# +# Before state +# ------------ +# +# admin# show protocols ospf3 + +- name: Merge Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + state: merged + +# After state +# ----------- +# +# adimn# show protocols ospf3 +# area 0.0.0.100 { +# stub default-metric 200; +# interface so-0/0/0.0 { +# metric 5; +# priority 3; +# } +# } +# Using replaced +# +# Before state +# ------------ +# +# adimn# show protocols ospf3 +# area 0.0.0.100 { +# stub default-metric 200; +# interface so-0/0/0.0 { +# metric 5; +# priority 3; +# } +# } +- name: Replace Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: replaced + +# After state +# ----------- +# +# admin# show protocols ospf3 +# area 0.0.0.100 { +# interface so-0/0/0.0; +# } +# Using overridden +# +# Before state +# ------------ +# +# admin# show protocols ospf3 +# area 0.0.0.100 { +# interface so-0/0/0.0; +# } +- name: Override Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: overridden + +# After state +# ----------- +# +# admin# show protocols ospf3 +# area 0.0.0.100 { +# stub default-metric 200; +# interface so-0/0/0.0 { +# passive; +# metric 5; +# priority 3; +# flood-reduction; +# } +# } +# area 0.0.0.200 { +# interface ge-1/1/0.0; +# interface ge-2/2/0.0; +# } +# +# Using deleted +# +# Before state +# ------------ +# +# adimn# show protocols ospf3 +# area 0.0.0.100 { +# stub default-metric 200; +# interface so-0/0/0.0 { +# metric 5; +# priority 3; +# } +# } + +- name: Delete Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: deleted + +# After state +# ----------- +# +# admin# show protocols ospf3 +# Using gathered +# +# Before state +# ------------ +# +# adimn# show protocols ospf3 +# area 0.0.0.100 { +# stub default-metric 200; +# interface so-0/0/0.0 { +# passive; +# metric 5; +# priority 3; +# flood-reduction; +# } +# } +# area 0.0.0.200 { +# interface ge-1/1/0.0; +# interface ge-2/2/0.0; +# } + +- name: Gather Junos OSPFv3 config + junipernetworks.junos.junos_ospfv3: + config: + state: gathered +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# "gathered": { +# "areas": [ +# { +# "area_id": "0.0.0.100", +# "interfaces": [ +# { +# "flood_reduction": true, +# "metric": 5, +# "name": "so-0/0/0.0", +# "passive": true, +# "priority": 3 +# } +# ], +# "stub": { +# "default_metric": 200, +# "set": true +# } +# }, +# { +# "area_id": "0.0.0.200", +# "interfaces": [ +# { +# "name": "ge-1/1/0.0" +# }, +# { +# "name": "ge-2/2/0.0" +# } +# ] +# } +# ], +# "router_id": "10.200.16.75" +# } +# +# Using rendered +# +# +- name: Render the commands for provided configuration + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: rendered + +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "rendered": " +# +# +# +# 0.0.0.100 +# +# so-0/0/0.0 +# 3 +# +# 5 +# +# +# +# 200 +# +# +# +# 0.0.0.200 +# +# ge-1/1/0.0 +# +# +# ge-2/2/0.0 +# +# +# +# " +# +# Using parsed +# parsed.cfg +# ------------ +# +# +# +# 18.4R1-S2.4 +# +# +# ge-0/0/0 +# Configured by Ansi-Team +# +# +# gr-0/0/0 +# Configured Manually +# +# +# fxp0 +# +# 0 +# +# +# +# +# +# +# +# +# +# +# +# +# 0.0.0.100 +# +# 200 +# +# +# so-0/0/0.0 +# +# +# 5 +# 3 +# +# +# +# +# 0.0.0.200 +# +# ge-1/1/0.0 +# +# +# ge-2/2/0.0 +# +# +# +# +# +# 10.200.16.75 +# +# +# +# +# rohit +# pts/0 +# 38210 +# 2020-09-29 04:49:37 UTC +# 00:09:06 +# [edit] +# +# +# +# + +- name: Parsed the device configuration to get output commands + junipernetworks.junos.junos_ospfv3: + running_config: "{{ lookup('file', './parsed.cfg') }}" + state: parsed +# +# +# ------------------------- +# Module Execution Result +# ------------------------- +# +# +# "parsed": [ +# { +# "areas": [ +# { +# "area_id": "0.0.0.100", +# "interfaces": [ +# { +# "flood_reduction": true, +# "metric": 5, +# "name": "so-0/0/0.0", +# "passive": true, +# "priority": 3 +# } +# ], +# "stub": { +# "default_metric": 200, +# "set": true +# } +# }, +# { +# "area_id": "0.0.0.200", +# "interfaces": [ +# { +# "name": "ge-1/1/0.0" +# }, +# { +# "name": "ge-2/2/0.0" +# } +# ] +# } +# ], +# "router_id": "10.200.16.75" +# } +# ] +# +""" +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: [' + + + + 0.0.0.100 + + so-0/0/0.0 + 3 + + 5 + + + + 200 + + + + 0.0.0.200 + + ge-1/1/0.0 + + + ge-2/2/0.0 + + + +", + " + + + 10.200.16.75 +', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.ospfv3.ospfv3 import ( + Ospfv3Args, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospfv3.ospfv3 import ( + Ospfv3, +) + + +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",)), + ] + module = AnsibleModule( + argument_spec=Ospfv3Args.argument_spec, + required_if=required_if, + 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/junipernetworks/junos/plugins/modules/junos_package.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_package.py new file mode 100644 index 00000000..3960b19b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_package.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: junos_package +author: Peter Sprygada (@privateip) +short_description: Installs packages on remote devices running Junos +description: +- This module can install new and updated packages on remote devices running Junos. The + module will compare the specified package with the one running on the remote device + and install the specified version if there is a mismatch +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +options: + src: + description: + - The I(src) argument specifies the path to the source package to be installed + on the remote device in the advent of a version mismatch. The I(src) argument + can be either a localized path or a full path to the package file to install. + required: true + type: path + aliases: + - package + version: + description: + - The I(version) argument can be used to explicitly specify the version of the + package that should be installed on the remote device. If the I(version) argument + is not specified, then the version is extracts from the I(src) filename. + type: str + reboot: + description: + - In order for a package to take effect, the remote device must be restarted. When + enabled, this argument will instruct the module to reboot the device once the + updated package has been installed. If disabled or the remote package does not + need to be changed, the device will not be started. + type: bool + default: yes + no_copy: + description: + - The I(no_copy) argument is responsible for instructing the remote device on + where to install the package from. When enabled, the package is transferred + to the remote device prior to installing. + type: bool + default: no + validate: + description: + - The I(validate) argument is responsible for instructing the remote device to + skip checking the current device configuration compatibility with the package + being installed. When set to false validation is not performed. + type: bool + default: yes + force: + description: + - The I(force) argument instructs the module to bypass the package version check + and install the packaged identified in I(src) on the remote device. + type: bool + default: no + force_host: + description: + - The I(force_host) argument controls the way software package or bundle is added + on remote JUNOS host and is applicable for JUNOS QFX5100 device. If the value + is set to C(True) it will ignore any warnings while adding the host software + package or bundle. + type: bool + default: false + issu: + description: + - The I(issu) argument is a boolean flag when set to C(True) allows unified in-service + software upgrade (ISSU) feature which enables you to upgrade between two different + Junos OS releases with no disruption on the control plane and with minimal disruption + of traffic. + type: bool + default: false + ssh_private_key_file: + description: + - The C(ssh_private_key_file) argument is path to the SSH private key file. This + can be used if you need to provide a private key rather than loading the key + into the ssh-key-ring/environment + type: path + ssh_config: + description: + - The C(ssh_config) argument is path to the SSH configuration file. This can be + used to load SSH information from a configuration file. If this option is not + given by default ~/.ssh/config is queried. + type: path +requirements: +- junos-eznc +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Works with C(local) connections only. +- Since this module uses junos-eznc to establish connection with junos device the + netconf configuration parameters needs to be passed using module options for example + C(ssh_config) unlike other junos modules that uses C(netconf) connection type. +""" + +EXAMPLES = """ +# the required set of connection arguments have been purposely left off +# the examples for brevity + +- name: install local package on remote device + junipernetworks.junos.junos_package: + src: junos-vsrx-12.1X46-D10.2-domestic.tgz + +- name: install local package on remote device without rebooting + junipernetworks.junos.junos_package: + src: junos-vsrx-12.1X46-D10.2-domestic.tgz + reboot: no + +- name: install local package on remote device with jumpost + junipernetworks.junos.junos_package: + src: junos-vsrx-12.1X46-D10.2-domestic.tgz + ssh_config: /home/user/customsshconfig +""" +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + get_device, +) + +try: + from jnpr.junos.utils.sw import SW + + HAS_PYEZ = True +except ImportError: + HAS_PYEZ = False + + +def install_package(module, device): + junos = SW(device) + package = module.params["src"] + no_copy = module.params["no_copy"] + validate = module.params["validate"] + force_host = module.params["force_host"] + issu = module.params["issu"] + + def progress_log(dev, report): + module.log(report) + + module.log("installing package") + result = junos.install( + package, + progress=progress_log, + no_copy=no_copy, + validate=validate, + force_host=force_host, + issu=issu, + ) + + if not result: + module.fail_json(msg="Unable to install package on device") + + if module.params["reboot"]: + module.log("rebooting system") + junos.reboot() + + +def main(): + """ Main entry point for Ansible module execution + """ + argument_spec = dict( + src=dict(type="path", required=True, aliases=["package"]), + version=dict(), + reboot=dict(type="bool", default=True), + no_copy=dict(default=False, type="bool"), + validate=dict(default=True, type="bool"), + force=dict(type="bool", default=False), + force_host=dict(type="bool", default=False), + issu=dict(type="bool", default=False), + ssh_private_key_file=dict(type="path"), + ssh_config=dict(type="path"), + ) + + argument_spec.update(junos_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + if module.params["provider"] is None: + module.params["provider"] = {} + + if not HAS_PYEZ: + module.fail_json( + msg="junos-eznc is required but does not appear to be installed. " + "It can be installed using `pip install junos-eznc`" + ) + + result = dict(changed=False) + + do_upgrade = module.params["force"] or False + + device = get_device(module) + + if not module.params["force"]: + device.facts_refresh() + has_ver = device.facts.get("version") + wants_ver = module.params["version"] + do_upgrade = has_ver != wants_ver + + if do_upgrade: + if not module.check_mode: + install_package(module, device) + result["changed"] = True + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ping.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ping.py new file mode 100644 index 00000000..697c1f2d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_ping.py @@ -0,0 +1,253 @@ +#!/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: junos_ping +short_description: Tests reachability using ping from devices running Juniper JUNOS +description: +- Tests reachability using ping from devices running Juniper JUNOS to a remote destination. +- Tested against Junos (17.3R1.10) +- For a general purpose network module, see the M(ansible.netcommon.net_ping) module. +- For Windows targets, use the M(ansible.windows.win_ping) module instead. +- For targets running Python, use the M(ansible.builtin.ping) module instead. +version_added: 1.0.0 +author: +- Nilashish Chakraborty (@NilashishC) +options: + dest: + description: + - The IP Address or hostname (resolvable by the device) of the remote node. + type: str + required: true + count: + description: + - Number of packets to send to check reachability. + type: int + default: 5 + source: + description: + - The IP Address to use while sending the ping packet(s). + type: str + interface: + description: + - The source interface to use while sending the ping packet(s). + type: str + ttl: + description: + - The time-to-live value for the ICMP packet(s). + type: int + size: + description: + - Determines the size (in bytes) of the ping packet(s). + type: int + interval: + description: + - Determines the interval (in seconds) between consecutive pings. + type: int + state: + description: + - Determines if the expected result is success or fail. + type: str + choices: + - absent + - present + default: present +notes: +- For a general purpose network module, see the M(ansible.netcommon..net_ping) module. +- For Windows targets, use the M(ansible.windows.win_ping) module instead. +- For targets running Python, use the M(ansible.builtin.ping) module instead. +- This module works only with connection C(network_cli). +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: Test reachability to 10.10.10.10 + junipernetworks.junos.junos_ping: + dest: 10.10.10.10 + +- name: Test reachability to 10.20.20.20 using source and size set + junipernetworks.junos.junos_ping: + dest: 10.20.20.20 + size: 1024 + ttl: 128 + +- name: Test unreachability to 10.30.30.30 using interval + junipernetworks.junos.junos_ping: + dest: 10.30.30.30 + interval: 3 + state: absent + +- name: Test reachability to 10.40.40.40 setting count and interface + junipernetworks.junos.junos_ping: + dest: 10.40.40.40 + interface: fxp0 + count: 20 + size: 512 +""" + +RETURN = """ +commands: + description: List of commands sent. + returned: always + type: list + sample: ["ping 10.8.38.44 count 10 source 10.8.38.38 ttl 128"] +packet_loss: + description: Percentage of packets lost. + returned: always + type: str + sample: "0%" +packets_rx: + description: Packets successfully received. + returned: always + type: int + sample: 20 +packets_tx: + description: Packets successfully transmitted. + returned: always + type: int + sample: 20 +rtt: + description: The round trip time (RTT) stats. + returned: when ping succeeds + type: dict + sample: {"avg": 2, "max": 8, "min": 1, "stddev": 24} +""" + +import re +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + get_connection, +) + + +def main(): + """ main entry point for module execution + """ + argument_spec = dict( + count=dict(type="int", default=5), + dest=dict(type="str", required=True), + source=dict(), + interface=dict(), + ttl=dict(type="int"), + size=dict(type="int"), + interval=dict(type="int"), + state=dict( + type="str", choices=["absent", "present"], default="present" + ), + ) + + argument_spec.update(junos_argument_spec) + + module = AnsibleModule(argument_spec=argument_spec) + + count = module.params["count"] + dest = module.params["dest"] + source = module.params["source"] + size = module.params["size"] + ttl = module.params["ttl"] + interval = module.params["interval"] + interface = module.params["interface"] + warnings = list() + + results = {"changed": False} + if warnings: + results["warnings"] = warnings + + results["commands"] = build_ping( + dest, count, size, interval, source, ttl, interface + ) + conn = get_connection(module) + + ping_results = conn.get(results["commands"]) + + rtt_info, rate_info = None, None + for line in ping_results.split("\n"): + if line.startswith("round-trip"): + rtt_info = line + if line.startswith("%s packets transmitted" % count): + rate_info = line + + if rtt_info: + rtt = parse_rtt(rtt_info) + for k, v in rtt.items(): + if rtt[k] is not None: + rtt[k] = float(v) + results["rtt"] = rtt + + pkt_loss, rx, tx = parse_rate(rate_info) + results["packet_loss"] = str(pkt_loss) + "%" + results["packets_rx"] = int(rx) + results["packets_tx"] = int(tx) + + validate_results(module, pkt_loss, results) + + module.exit_json(**results) + + +def build_ping( + dest, + count, + size=None, + interval=None, + source=None, + ttl=None, + interface=None, +): + cmd = "ping {0} count {1}".format(dest, str(count)) + + if source: + cmd += " source {0}".format(source) + + if interface: + cmd += " interface {0}".format(interface) + + if ttl: + cmd += " ttl {0}".format(str(ttl)) + + if size: + cmd += " size {0}".format(str(size)) + + if interval: + cmd += " interval {0}".format(str(interval)) + + return cmd + + +def parse_rate(rate_info): + rate_re = re.compile( + r"(?P\d*) packets transmitted,(?:\s*)(?P\d*) packets received,(?:\s*)(?P\d*)% packet loss" + ) + rate = rate_re.match(rate_info) + + return rate.group("pkt_loss"), rate.group("rx"), rate.group("tx") + + +def parse_rtt(rtt_info): + rtt_re = re.compile( + r"round-trip (?:.*)=(?:\s*)(?P\d+\.\d+).(?:\d*)/(?P\d+\.\d+).(?:\d*)/(?P\d*\.\d*).(?:\d*)/(?P\d*\.\d*)" + ) + rtt = rtt_re.match(rtt_info) + + return rtt.groupdict() + + +def validate_results(module, loss, results): + state = module.params["state"] + if state == "present" and int(loss) == 100: + module.fail_json(msg="Ping failed unexpectedly", **results) + elif state == "absent" and int(loss) < 100: + module.fail_json(msg="Ping succeeded unexpectedly", **results) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_rpc.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_rpc.py new file mode 100644 index 00000000..4f547327 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_rpc.py @@ -0,0 +1,177 @@ +#!/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: junos_rpc +author: Peter Sprygada (@privateip) +short_description: Runs an arbitrary RPC over NetConf on an Juniper JUNOS device +description: +- Sends a request to the remote device running JUNOS to execute the specified RPC + using the NetConf transport. The reply is then returned to the playbook in the + C(xml) key. If an alternate output format is requested, the reply is transformed + to the requested output. +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +options: + rpc: + description: + - The C(rpc) argument specifies the RPC call to send to the remote devices to + be executed. The RPC Reply message is parsed and the contents are returned + to the playbook. + type: str + required: true + args: + description: + - The C(args) argument provides a set of arguments for the RPC call and are encoded + in the request message. This argument accepts a set of key=value arguments. + type: dict + attrs: + description: + - The C(attrs) arguments defines a list of attributes and their values to set + for the RPC call. This accepts a dictionary of key-values. + type: dict + output: + description: + - The C(output) argument specifies the desired output of the return data. This + argument accepts one of C(xml), C(text), or C(json). For C(json), the JUNOS + device must be running a version of software that supports native JSON output. + default: xml + type: str + choices: ["xml", "json", "text"] +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +""" + +EXAMPLES = """ +- name: collect interface information using rpc + junipernetworks.junos.junos_rpc: + rpc: get-interface-information + args: + interface-name: em0 + media: true + +- name: get system information + junipernetworks.junos.junos_rpc: + rpc: get-system-information + +- name: load configuration + junipernetworks.junos.junos_rpc: + rpc: load-configuration + attrs: + action: override + url: /tmp/config.conf +""" + +RETURN = """ +xml: + description: The xml return string from the rpc request. + returned: always + type: str +output: + description: The rpc rely converted to the output format. + returned: always + type: str +output_lines: + description: The text output split into lines for readability. + returned: always + type: list +""" +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf import ( + exec_rpc, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible.module_utils.six import iteritems + +USE_PERSISTENT_CONNECTION = True + +try: + from lxml.etree import Element, SubElement +except ImportError: + from xml.etree.ElementTree import Element, SubElement + + +def main(): + """main entry point for Ansible module + """ + argument_spec = dict( + rpc=dict(required=True), + args=dict(type="dict"), + attrs=dict(type="dict"), + output=dict(default="xml", choices=["xml", "json", "text"]), + ) + + argument_spec.update(junos_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=False + ) + + warnings = list() + result = {"changed": False, "warnings": warnings} + + rpc = str(module.params["rpc"]).replace("_", "-") + + if all((module.check_mode, not rpc.startswith("get"))): + module.fail_json(msg="invalid rpc for running in check_mode") + + args = module.params["args"] or {} + attrs = module.params["attrs"] or {} + + xattrs = {"format": module.params["output"]} + + for key, value in iteritems(attrs): + xattrs.update({key: value}) + + element = Element(module.params["rpc"], xattrs) + + for key, value in iteritems(args): + key = str(key).replace("_", "-") + if isinstance(value, list): + for item in value: + child = SubElement(element, key) + if item is not True: + child.text = item + else: + child = SubElement(element, key) + if value is not True: + child.text = value + + reply = exec_rpc(module, tostring(element), ignore_warning=False) + + result["xml"] = tostring(reply) + + if module.params["output"] == "text": + data = reply.find(".//output") + result["output"] = data.text.strip() + result["output_lines"] = result["output"].split("\n") + + elif module.params["output"] == "json": + result["output"] = module.from_json(reply.text.strip()) + + else: + result["output"] = tostring(reply).split("\n") + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_scp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_scp.py new file mode 100644 index 00000000..33462e65 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_scp.py @@ -0,0 +1,175 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2018, 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: junos_scp +author: Christian Giese (@GIC-de) +short_description: Transfer files from or to remote devices running Junos +description: +- This module transfers files via SCP from or to remote devices running Junos. +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +options: + src: + description: + - The C(src) argument takes a single path, or a list of paths to be transferred. + The argument C(recursive) must be C(true) to transfer directories. + required: true + type: list + elements: str + dest: + description: + - The C(dest) argument specifies the path in which to receive the files. + type: path + default: . + recursive: + description: + - The C(recursive) argument enables recursive transfer of files and directories. + type: bool + default: no + remote_src: + description: + - The C(remote_src) argument enables the download of files (I(scp get)) from the + remote device. The default behavior is to upload files (I(scp put)) to the remote + device. + type: bool + default: no + ssh_private_key_file: + description: + - The C(ssh_private_key_file) argument is path to the SSH private key file. This + can be used if you need to provide a private key rather than loading the key + into the ssh-key-ring/environment + type: path + ssh_config: + description: + - The C(ssh_config) argument is path to the SSH configuration file. This can be + used to load SSH information from a configuration file. If this option is not + given by default ~/.ssh/config is queried. + type: path +requirements: +- junos-eznc +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vMX JUNOS version 17.3R1.10. +- Works with C(local) connections only. +- Since this module uses junos-eznc to establish connection with junos device the + netconf configuration parameters needs to be passed using module options for example + C(ssh_config) unlike other junos modules that uses C(netconf) connection type. +""" + +EXAMPLES = """ +# the required set of connection arguments have been purposely left off +# the examples for brevity +- name: upload local file to home directory on remote device + junipernetworks.junos.junos_scp: + src: test.tgz + +- name: upload local file to tmp directory on remote device + junipernetworks.junos.junos_scp: + src: test.tgz + dest: /tmp/ + +- name: download file from remote device + junipernetworks.junos.junos_scp: + src: test.tgz + remote_src: true + +- name: ssh config file path for jumphost config + junipernetworks.junos.junos_scp: + src: test.tgz + remote_src: true + ssh_config: /home/user/customsshconfig +""" + +RETURN = """ +changed: + description: always true + returned: always + type: bool +""" +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + get_device, +) +from ansible.module_utils._text import to_native + +try: + from jnpr.junos.utils.scp import SCP + + HAS_PYEZ = True +except ImportError: + HAS_PYEZ = False + + +def transfer_files(module, device): + dest = module.params["dest"] + recursive = module.params["recursive"] + + with SCP(device) as scp: + for src in module.params["src"]: + if module.params["remote_src"]: + scp.get(src.strip(), local_path=dest, recursive=recursive) + else: + scp.put(src.strip(), remote_path=dest, recursive=recursive) + + +def main(): + """ Main entry point for Ansible module execution + """ + argument_spec = dict( + src=dict(type="list", required=True, elements="str"), + dest=dict(type="path", required=False, default="."), + recursive=dict(type="bool", default=False), + remote_src=dict(type="bool", default=False), + ssh_private_key_file=dict(type="path"), + ssh_config=dict(type="path"), + ) + + argument_spec.update(junos_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + if module.params["provider"] is None: + module.params["provider"] = {} + + if not HAS_PYEZ: + module.fail_json( + msg="junos-eznc is required but does not appear to be installed. " + "It can be installed using `pip install junos-eznc`" + ) + + result = dict(changed=True) + + if not module.check_mode: + # open pyez connection and transfer files via SCP + try: + device = get_device(module) + transfer_files(module, device) + except Exception as ex: + module.fail_json(msg=to_native(ex)) + finally: + try: + # close pyez connection and ignore exceptions + device.close() + except Exception: + pass + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_route.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_route.py new file mode 100644 index 00000000..c1278c52 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_route.py @@ -0,0 +1,307 @@ +#!/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: junos_static_route +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage static IP routes + on Juniper JUNOS network devices +description: +- This module provides declarative management of static IP routes on Juniper JUNOS + network devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_static_routes) instead. + removed_at_date: '2022-06-01' +options: + address: + description: + - Network address with prefix of the static route. + type: str + aliases: + - prefix + next_hop: + description: + - Next hop IP of the static route. + type: str + qualified_next_hop: + description: + - Qualified next hop IP of the static route. Qualified next hops allow to associate + preference with a particular next-hop address. + type: str + preference: + description: + - Global admin preference of the static route. + type: int + aliases: + - admin_distance + qualified_preference: + description: + - Assign preference for qualified next hop. + type: int + aggregate: + description: List of static route definitions + type: list + elements: dict + suboptions: + address: + description: + - Network address with prefix of the static route. + type: str + next_hop: + description: + - Next hop IP of the static route. + type: str + qualified_next_hop: + description: + - Qualified next hop IP of the static route. Qualified next hops allow to associate + preference with a particular next-hop address. + type: str + preference: + description: + - Global admin preference of the static route. + type: int + aliases: + - admin_distance + qualified_preference: + description: + - Assign preference for qualified next hop. + type: int + state: + description: + - State of the static route configuration. + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + state: + description: + - State of the static route configuration. + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure static route + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + next_hop: 10.0.0.1 + preference: 10 + qualified_next_hop: 10.0.0.2 + qualified_preference: 3 + state: present + +- name: delete static route + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + state: absent + +- name: deactivate static route configuration + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + next_hop: 10.0.0.1 + preference: 10 + qualified_next_hop: 10.0.0.2 + qualified_preference: 3 + state: present + active: false + +- name: activate static route configuration + junipernetworks.junos.junos_static_route: + address: 192.168.2.0/24 + next_hop: 10.0.0.1 + preference: 10 + qualified_next_hop: 10.0.0.2 + qualified_preference: 3 + state: present + active: true + +- name: Configure static route using aggregate + junipernetworks.junos.junos_static_route: + aggregate: + - {address: 4.4.4.0/24, next_hop: 3.3.3.3, qualified_next_hop: 5.5.5.5, qualified_preference: 30} + - {address: 5.5.5.0/24, next_hop: 6.6.6.6, qualified_next_hop: 7.7.7.7, qualified_preference: 12} + preference: 10 + +- name: Delete static route using aggregate + junipernetworks.junos.junos_static_route: + aggregate: + - address: 4.4.4.0/24 + - address: 5.5.5.0/24 + state: absent +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit routing-options static] + route 2.2.2.0/24 { ... } + + route 4.4.4.0/24 { + next-hop 3.3.3.3; + qualified-next-hop 5.5.5.5 { + + preference 30; + } + + preference 10; + + } +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, + to_param_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + address=dict(aliases=["prefix"]), + next_hop=dict(), + preference=dict(type="int", aliases=["admin_distance"]), + qualified_next_hop=dict(type="str"), + qualified_preference=dict(type="int"), + state=dict(default="present", choices=["present", "absent"]), + active=dict(default=True, type="bool"), + ) + + aggregate_spec = deepcopy(element_spec) + aggregate_spec["address"] = 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(junos_argument_spec) + + required_one_of = [["aggregate", "address"]] + mutually_exclusive = [["aggregate", "address"]] + + module = AnsibleModule( + argument_spec=argument_spec, + required_one_of=required_one_of, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "routing-options/static/route" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("address", {"xpath": "name", "is_key": True}), + ("next_hop", "next-hop"), + ("preference", "preference/metric-value"), + ( + "qualified_next_hop", + {"xpath": "name", "top": "qualified-next-hop"}, + ), + ( + "qualified_preference", + {"xpath": "preference", "top": "qualified-next-hop"}, + ), + ] + ) + + params = to_param_list(module) + requests = list() + + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + if item["state"] == "present": + if not item["address"] and item["next_hop"]: + module.fail_json( + msg="parameters are required together: ['address', 'next_hop']" + ) + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append(map_obj_to_ele(module, want, top, param=item)) + + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_routes.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_routes.py new file mode 100644 index 00000000..0fc1173b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_static_routes.py @@ -0,0 +1,306 @@ +#!/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 junos_static_routes +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_static_routes +short_description: Static routes resource module +description: This module provides declarative management of static routes on Juniper + JUNOS devices +version_added: 1.0.0 +author: Daniel Mellado (@dmellado) +requirements: +- ncclient (>=v0.6.4) +- xmltodict (>=0.12) +notes: +- This module requires the netconf system service be enabled on the device being managed. +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- Tested against JunOS v18.4R1 +options: + config: + description: A dictionary of static routes options + type: list + elements: dict + suboptions: + vrf: + description: + - Virtual Routing and Forwarding (VRF) name + type: str + address_families: + description: + - Address family to use for the static routes + elements: dict + type: list + suboptions: + afi: + description: + - afi to use for the static routes + type: str + required: true + choices: + - ipv4 + - ipv6 + routes: + description: + - Static route configuration + elements: dict + type: list + suboptions: + dest: + description: + - Static route destination including prefix + type: str + next_hop: + elements: dict + type: list + description: + - Next hop to destination + suboptions: + forward_router_address: + description: + - List of next hops + type: str + metric: + description: + - Metric value for the static route + 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 Junos device + by executing the command B(show routing-options). + - 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 + - rendered + - parsed + default: merged +""" + +EXAMPLES = """ +# Using deleted + +# Before state +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 172.16.1.2; +# route 192.168.16.0/24 next-hop 172.16.1.2; +# route 10.200.16.75/24 next-hop 10.200.16.2; +# } + +- name: Delete provided configuration (default operation is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 10.200.16.75/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: deleted + +# After state: +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 172.16.1.2; +# route 192.168.16.0/24 next-hop 172.16.1.2; +# } + +# Using merged + +# Before state +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 172.16.1.2; +# route 192.168.16.0/24 next-hop 172.16.1.2; +# } + +- name: Merge provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 10.200.16.75/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: merged + +# After state: +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 172.16.1.2; +# route 192.168.16.0/24 next-hop 172.16.1.2; +# route 10.200.16.75/24 next-hop 10.200.16.2; +# } + +# Using overridden + +# Before state +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 172.16.1.2; +# route 192.168.16.0/24 next-hop 172.16.0.1; +# } + +- name: Override provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 10.200.16.75/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: overridden + +# After state: +# ------------ +# +# admin# show routing-options +# static { +# route 10.200.16.75/24 next-hop 10.200.16.2; +# } + +# Using replaced + +# Before state +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 172.16.1.2; +# route 192.168.16.0/24 next-hop 172.16.1.2; +# } + +- name: Replace provided configuration with device configuration (default operation + is merge) + junipernetworks.junos.junos_static_routes: + config: + - address_families: + - afi: ipv4 + routes: + - dest: 192.168.47.0/24 + next_hop: + - forward_router_address: 10.200.16.2 + state: replaced + +# After state: +# ------------ +# +# admin# show routing-options +# static { +# route 192.168.47.0/24 next-hop 10.200.16.2; +# route 192.168.16.0/24 next-hop 172.16.1.2; +# } + + +""" +RETURN = """ +before: + description: The configuration prior to the model invocation. + returned: always + type: str + 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: str + 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: ['command 1', 'command 2', 'command 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.static_routes.static_routes import ( + Static_routesArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.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", "rendered", ("config",)), + ("state", "overridden", ("config",)), + ("state", "parsed", ("running_config",)), + ] + module = AnsibleModule( + argument_spec=Static_routesArgs.argument_spec, + required_if=required_if, + 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/junipernetworks/junos/plugins/modules/junos_system.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_system.py new file mode 100644 index 00000000..4480a6b3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_system.py @@ -0,0 +1,212 @@ +#!/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: junos_system +author: Ganesh Nalawade (@ganeshrn) +short_description: Manage the system attributes on Juniper JUNOS devices +description: +- This module provides declarative management of node system attributes on Juniper + JUNOS devices. It provides an option to configure host system parameters or remove + those parameters from the device active configuration. +version_added: 1.0.0 +options: + hostname: + description: + - Configure the device hostname parameter. This option takes an ASCII string value. + type: str + 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 + name_servers: + description: + - List of DNS name servers by IP address to use to perform name resolution lookups. This + argument accepts either 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 + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure hostname and domain name + junipernetworks.junos.junos_system: + hostname: junos01 + domain_name: test.example.com + domain-search: + - ansible.com + - redhat.com + - juniper.net + +- name: remove configuration + junipernetworks.junos.junos_system: + state: absent + +- name: configure name servers + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit system] + + host-name test; + + domain-name ansible.com; + + domain-search redhat.com; + [edit system name-server] + 172.26.1.1 { ... } + + 8.8.8.8; +""" +import collections + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_param_values(module, obj): + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(module.params.get(key), module) + + +def main(): + """ main entry point for module execution + """ + argument_spec = dict( + hostname=dict(), + domain_name=dict(), + domain_search=dict(type="list", elements="str"), + name_servers=dict(type="list", elements="str"), + state=dict(choices=["present", "absent"], default="present"), + active=dict(default=True, type="bool"), + ) + + argument_spec.update(junos_argument_spec) + + params = ["hostname", "domain_name", "domain_search", "name_servers"] + required_if = [ + ("state", "present", params, True), + ("state", "absent", params, True), + ("state", "active", params, True), + ("state", "suspend", params, True), + ] + + module = AnsibleModule( + argument_spec=argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "system" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("hostname", {"xpath": "host-name", "leaf_only": True}), + ("domain_name", {"xpath": "domain-name", "leaf_only": True}), + ( + "domain_search", + { + "xpath": "domain-search", + "leaf_only": True, + "value_req": True, + }, + ), + ("name_servers", {"xpath": "name-server/name", "is_key": True}), + ] + ) + + validate_param_values(module, param_to_xpath_map) + + want = map_params_to_obj(module, param_to_xpath_map) + ele = map_obj_to_ele(module, want, top) + + with locked_config(module): + diff = load_config(module, tostring(ele), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_user.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_user.py new file mode 100644 index 00000000..75a047eb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_user.py @@ -0,0 +1,460 @@ +#!/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: junos_user +author: Peter Sprygada (@privateip) +short_description: Manage local user accounts on Juniper JUNOS devices +description: +- This module manages locally configured user accounts on remote network devices running + the JUNOS operating system. It provides a set of arguments for creating, removing + and updating locally defined accounts +version_added: 1.0.0 +extends_documentation_fragment: +- junipernetworks.junos.junos +options: + aggregate: + description: + - The C(aggregate) argument defines a list of users to be configured on the remote + device. The list of users will be compared against the current users and only + changes will be added or removed from the device configuration. This argument + is mutually exclusive with the name argument. + aliases: + - users + - collection + type: list + elements: dict + suboptions: + name: + description: + - The C(name) argument defines the username of the user to be created on the system. This + argument must follow appropriate usernaming conventions for the target device + running JUNOS. This argument is mutually exclusive with the C(aggregate) argument. + required: true + type: str + full_name: + description: + - The C(full_name) argument provides the full name of the user account to be created + on the remote device. This argument accepts any text string value. + type: str + role: + description: + - The C(role) argument defines the role of the user account on the remote system. User + accounts can have more than one role configured. + type: str + choices: + - operator + - read-only + - super-user + - unauthorized + sshkey: + description: + - The C(sshkey) argument defines the public SSH key to be configured for the user + account on the remote system. This argument must be a valid SSH key + type: str + encrypted_password: + description: + - The C(encrypted_password) argument set already hashed password for the user + account on the remote system. + type: str + purge: + description: + - The C(purge) argument instructs the module to consider the users definition + absolute. It will remove any previously configured users on the device with + the exception of the current defined set of aggregate. + type: bool + default: no + state: + description: + - The C(state) argument configures the state of the user definitions as it relates + to the device operational configuration. When set to I(present), the user should + be configured in the device active configuration and when set to I(absent) the + user should not be in the device active configuration + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + name: + description: + - The C(name) argument defines the username of the user to be created on the system. This + argument must follow appropriate usernaming conventions for the target device + running JUNOS. This argument is mutually exclusive with the C(aggregate) argument. + type: str + full_name: + description: + - The C(full_name) argument provides the full name of the user account to be created + on the remote device. This argument accepts any text string value. + type: str + role: + description: + - The C(role) argument defines the role of the user account on the remote system. User + accounts can have more than one role configured. + type: str + choices: + - operator + - read-only + - super-user + - unauthorized + sshkey: + description: + - The C(sshkey) argument defines the public SSH key to be configured for the user + account on the remote system. This argument must be a valid SSH key + type: str + encrypted_password: + description: + - The C(encrypted_password) argument set already hashed password for the user + account on the remote system. + type: str + purge: + description: + - The C(purge) argument instructs the module to consider the users definition + absolute. It will remove any previously configured users on the device with + the exception of the current defined set of aggregate. + type: bool + default: false + state: + description: + - The C(state) argument configures the state of the user definitions as it relates + to the device operational configuration. When set to I(present), the user should + be configured in the device active configuration and when set to I(absent) the + user should not be in the device active configuration + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + default: yes +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +""" + +EXAMPLES = """ +- name: create new user account + junipernetworks.junos.junos_user: + name: ansible + role: super-user + sshkey: "{{ lookup('file', '~/.ssh/ansible.pub') }}" + state: present + +- name: remove a user account + junipernetworks.junos.junos_user: + name: ansible + state: absent + +- name: remove all user accounts except ansible + junipernetworks.junos.junos_user: + aggregate: + - name: ansible + purge: yes + +- name: set user password + junipernetworks.junos.junos_user: + name: ansible + role: super-user + encrypted_password: "{{ 'my-password' | password_hash('sha512') }}" + state: present + +- name: Create list of users + junipernetworks.junos.junos_user: + aggregate: + - {name: test_user1, full_name: test_user2, role: operator, state: present} + - {name: test_user2, full_name: test_user2, role: read-only, state: present} + +- name: Delete list of users + junipernetworks.junos.junos_user: + aggregate: + - {name: test_user1, full_name: test_user2, role: operator, state: absent} + - {name: test_user2, full_name: test_user2, role: read-only, state: absent} +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit system login] + + user test-user { + + uid 2005; + + class read-only; + + } +""" +from functools import partial + +from copy import deepcopy + +from ansible.module_utils._text import to_text +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.connection import ConnectionError +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + get_connection, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + locked_config, +) +from ansible.module_utils.six import iteritems + +try: + from lxml.etree import Element, SubElement +except ImportError: + from xml.etree.ElementTree import Element, SubElement + +ROLES = ["operator", "read-only", "super-user", "unauthorized"] +USE_PERSISTENT_CONNECTION = True + + +def handle_purge(module, want): + want_users = [item["name"] for item in want] + element = Element("system") + login = SubElement(element, "login") + + conn = get_connection(module) + try: + reply = conn.execute_rpc( + tostring(Element("get-configuration")), ignore_warning=False + ) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + + users = reply.xpath("configuration/system/login/user/name") + if users: + for item in users: + name = item.text + if name not in want_users and name != "root": + user = SubElement(login, "user", {"operation": "delete"}) + SubElement(user, "name").text = name + if element.xpath("/system/login/user/name"): + return element + + +def map_obj_to_ele(module, want): + element = Element("system") + login = SubElement(element, "login") + + for item in want: + if item["state"] != "present": + if item["name"] == "root": + module.fail_json(msg="cannot delete the 'root' account.") + operation = "delete" + else: + operation = "merge" + + if item["name"] != "root": + user = SubElement(login, "user", {"operation": operation}) + SubElement(user, "name").text = item["name"] + else: + user = auth = SubElement( + element, "root-authentication", {"operation": operation} + ) + + if operation == "merge": + if item["name"] == "root" and ( + not item["active"] or item["role"] or item["full_name"] + ): + module.fail_json( + msg="'root' account cannot be deactivated or be assigned a role and a full name" + ) + + if item["active"]: + user.set("active", "active") + else: + user.set("inactive", "inactive") + + if item["role"]: + SubElement(user, "class").text = item["role"] + + if item.get("full_name"): + SubElement(user, "full-name").text = item["full_name"] + + if item.get("sshkey"): + auth = SubElement(user, "authentication") + if "ssh-rsa" in item["sshkey"]: + ssh_rsa = SubElement(auth, "ssh-rsa") + elif "ssh-dss" in item["sshkey"]: + ssh_rsa = SubElement(auth, "ssh-dsa") + elif "ecdsa-sha2" in item["sshkey"]: + ssh_rsa = SubElement(auth, "ssh-ecdsa") + elif "ssh-ed25519" in item["sshkey"]: + ssh_rsa = SubElement(auth, "ssh-ed25519") + SubElement(ssh_rsa, "name").text = item["sshkey"] + + if item.get("encrypted_password"): + auth = SubElement(user, "authentication") + SubElement(auth, "encrypted-password").text = item[ + "encrypted_password" + ] + + return element + + +def get_param_value(key, item, module): + # if key doesn't exist in the item, get it from module.params + if not item.get(key): + value = module.params[key] + + # if key does exist, do a type check on it to validate it + else: + value_type = module.argument_spec[key].get("type", "str") + type_checker = 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, module) + + return value + + +def map_params_to_obj(module): + aggregate = module.params["aggregate"] + if not aggregate: + if not module.params["name"] and module.params["purge"]: + return list() + elif not module.params["name"]: + module.fail_json(msg="missing required argument: name") + else: + collection = [{"name": module.params["name"]}] + else: + collection = list() + for item in aggregate: + if not isinstance(item, dict): + collection.append({"username": item}) + elif "name" not in item: + module.fail_json(msg="missing required argument: name") + else: + collection.append(item) + + objects = list() + + for item in collection: + get_value = partial(get_param_value, item=item, module=module) + item.update( + { + "full_name": get_value("full_name"), + "role": get_value("role"), + "encrypted_password": get_value("encrypted_password"), + "sshkey": get_value("sshkey"), + "state": get_value("state"), + "active": get_value("active"), + } + ) + + for key, value in iteritems(item): + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if all((value, validator)): + validator(value, module) + + objects.append(item) + + return objects + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(), + full_name=dict(), + role=dict(choices=ROLES), + encrypted_password=dict(no_log=True), + sshkey=dict(), + state=dict(choices=["present", "absent"], default="present"), + purge=dict(type="bool", default=False), + active=dict(type="bool", default=True), + ) + + 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, + aliases=["collection", "users"], + ), + purge=dict(default=False, type="bool"), + ) + + argument_spec.update(element_spec) + argument_spec.update(junos_argument_spec) + + mutually_exclusive = [["aggregate", "name"]] + + module = AnsibleModule( + argument_spec=argument_spec, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + warnings = list() + result = {"changed": False, "warnings": warnings} + + want = map_params_to_obj(module) + ele = map_obj_to_ele(module, want) + + purge_request = None + if module.params["purge"]: + purge_request = handle_purge(module, want) + + with locked_config(module): + if purge_request: + load_config( + module, tostring(purge_request), warnings, action="replace" + ) + diff = load_config(module, tostring(ele), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlan.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlan.py new file mode 100644 index 00000000..4b07904d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlan.py @@ -0,0 +1,316 @@ +#!/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: junos_vlan +author: Ganesh Nalawade (@ganeshrn) +short_description: (deprecated, removed after 2022-06-01) Manage VLANs on Juniper + JUNOS network devices +description: +- This module provides declarative management of VLANs on Juniper JUNOS network devices. +version_added: 1.0.0 +deprecated: + why: Updated modules released with more functionality + alternative: Use M(junipernetworks.junos.junos_vlans) instead. + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the VLAN. + type: str + vlan_id: + description: + - ID of the VLAN. Range 1-4094. + type: int + l3_interface: + description: + - Name of logical layer 3 interface. + type: str + filter_input: + description: + - The name of input filter. + type: str + filter_output: + description: + - The name of output filter. + type: str + description: + description: + - Text description of VLANs. + type: str + interfaces: + description: + - List of interfaces to check the VLAN has been configured correctly. + type: list + elements: str + aggregate: + description: List of VLANs definitions. + type: list + elements: dict + suboptions: + name: + description: + - Name of the VLAN. + type: str + required: true + vlan_id: + description: + - ID of the VLAN. Range 1-4094. + required: true + type: int + l3_interface: + description: + - Name of logical layer 3 interface. + type: str + filter_input: + description: + - The name of input filter. + type: str + filter_output: + description: + - The name of output filter. + type: str + description: + description: + - Text description of VLANs. + type: str + interfaces: + description: + - List of interfaces to check the VLAN has been configured correctly. + type: list + elements: str + state: + description: + - State of the VLAN configuration. + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + state: + description: + - State of the VLAN configuration. + default: present + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: configure VLAN ID and name + junipernetworks.junos.junos_vlan: + name: test + vlan_id: 20 + +- name: Link to logical layer 3 interface + junipernetworks.junos.junos_vlan: + name: test + vlan_id: 20 + l3-interface: vlan.20 + +- name: remove VLAN configuration + junipernetworks.junos.junos_vlan: + name: test + state: absent + +- name: deactive VLAN configuration + junipernetworks.junos.junos_vlan: + name: test + state: present + active: false + +- name: activate VLAN configuration + junipernetworks.junos.junos_vlan: + name: test + state: present + active: true + +- name: Create vlan configuration using aggregate + junipernetworks.junos.junos_vlan: + aggregate: + - {vlan_id: 159, name: test_vlan_1, description: test vlan-1} + - {vlan_id: 160, name: test_vlan_2, description: test vlan-2} + +- name: Delete vlan configuration using aggregate + junipernetworks.junos.junos_vlan: + aggregate: + - {vlan_id: 159, name: test_vlan_1} + - {vlan_id: 160, name: test_vlan_2} + state: absent +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit vlans] + + test-vlan-1 { + + vlan-id 60; + + } +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, + to_param_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def validate_vlan_id(value, module): + if value and not 1 <= value <= 4094: + module.fail_json(msg="vlan_id must be between 1 and 4094") + + +def validate_param_values(module, obj, param=None): + if not param: + param = module.params + for key in obj: + # validate the param value (if validator func exists) + validator = globals().get("validate_%s" % key) + if callable(validator): + validator(param.get(key), module) + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(), + vlan_id=dict(type="int"), + description=dict(), + interfaces=dict(type="list", elements="str"), + l3_interface=dict(), + filter_input=dict(), + filter_output=dict(), + state=dict(default="present", choices=["present", "absent"]), + active=dict(default=True, type="bool"), + ) + + 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(junos_argument_spec) + + required_one_of = [["aggregate", "name"]] + mutually_exclusive = [["aggregate", "name"]] + + module = AnsibleModule( + argument_spec=argument_spec, + required_one_of=required_one_of, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "vlans/vlan" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True}), + ("vlan_id", "vlan-id"), + ("l3_interface", "l3-interface"), + ("filter_input", "forwarding-options/filter/input"), + ("filter_output", "forwarding-options/filter/output"), + ("description", "description"), + ] + ) + + params = to_param_list(module) + requests = list() + + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + + validate_param_values(module, param_to_xpath_map, param=item) + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append(map_obj_to_ele(module, want, top, param=item)) + + diff = None + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlans.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlans.py new file mode 100644 index 00000000..1554221a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vlans.py @@ -0,0 +1,192 @@ +#!/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 junos_vlans +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: junos_vlans +short_description: VLANs resource module +description: +- This module creates and manages VLAN configurations on Junos OS. +version_added: 1.0.0 +author: Daniel Mellado (@dmellado) +requirements: +- ncclient (>=v0.6.4) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed +- Tested against Junos OS 18.4R1 +- This module works with connection C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +options: + config: + description: A dictionary of Vlan options + type: list + elements: dict + suboptions: + vlan_id: + description: + - IEEE 802.1q VLAN identifier for VLAN (1..4094). + type: int + name: + description: + - Name of VLAN. + type: str + required: true + description: + description: + - Text description of VLANs + 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 Junos device + by executing the command B(show vlans). + - 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 + - gathered + - parsed + - rendered + default: merged +""" + +EXAMPLES = """ +# Using merged +############# + +# Before State +# ------------ +# +# admin# show vlans +# vlan-2 { +# vlan-id 2; +# } +# vlan-3 { +# vlan-id 3; +# } + +- name: Merge JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-1 + vlan-id: 1 + state: merged +- name: Replace JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-1 + vlan-id: 10 + - name: vlan-3 + vlan-id: 30 + state: replaced +- name: Override JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-4 + vlan-id: 100 + - name: vlan-2 + vlan-id: 200 + state: overridden +- name: Delete JUNOS vlan + junipernetworks.junos.junos_vlans: + config: + - name: vlan-1 + state: deleted +""" + +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: str + 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: str + 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: ['xml 1', 'xml 2', 'xml 3'] +""" + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.argspec.vlans.vlans import ( + VlansArgs, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.vlans.vlans import ( + Vlans, +) + + +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",)), + ] + + module = AnsibleModule( + argument_spec=VlansArgs.argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = Vlans(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vrf.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vrf.py new file mode 100644 index 00000000..aad3e10e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/modules/junos_vrf.py @@ -0,0 +1,346 @@ +#!/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: junos_vrf +author: Ganesh Nalawade (@ganeshrn) +short_description: Manage the VRF definitions on Juniper JUNOS devices +description: +- This module provides declarative management of VRF definitions on Juniper JUNOS + devices. It allows playbooks to manage individual or the entire VRF collection. +version_added: 1.0.0 +options: + name: + description: + - The name of the VRF definition to be managed on the remote IOS device. The + VRF definition name is an ASCII string name used to uniquely identify the VRF. This + argument is mutually exclusive with the C(aggregate) argument + type: str + description: + description: + - Provides a short description of the VRF definition in the current active configuration. The + VRF definition value accepts alphanumeric characters used to provide additional + information about the VRF. + type: str + rd: + description: + - The router-distinguisher value uniquely identifies the VRF to routing processes + on the remote IOS system. The RD value takes the form of C(A:B) where C(A) + and C(B) are both numeric values. + type: list + elements: str + interfaces: + description: + - Identifies the set of interfaces that should be configured in the VRF. Interfaces + must be routed interfaces in order to be placed into a VRF. + type: list + elements: str + target: + description: + - It configures VRF target community configuration. The target value takes the + form of C(target:A:B) where C(A) and C(B) are both numeric values. + type: list + elements: str + table_label: + description: + - Causes JUNOS to allocate a VPN label per VRF rather than per VPN FEC. This allows + for forwarding of traffic to directly connected subnets, COS Egress filtering + etc. + default: true + type: bool + aggregate: + description: + - The set of VRF definition objects to be configured on the remote JUNOS device. Ths + list entries can either be the VRF name or a hash of VRF definitions and attributes. This + argument is mutually exclusive with the C(name) argument. + type: list + elements: dict + suboptions: + name: + description: + - The name of the VRF definition to be managed on the remote IOS device. The + VRF definition name is an ASCII string name used to uniquely identify the VRF. This + argument is mutually exclusive with the C(aggregate) argument + required: true + type: str + description: + description: + - Provides a short description of the VRF definition in the current active configuration. The + VRF definition value accepts alphanumeric characters used to provide additional + information about the VRF. + type: str + rd: + description: + - The router-distinguisher value uniquely identifies the VRF to routing processes + on the remote IOS system. The RD value takes the form of C(A:B) where C(A) + and C(B) are both numeric values. + type: list + elements: str + interfaces: + description: + - Identifies the set of interfaces that should be configured in the VRF. Interfaces + must be routed interfaces in order to be placed into a VRF. + type: list + elements: str + target: + description: + - It configures VRF target community configuration. The target value takes the + form of C(target:A:B) where C(A) and C(B) are both numeric values. + type: list + elements: str + table_label: + description: + - Causes JUNOS to allocate a VPN label per VRF rather than per VPN FEC. This allows + for forwarding of traffic to directly connected subnets, COS Egress filtering + etc. + type: bool + state: + description: + - Configures the state of the VRF definition as it relates to the device operational + configuration. When set to I(present), the VRF should be configured in the + device active configuration and when set to I(absent) the VRF should not be + in the device active configuration + type: str + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + type: bool + state: + description: + - Configures the state of the VRF definition as it relates to the device operational + configuration. When set to I(present), the VRF should be configured in the + device active configuration and when set to I(absent) the VRF should not be + in the device active configuration + type: str + default: present + choices: + - present + - absent + active: + description: + - Specifies whether or not the configuration is active or deactivated + default: true + type: bool +requirements: +- ncclient (>=v0.5.2) +notes: +- This module requires the netconf system service be enabled on the remote device + being managed. +- Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4. +- Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html). +- This module also works with C(local) connections for legacy playbooks. +extends_documentation_fragment: +- junipernetworks.junos.junos +""" + +EXAMPLES = """ +- name: Configure vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: present + +- name: Remove vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: absent + +- name: Deactivate vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + active: false + +- name: Activate vrf configuration + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + active: true + +- name: Create vrf using aggregate + junipernetworks.junos.junos_vrf: + aggregate: + - name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + - name: test-2 + description: test-vrf-2 + interfaces: + - ge-0/0/4 + - ge-0/0/5 + rd: 192.0.2.2:10 + target: target:65515:114 + state: present +""" + +RETURN = """ +diff.prepared: + description: Configuration difference before and after applying change. + returned: when configuration is changed and diff option is enabled. + type: str + sample: > + [edit routing-instances] + + test-1 { + + description test-vrf-1; + + instance-type vrf; + + interface ge-0/0/2.0; + + interface ge-0/0/3.0; + + route-distinguisher 192.0.2.1:10; + + vrf-target target:65514:113; + + } +""" +import collections + +from copy import deepcopy + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + remove_default_spec, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + junos_argument_spec, + tostring, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + load_config, + map_params_to_obj, + map_obj_to_ele, + to_param_list, +) +from ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos import ( + commit_configuration, + discard_changes, + locked_config, +) + +USE_PERSISTENT_CONNECTION = True + + +def main(): + """ main entry point for module execution + """ + element_spec = dict( + name=dict(), + description=dict(), + rd=dict(type="list", elements="str"), + interfaces=dict(type="list", elements="str"), + target=dict(type="list", elements="str"), + state=dict(default="present", choices=["present", "absent"]), + active=dict(default=True, type="bool"), + table_label=dict(default=True, type="bool"), + ) + + 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(junos_argument_spec) + + required_one_of = [["aggregate", "name"]] + mutually_exclusive = [["aggregate", "name"]] + + module = AnsibleModule( + argument_spec=argument_spec, + supports_check_mode=True, + required_one_of=required_one_of, + mutually_exclusive=mutually_exclusive, + ) + + warnings = list() + result = {"changed": False} + + if warnings: + result["warnings"] = warnings + + top = "routing-instances/instance" + + param_to_xpath_map = collections.OrderedDict() + param_to_xpath_map.update( + [ + ("name", {"xpath": "name", "is_key": True}), + ("description", "description"), + ("type", "instance-type"), + ("rd", "route-distinguisher/rd-type"), + ("interfaces", "interface/name"), + ("target", "vrf-target/community"), + ("table_label", {"xpath": "vrf-table-label", "tag_only": True}), + ] + ) + + params = to_param_list(module) + requests = list() + + for param in params: + # if key doesn't exist in the item, get it from module.params + for key in param: + if param.get(key) is None: + param[key] = module.params[key] + + item = param.copy() + item["type"] = "vrf" + + want = map_params_to_obj(module, param_to_xpath_map, param=item) + requests.append(map_obj_to_ele(module, want, top, param=item)) + + with locked_config(module): + for req in requests: + diff = load_config(module, tostring(req), warnings, action="merge") + + commit = not module.check_mode + if diff: + if commit: + commit_configuration(module) + else: + discard_changes(module) + result["changed"] = True + + if module._diff: + result["diff"] = {"prepared": diff} + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/junos.py new file mode 100644 index 00000000..986c3f39 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/netconf/junos.py @@ -0,0 +1,267 @@ +# +# (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 +netconf: junos +short_description: Use junos netconf plugin to run netconf commands on Juniper JUNOS + platform +description: +- This junos plugin provides low level abstraction apis for sending and receiving + netconf commands from Juniper JUNOS network devices. +version_added: 1.0.0 +options: + ncclient_device_handler: + type: str + default: junos + description: + - Specifies the ncclient device handler name for Juniper junos network os. To + identify the ncclient device handler name refer ncclient library documentation. +""" + +import json +import re + +from ansible.module_utils._text import to_text, to_native +from ansible.module_utils.six import string_types +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_ele, to_xml, new_ele, sub_ele + + HAS_NCCLIENT = True +except ( + ImportError, + AttributeError, +): # paramiko and gssapi are incompatible and raise AttributeError not ImportError + HAS_NCCLIENT = False + + +class Netconf(NetconfBase): + def get_text(self, ele, tag): + try: + return to_text( + ele.find(tag).text, errors="surrogate_then_replace" + ).strip() + except AttributeError: + pass + + @ensure_ncclient + def get_device_info(self): + device_info = dict() + device_info["network_os"] = "junos" + ele = new_ele("get-software-information") + data = self.execute_rpc(to_xml(ele)) + reply = to_ele(data) + sw_info = reply.find(".//software-information") + + device_info["network_os_version"] = self.get_text( + sw_info, "junos-version" + ) + device_info["network_os_hostname"] = self.get_text( + sw_info, "host-name" + ) + device_info["network_os_model"] = self.get_text( + sw_info, "product-model" + ) + + return device_info + + def execute_rpc(self, name): + """ + RPC to be execute on remote device + :param name: Name of rpc in string format + :return: Received rpc response from remote host + """ + return self.rpc(name) + + @ensure_ncclient + def load_configuration( + self, format="xml", action="merge", target="candidate", config=None + ): + """ + Load given configuration on device + :param format: Format of configuration (xml, text, set) + :param action: Action to be performed (merge, replace, override, update) + :param target: The name of the configuration datastore being edited + :param config: The configuration to be loaded on remote host in string format + :return: Received rpc response from remote host in string format + """ + if config: + if format == "xml": + config = to_ele(config) + + try: + return self.m.load_configuration( + format=format, action=action, target=target, config=config + ).data_xml + except RPCError as exc: + raise Exception(to_xml(exc.xml)) + + def get_capabilities(self): + result = dict() + result["rpc"] = self.get_base_rpc() + [ + "commit", + "discard_changes", + "validate", + "lock", + "unlock", + "copy_copy", + "execute_rpc", + "load_configuration", + "get_configuration", + "command", + "reboot", + "halt", + ] + 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("junos", c): + guessed_os = "junos" + + m.close_session() + return guessed_os + + def get_configuration(self, format="xml", filter=None): + """ + Retrieve all or part of a specified configuration. + :param format: format in which configuration should be retrieved + :param filter: specifies the portion of the configuration to retrieve + as either xml string rooted in element + :return: Received rpc response from remote host in string format + """ + if filter is not None: + if not isinstance(filter, string_types): + raise AnsibleConnectionFailure( + "get configuration filter should be of type string," + " received value '%s' is of type '%s'" + % (filter, type(filter)) + ) + filter = to_ele(filter) + + return self.m.get_configuration(format=format, filter=filter).data_xml + + def compare_configuration(self, rollback=0): + """ + Compare the candidate configuration with running configuration + by default. The candidate configuration can be compared with older + committed configuration by providing rollback id. + :param rollback: Rollback id of previously commited configuration + :return: Received rpc response from remote host in string format + """ + return self.m.compare_configuration(rollback=rollback).data_xml + + def halt(self): + """reboot the device""" + return self.m.halt().data_xml + + def reboot(self): + """reboot the device""" + return self.m.reboot().data_xml + + # Due to issue in ncclient commit() method for Juniper (https://github.com/ncclient/ncclient/issues/238) + # below commit() is a workaround which build's raw `commit-configuration` xml with required tags and uses + # ncclient generic rpc() method to execute rpc on remote host. + # Remove below method after the issue in ncclient is fixed. + @ensure_ncclient + def commit( + self, + confirmed=False, + check=False, + timeout=None, + comment=None, + synchronize=False, + at_time=None, + ): + """ + Commit the candidate configuration as the device's new current configuration. + Depends on the `:candidate` capability. + A confirmed commit (i.e. if *confirmed* is `True`) is reverted if there is no + followup commit within the *timeout* interval. If no timeout is specified the + confirm timeout defaults to 600 seconds (10 minutes). + A confirming commit may have the *confirmed* parameter but this is not required. + Depends on the `:confirmed-commit` capability. + :param confirmed: whether this is a confirmed commit + :param check: Check correctness of syntax + :param timeout: specifies the confirm timeout in seconds + :param comment: Message to write to commit log + :param synchronize: Synchronize commit on remote peers + :param at_time: Time at which to activate configuration changes + :return: Received rpc response from remote host + """ + obj = new_ele("commit-configuration") + if confirmed: + sub_ele(obj, "confirmed") + if check: + sub_ele(obj, "check") + if synchronize: + sub_ele(obj, "synchronize") + if at_time: + subele = sub_ele(obj, "at-time") + subele.text = str(at_time) + if comment: + subele = sub_ele(obj, "log") + subele.text = str(comment) + if timeout: + subele = sub_ele(obj, "confirm-timeout") + subele.text = str(timeout) + return self.rpc(obj) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/junos.py new file mode 100644 index 00000000..65a2026d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/plugins/terminal/junos.py @@ -0,0 +1,60 @@ +# +# (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 +from ansible.utils.display import Display + +display = Display() + + +class TerminalModule(TerminalBase): + + terminal_stdout_re = [ + re.compile(br"({primary:node\d+})?[\r\n]?[\w@+\-\.:\/\[\]]+[>#%] ?$") + ] + + terminal_stderr_re = [ + re.compile(br"unknown command"), + re.compile(br"syntax error"), + re.compile(br"[\r\n]error:"), + ] + + def on_open_shell(self): + try: + prompt = self._get_prompt() + if prompt.strip().endswith(b"%"): + display.vvv( + "starting cli", self._connection._play_context.remote_addr + ) + self._exec_cli_command(b"cli") + for c in ( + b"set cli timestamp disable", + b"set cli screen-length 0", + b"set cli screen-width 1024", + ): + self._exec_cli_command(c) + except AnsibleConnectionFailure: + raise AnsibleConnectionFailure("unable to set terminal parameters") diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/requirements.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/requirements.txt new file mode 100644 index 00000000..73528c36 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/requirements.txt @@ -0,0 +1,5 @@ +jxmlease +ncclient +paramiko +scp +xmltodict diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/test-requirements.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/test-requirements.txt new file mode 100644 index 00000000..65d78654 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/test-requirements.txt @@ -0,0 +1,6 @@ +black==19.3b0 ; python_version > '3.5' +flake8 +mock +pytest-xdist +yamllint +coverage==4.5.4 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/.gitignore b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/.gitignore new file mode 100644 index 00000000..ea1472ec --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/.gitignore @@ -0,0 +1 @@ +output/ diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/network-integration.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/network-integration.cfg new file mode 100644 index 00000000..d12c1efe --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/integration/target-prefixes.network b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/target-prefixes.network new file mode 100644 index 00000000..8f81f6ac --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/target-prefixes.network @@ -0,0 +1 @@ +junos \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/defaults/main.yaml new file mode 100644 index 00000000..164afead --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/main.yaml new file mode 100644 index 00000000..cc27f174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: netconf.yaml, tags: ['netconf'] } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..3eed8424 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_initial_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_initial_config.yaml new file mode 100644 index 00000000..0d1f318d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_initial_config.yaml @@ -0,0 +1,18 @@ +--- +- debug: + msg: "START junos_acl_interfaces ACL interfaces initial config on connection={{ ansible_connection }}" + +- name: Set initial state for firewalls and interfaces + junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: initial_acl + direction: in + - name: second_acl + direction: out + +- debug: + msg: "END junos_acl_interfaces ACL interfaces initial config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_reset_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_reset_config.yaml new file mode 100644 index 00000000..0ef7423b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/_reset_config.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: "START junos_acl_interfaces reset ACL and ACL interfaces config on connection={{ ansible_connection }}" + +- name: Set initial state for firewalls and interfaces + junos_config: + lines: + - delete firewall + - set firewall family inet filter initial_acl term ten_dot from source-port bgp protocol tcp source-address 10.0.0.0/8 + - set firewall family inet filter initial_acl term eleven_dot from source-port bgp protocol tcp source-address 11.0.0.0/8 + - set firewall family inet filter second_acl term twelve_dot from source-port bgp protocol tcp source-address 12.0.0.0/8 + - "delete interfaces ge-1/0/0" + - "delete interfaces ge-2/0/0" +- debug: + msg: "END junos_acl_interfaces reset ACL and ACL interfaces config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..2faa2bf3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: "START junos_acl_interfaces deleted integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: initial_acl + direction: in + + - name: Delete a single ACL + junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: second_acl + direction: out + state: deleted + register: result + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - set_fact: + config: [] + + - name: Delete all ACLs from the device + junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + state: deleted + register: result + + - name: Assert changed + assert: *changed + + tags: deleted + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acl_interfaces deleted integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/empty_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/empty_config.yaml new file mode 100644 index 00000000..444ff7ed --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START junos_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 + junipernetworks.junos.junos_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 + junipernetworks.junos.junos_acl_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 + junipernetworks.junos.junos_acl_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + junipernetworks.junos.junos_acl_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/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..a67299dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,53 @@ +--- +- debug: + msg: "START junos_acl_interfaces merged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: second_acl + direction: in + - name: initial_acl + direction: out + + - name: Merge the provided configuration with the exisiting running configuration + junos_acl_interfaces: &merged + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: second_acl + direction: in + - name: initial_acl + direction: out + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_acl_interfaces: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acl_interfaces merged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/overridden.yaml new file mode 100644 index 00000000..0d2c0053 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/overridden.yaml @@ -0,0 +1,44 @@ +--- +- debug: + msg: "START junos_acl_interfaces overridden integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: initial_acl + direction: in + + - name: Override configuration of ACL + junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: initial_acl + direction: in + state: overridden + register: result + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Assert changed + assert: *changed + + tags: overridden + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acl_interfaces overridden integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..6074f40d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acl_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,44 @@ +--- +- debug: + msg: "START junos_acl_interfaces replaced integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: initial_acl + direction: in + - name: second_acl + direction: out + - name: initial_acl + direction: out + + - name: Replace configuration of ACL + junos_acl_interfaces: + config: + - name: ge-1/0/0 + access_groups: + - afi: ipv4 + acls: + - name: initial_acl + direction: out + state: replaced + register: result + + - name: Assert configuration + assert: + that: + - "{{ config|symmetric_difference(result.after) == [] }}" + + tags: replaced + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acl_interfaces replaced integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/defaults/main.yaml new file mode 100644 index 00000000..164afead --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/main.yaml new file mode 100644 index 00000000..cc27f174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: netconf.yaml, tags: ['netconf'] } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/netconf.yaml new file mode 100644 index 00000000..3eed8424 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/_reset_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/_reset_config.yaml new file mode 100644 index 00000000..0cf92804 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/_reset_config.yaml @@ -0,0 +1,15 @@ +--- +- debug: + msg: "START junos_acls reset ACL config on connection={{ ansible_connection }}" + +- name: Set initial state + junos_config: + lines: + - delete firewall + - set firewall family inet filter initial_acl term ten_dot from source-port bgp protocol tcp source-address 10.0.0.0/8 + - set firewall family inet filter initial_acl term eleven_dot from source-port bgp protocol tcp source-address 11.0.0.0/8 + - set firewall family inet filter second_acl term twelve_dot from source-port bgp protocol tcp source-address 12.0.0.0/8 + - "set firewall family inet6 filter initial_acl6 term colon_eleven from source-port 631 source-address ::11" + +- debug: + msg: "END junos_acls reset ACL config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/config_policy.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/config_policy.yaml new file mode 100644 index 00000000..4ac3e5a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/config_policy.yaml @@ -0,0 +1,12 @@ +--- +- debug: + msg: "START junos_acls preconfig policy options config on connection={{ ansible_connection }}" + +- name: Set policy config + junos_config: + lines: + - set policy-options prefix-list ospf-all-routers + - set policy-options prefix-list ipv4-interfaces + +- debug: + msg: "END junos_acls preconfig policy options config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/deleted.yaml new file mode 100644 index 00000000..5b6ff8a4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/deleted.yaml @@ -0,0 +1,128 @@ +--- +- debug: + msg: "START junos_acls deleted integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - acls: + - aces: + - name: ten_dot + source: + address: 10.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: initial_acl + - aces: + - name: twelve_dot + source: + address: 12.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: second_acl + afi: ipv4 + - acls: + - aces: + - name: colon_eleven + source: + address: ::11/128 + port_protocol: + eq: "631" + name: initial_acl6 + afi: ipv6 + + - name: Delete a single ACE + junos_acls: + config: + - afi: ipv4 + acls: + - name: initial_acl + aces: + - name: eleven_dot + state: deleted + register: result + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - set_fact: + config: + - acls: + - aces: + - name: ten_dot + source: + address: 10.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: initial_acl + afi: ipv4 + - acls: + - aces: + - name: colon_eleven + source: + address: ::11/128 + port_protocol: + eq: "631" + name: initial_acl6 + afi: ipv6 + + - name: Delete a whole ACL + junos_acls: + config: + - afi: ipv4 + acls: + - name: second_acl + state: deleted + register: result + + - name: Assert changed + assert: *changed + + - set_fact: + config: + - acls: + - aces: + - name: ten_dot + source: + address: 10.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: initial_acl + afi: ipv4 + + - name: Delete all ACLs under one AFI + junos_acls: + config: + - afi: ipv6 + state: deleted + register: result + + - name: Assert changed + assert: *changed + + - set_fact: + config: [] + + - name: Delete all ACLs from the device + junos_acls: + state: deleted + register: result + + - name: Assert changed + assert: *changed + + tags: deleted + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acls deleted integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/idempotent.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/idempotent.yaml new file mode 100644 index 00000000..9c4ad6ce --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/idempotent.yaml @@ -0,0 +1,69 @@ +--- +- debug: + msg: "START junos_acls idempotence integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - acls: + - aces: + - name: ten_dot + source: + address: 10.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + - name: eleven_dot + source: + address: 11.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: initial_acl + - aces: + - name: twelve_dot + source: + address: 12.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: second_acl + afi: ipv4 + - acls: + - aces: + - name: colon_eleven + source: + address: ::11/128 + port_protocol: + eq: 631 + name: initial_acl6 + afi: ipv6 + + - name: Test equivalence + junos_acls: + config: "{{ config }}" + state: merged + register: result + + - assert: + that: + - result.changed == False + + - name: Test idempotence + junos_acls: + config: "{{ config }}" + state: overridden + register: result + + - assert: + that: + - result.changed == False + + tags: idempotence + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acls idempotence integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/merged.yaml new file mode 100644 index 00000000..6cfc3ccb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/merged.yaml @@ -0,0 +1,96 @@ +--- +- debug: + msg: "START junos_acls merged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - include_tasks: config_policy.yaml + + - set_fact: + config: + - acls: + - aces: + - name: ten_dot + source: + address: 10.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + - name: eleven_dot + source: + address: 11.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: initial_acl + - aces: + - name: twelve_dot + source: + address: 12.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: second_acl + - aces: + - name: ssh_rule + source: + prefix_list: + - name: "ipv4-interfaces" + - name: "ospf-all-routers" + port_protocol: + eq: ssh + protocol: tcp + name: allow_ssh_acl + afi: ipv4 + - acls: + - aces: + - name: colon_eleven + source: + address: ::11/128 + port_protocol: + eq: "631" + name: initial_acl6 + afi: ipv6 + + - name: Merge the provided configuration with the exisiting running configuration + junos_acls: &merged + config: + - afi: ipv4 + acls: + - name: allow_ssh_acl + aces: + - name: ssh_rule + source: + prefix_list: + - name: "ipv4-interfaces" + - name: "ospf-all-routers" + port_protocol: + eq: ssh + protocol: tcp + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_acls: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged + always: + - include_tasks: _reset_config.yaml + + - include_tasks: reset_policy_config.yaml + +- debug: + msg: "END junos_acls merged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/overridden.yaml new file mode 100644 index 00000000..a4a4f45a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/overridden.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: "START junos_acls overridden integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - acls: + - aces: + - name: ace_10 + grant: deny + protocol: tcp + name: acl_1 + - aces: + - name: ace_20 + grant: deny + protocol: udp + name: acl_2 + afi: ipv4 + + - name: Override the entire running configuration with the provided configuration + junos_acls: &overridden + config: "{{ config }}" + state: overridden + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Override the entire running configuration with the provided configuration (IDEMPOTENT) + junos_acls: *overridden + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: overridden + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acls overridden integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/replaced.yaml new file mode 100644 index 00000000..8de0fc5c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/replaced.yaml @@ -0,0 +1,90 @@ +--- +- debug: + msg: "START junos_acls replaced integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - acls: + - aces: + - name: ten_dot + source: + address: 10.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + - name: eleven_dot + source: + address: 11.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + name: initial_acl + - aces: + - name: twelve_dot + source: + address: 12.0.0.0/8 + port_protocol: + eq: bgp + protocol: tcp + - name: ace_20 + grant: permit + protocol: igmp + source: + address: 192.168.1.100/32 + - name: ace_21 + grant: permit + protocol: tcp + name: second_acl + afi: ipv4 + - acls: + - aces: + - name: colon_eleven + source: + address: ::11/128 + port_protocol: + eq: "631" + name: initial_acl6 + afi: ipv6 + + - name: Replace the specified ACL with given config + junos_acls: &replaced + config: + - afi: ipv4 + acls: + - name: second_acl + aces: + - name: ace_20 + grant: permit + protocol: igmp + source: + address: 192.168.1.100 + - name: ace_21 + grant: permit + protocol: tcp + state: replaced + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Replace the specified ACL with given config (IDEMPOTENT) + junos_acls: *replaced + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: replaced + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_acls replaced integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/reset_policy_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/reset_policy_config.yaml new file mode 100644 index 00000000..e819bc23 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_acls/tests/netconf/reset_policy_config.yaml @@ -0,0 +1,14 @@ +--- +- debug: + msg: "START junos_acls reset policy options config on connection={{ ansible_connection }}" + +- name: Reset policy options config + junos_config: + lines: + - delete firewall family inet filter PROTECT-RE term allow-ospf from source-prefix-list ipv4-interfaces + - delete firewall family inet filter PROTECT-RE term allow-ospf from source-prefix-list ospf-all-routers + - delete policy-options prefix-list ospf-all-routers + - delete policy-options prefix-list ipv4-interfaces + +- debug: + msg: "END junos_acls reset policy options config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/netconf.yaml new file mode 100644 index 00000000..3240c42a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/basic.yaml new file mode 100644 index 00000000..e11aebeb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/basic.yaml @@ -0,0 +1,211 @@ +--- +- debug: msg="START junos_banner netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove login banner + junipernetworks.junos.junos_banner: + banner: login + state: absent + provider: '{{ netconf }}' + +- name: Create login banner + register: result + junipernetworks.junos.junos_banner: + banner: login + text: this is my login banner + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner' in config.xml" + +- name: Create login banner (idempotent) + register: result + junipernetworks.junos.junos_banner: + banner: login + text: this is my login banner + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate login banner + register: result + junipernetworks.junos.junos_banner: + banner: login + text: this is my login banner + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner' in config.xml" + +- name: Activate login banner + register: result + junipernetworks.junos.junos_banner: + banner: login + text: this is my login banner + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner' in config.xml" + +- name: check mode + register: result + check_mode: true + junipernetworks.junos.junos_banner: + banner: login + text: this is not the login banner you're looking for + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.failed == false + +- name: delete login banner + register: result + junipernetworks.junos.junos_banner: + banner: login + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner' not in config.xml" + +- name: setup - remove motd banner + junipernetworks.junos.junos_banner: + banner: motd + state: absent + provider: '{{ netconf }}' + +- name: Create motd banner + register: result + junipernetworks.junos.junos_banner: + banner: motd + text: this is my motd banner + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my motd banner' in config.xml" + +- name: Create motd banner (idempotent) + register: result + junipernetworks.junos.junos_banner: + banner: motd + text: this is my motd banner + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate motd banner + register: result + junipernetworks.junos.junos_banner: + banner: motd + text: this is my motd banner + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my motd banner'\ + \ in config.xml" + +- name: Activate motd banner + register: result + junipernetworks.junos.junos_banner: + banner: motd + text: this is my motd banner + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my motd banner' in config.xml" + +- name: delete motd banner + register: result + junipernetworks.junos.junos_banner: + banner: motd + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my motd banner' not in config.xml" + +- debug: msg="END junos_banner netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/net_banner.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/net_banner.yml new file mode 100644 index 00000000..cfcf11f0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_banner/tests/netconf/net_banner.yml @@ -0,0 +1,38 @@ +--- +- debug: msg="START junos net_banner netconf/net_banner.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove login banner + ansible.netcommon.net_banner: + banner: login + state: absent + provider: '{{ netconf }}' + +- name: Create login banner + register: result + ansible.netcommon.net_banner: + banner: login + text: this is my login banner configured by net_banner + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'this is my login banner configured by net_banner' in\ + \ config.xml" + +- name: teardown - remove login banner + ansible.netcommon.net_banner: + banner: login + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos net_banner netconf/net_banner.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_initial_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_initial_config.yaml new file mode 100644 index 00000000..74ac8f99 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_initial_config.yaml @@ -0,0 +1,32 @@ +--- +- debug: + msg: "START junos_bgp_global initial config on connection={{ ansible_connection }}" + +- name: Set initial configuration for ospf + junipernetworks.junos.junos_bgp_global: + config: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: 2 + +- debug: + msg: "END junos_bgp_global initial config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_reset_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_reset_config.yaml new file mode 100644 index 00000000..4036ed81 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/_reset_config.yaml @@ -0,0 +1,10 @@ +--- +- debug: + msg: "START junos_bgp_global reset config on connection={{ ansible_connection }}" + +- name: Reset configuration for bgp and routing-options + junipernetworks.junos.junos_bgp_global: + state: deleted + +- debug: + msg: "END junos_bgp_global reset config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/deleted.yaml new file mode 100644 index 00000000..6510840f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/deleted.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: "START junos_bgp_global deleted integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + - set_fact: + config: {} + - name: Delete all ospf config from the device + junipernetworks.junos.junos_bgp_global: + state: deleted + register: result + + - name: Assert changed + assert: + that: + - result.changed == True + - "{{ config == result.after }}" + + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_bgp_global deleted integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/empty_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/empty_config.yaml new file mode 100644 index 00000000..751f0e34 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START junos_bgp_global empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + junipernetworks.junos.junos_bgp_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 + junipernetworks.junos.junos_bgp_global: + 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 + junipernetworks.junos.junos_bgp_global: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + junipernetworks.junos.junos_bgp_global: + 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/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..aea403c3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,48 @@ + + + + 18.4R1-S2.4 + + + + + + This is configured with Junos_bgp resource module + + 2 + 5 + + + + 10 + + + md5 + + + + + enable + + + static-to-bgp + + + + + + + + + 172.16.17.0/24 + + + + 10.200.16.75 + + 65432 + + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/gathered.yaml new file mode 100644 index 00000000..3a66ce3d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/gathered.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START junos_bgp_global gathered integration tests on connection={{ ansible_connection }} + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_gathered_output: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: "2" + + - name: Gather interfaces facts using gathered state + register: result + junipernetworks.junos.junos_bgp_global: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_gathered_output == result['gathered'] }}" + + always: + + - include_tasks: _reset_config.yaml + +- debug: + msg: END junos_bgp_global gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/merged.yaml new file mode 100644 index 00000000..132001c1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/merged.yaml @@ -0,0 +1,81 @@ +--- +- debug: + msg: "START junos_bgp_global merged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + expected_merged_output: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: "2" + + - name: Merge the provided configuration with the exisiting running configuration + junipernetworks.junos.junos_bgp_global: &merged + config: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: "2" + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ expected_merged_output == result.after }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_bgp_global: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_bgp_global merged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/parsed.yaml new file mode 100644 index 00000000..6e21cf3d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/parsed.yaml @@ -0,0 +1,43 @@ +--- +- debug: + msg: START junos_bgp_global parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + accept_remote_nexthop: true + add_path_display_ipv4_address: true + advertise_bgp_static: + policy: "static-to-bgp" + advertise_from_main_vpn_tables: true + advertise_inactive: true + authentication_algorithm: "md5" + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + holddown_all_stale_labels: true + include_mp_next_hop: true + log_updown: true + no_advertise_peer_as: true + no_aggregator_id: true + no_client_reflect: true + out_delay: 10 + precision_timers: true + preference: "2" + +- name: Parse externally provided bgp_global config to agnostic model + register: result + junipernetworks.junos.junos_bgp_global: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output == result['parsed'] }}" +- debug: + msg: END junos_bgp_global parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/purged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/purged.yaml new file mode 100644 index 00000000..fa879faa --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/purged.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: "START junos_bgp_global purged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + - set_fact: + config: {} + - name: Purge all ospf config from the device + junipernetworks.junos.junos_bgp_global: + state: purged + register: result + + - name: Assert changed + assert: + that: + - result.changed == True + - "{{ config == result.after }}" + + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_bgp_global purged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/rendered.yaml new file mode 100644 index 00000000..97f24d91 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/rendered.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START junos_bgp_global rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "md5This is configured with Junos_bgp resource module52410automatic20000000enable" + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_bgp_global: + config: + authentication_algorithm: "md5" + bfd_liveness_detection: + minimum_receive_interval: 4 + multiplier: 10 + no_adaptation: true + transmit_interval: + minimum_interval: 2 + version: "automatic" + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + egress_te_sid_stats: true + hold_time: 5 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_bgp_global rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/replaced.yaml new file mode 100644 index 00000000..2475d519 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_bgp_global/tests/netconf/replaced.yaml @@ -0,0 +1,50 @@ +--- +- debug: + msg: "START junos_bgp_global replaced integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_replaced_output: + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + + - name: Replace configuration + junipernetworks.junos.junos_bgp_global: &replaced + config: + bgp_error_tolerance: + malformed_route_limit: 20000000 + bmp: + monitor: true + damping: true + description: "This is configured with Junos_bgp resource module" + state: replaced + register: result + + - name: Assert configuration + assert: + that: + - result.changed == True + - "{{ expected_replaced_output == result.after }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_bgp_global: *replaced + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: replaced + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_bgp_global replaced integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/cli.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/cli.yaml new file mode 100644 index 00000000..163934f5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_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/junipernetworks/junos/tests/integration/targets/junos_command/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/main.yaml new file mode 100644 index 00000000..35bb7bb6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/main.yaml @@ -0,0 +1,10 @@ +--- +- include: netconf_xml.yaml + +- include: netconf_text.yaml + +- include: netconf_json.yaml + +- include: cli.yaml + tags: + - network_cli diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_json.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_json.yaml new file mode 100644 index 00000000..05b6b0a5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_json.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf_json test cases with json encoding + find: + paths: '{{ role_path }}/tests/netconf_json' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_text.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_text.yaml new file mode 100644 index 00000000..01403b78 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_text.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf_text test cases with text encoding + find: + paths: '{{ role_path }}/tests/netconf_text' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_xml.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_xml.yaml new file mode 100644 index 00000000..eed8374c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tasks/netconf_xml.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf_xml test cases with xml encoding + find: + paths: '{{ role_path }}/tests/netconf_xml' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/cli/cli_commmand.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/cli/cli_commmand.yaml new file mode 100644 index 00000000..5e21dafb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/cli/cli_commmand.yaml @@ -0,0 +1,64 @@ +--- +- debug: + msg: START cli/cli_command.yaml on connection={{ ansible_connection }} + +- block: + + - 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: test with prompt and answer + loop: + - configure + - set system syslog file test any any + - rollback + - exit + register: result + ansible.netcommon.cli_command: + command: '{{ item }}' + prompt: + - Exit with uncommitted changes + answer: true + + - assert: + that: + - result.changed == false + + - loop: + - configure + - rollback + - set system login user ansible_test class operator authentication plain-text-password + - commit + register: result + ignore_errors: true + ansible.netcommon.cli_command: + command: '{{item}}' + prompt: + - New password + - Retype new password + answer: + - Test1234 + - Test1234 + check_all: true + + - assert: + that: + - "'failed' not in result" + + - register: result + ignore_errors: true + junipernetworks.junos.junos_netconf: + + - assert: + that: + - result.failed == false + when: ansible_connection == 'ansible.netcommon.network_cli' + +- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/bad_operator.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/bad_operator.yaml new file mode 100644 index 00000000..899cde9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/bad_operator.yaml @@ -0,0 +1,23 @@ +--- +- debug: msg="START netconf_json/bad_operator.yaml on connection={{ ansible_connection + }}" + +- name: test bad operator with json encoding + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[0]['software-information'][0]['host-name'][0]['data'] foo lo0 + format: json + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_json/bad_operator.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/contains.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/contains.yaml new file mode 100644 index 00000000..d08d6e20 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/contains.yaml @@ -0,0 +1,24 @@ +--- +- debug: msg="START netconf_json/contains.yaml on connection={{ ansible_connection + }}" + +- name: test contains operator with json encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['name'][0]['data'] + contains lo0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/contains.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/equal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/equal.yaml new file mode 100644 index 00000000..23129b09 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/equal.yaml @@ -0,0 +1,41 @@ +--- +- debug: msg="START netconf_json/equal.yaml on connection={{ ansible_connection + }}" + +- name: test == operator with xml encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['name'][0]['data'] + == lo0 + format: json + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test eq operator with json encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['name'][0]['data'] + eq lo0 + format: json + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/equal.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthan.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthan.yaml new file mode 100644 index 00000000..6298d19e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthan.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_json/greaterthan.yaml on connection={{ ansible_connection + }}" + +- name: test gt operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0]['data'] + gt 5 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test > operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0]['data'] + > 5 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/greaterthan.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthanorequal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthanorequal.yaml new file mode 100644 index 00000000..0bd35740 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/greaterthanorequal.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_json/greaterthanorequal.yaml on connection={{ ansible_connection + }}" + +- name: test ge operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0]['data'] + ge 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test >= operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0]['data'] + >= 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/greaterthanorequal.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthan.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthan.yaml new file mode 100644 index 00000000..74d2291b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthan.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_json/lessthan.yaml on connection={{ ansible_connection + }}" + +- name: test lt operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0]['data'] + lt 7 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test < operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0]['data'] + lt 7 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/lessthan.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthanorequal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthanorequal.yaml new file mode 100644 index 00000000..159f2081 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/lessthanorequal.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_json/lessthanorequal.yaml on connection={{ ansible_connection + }}" + +- name: test le operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0][data] + le 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test <= operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['local-index'][0][data] + <= 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/lessthanorequal.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/notequal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/notequal.yaml new file mode 100644 index 00000000..84d320ab --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/notequal.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_json/notequal.yaml on connection={{ ansible_connection + }}" + +- name: test neq operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['name'][0]['data'] + neq em0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test != operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: json + wait_for: + - result[1]['interface-information'][0]['physical-interface'][0]['name'][0]['data'] + neq em0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/notequal.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/output.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/output.yaml new file mode 100644 index 00000000..65372d38 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_json/output.yaml @@ -0,0 +1,66 @@ +--- +- debug: msg="START netconf_json/output.yaml on connection={{ ansible_connection + }}" + +- name: get output for single command + register: result + junipernetworks.junos.junos_command: + commands: + - show version + format: json + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show route + format: json + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for single command with cli transport + register: result + connection: ansible.netcommon.network_cli + junipernetworks.junos.junos_command: + commands: + - show version | display json + provider: + transport: cli + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands with cli transport + register: result + connection: ansible.netcommon.network_cli + junipernetworks.junos.junos_command: + commands: + - show version + - show route + format: json + provider: + transport: cli + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_json/output.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/bad_operator.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/bad_operator.yaml new file mode 100644 index 00000000..a0da3955 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/bad_operator.yaml @@ -0,0 +1,24 @@ +--- +- debug: msg="START netconf_text/bad_operator.yaml on connection={{ ansible_connection + }}" + +- name: test bad operator with text encoding + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[1].interface-information[0].physical-interface[0].name[0].data foo + lo0 + encoding: text + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_text/bad_operator.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/contains.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/contains.yaml new file mode 100644 index 00000000..7a907638 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/contains.yaml @@ -0,0 +1,23 @@ +--- +- debug: msg="START netconf_text/contains.yaml on connection={{ ansible_connection + }}" + +- name: test contains operator with text encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + display: text + wait_for: + - result[1] contains lo0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_text/contains.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/invalid.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/invalid.yaml new file mode 100644 index 00000000..db87ddd6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/invalid.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START netconf_text/invalid.yaml on connection={{ ansible_connection + }}" + +- name: run invalid command + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show foo + display: text + provider: '{{ netconf }}' + +- debug: var=result + +- assert: + that: + - result.failed == true + - result.msg is defined + +- name: run commands that include invalid command + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + - show foo + display: text + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_text/invalid.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/output.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/output.yaml new file mode 100644 index 00000000..d475fe3f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/output.yaml @@ -0,0 +1,77 @@ +--- +- debug: msg="START netconf_text/output.yaml on connection={{ ansible_connection + }}" + +- name: get output for single command + register: result + junipernetworks.junos.junos_command: + commands: show version + display: text + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show route + display: text + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for partial config commands + register: result + junipernetworks.junos.junos_command: + commands: + - show configuration system syslog + display: text + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for single command with cli transport + register: result + junipernetworks.junos.junos_command: + commands: show version + display: text + provider: + transport: cli + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands with cli transport + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show route + display: text + provider: + transport: cli + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_text/output.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/timeout.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/timeout.yaml new file mode 100644 index 00000000..f57871d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_text/timeout.yaml @@ -0,0 +1,22 @@ +--- +- debug: msg="START netconf_text/timeout.yaml on connection={{ ansible_connection + }}" + +- name: test bad condition + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + wait_for: + - result[0] contains bad_value_string + display: text + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_text/timeout.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/bad_operator.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/bad_operator.yaml new file mode 100644 index 00000000..0f47d672 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/bad_operator.yaml @@ -0,0 +1,24 @@ +--- +- debug: msg="START netconf_xml/bad_operator.yaml on connection={{ ansible_connection + }}" + +- name: test bad operator with xml encoding + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[1].rpc-reply.interface-information[0].physical-interface[0].name[0].data + foo lo0 + format: xml + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_xml/bad_operator.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/contains.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/contains.yaml new file mode 100644 index 00000000..ab6e9be6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/contains.yaml @@ -0,0 +1,24 @@ +--- +- debug: msg="START netconf_xml/contains.yaml on connection={{ ansible_connection + }}" + +- name: test contains operator with xml encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.name contains + lo0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/contains.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/equal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/equal.yaml new file mode 100644 index 00000000..14dc97b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/equal.yaml @@ -0,0 +1,38 @@ +--- +- debug: msg="START netconf_xml/equal.yaml on connection={{ ansible_connection }}" + +- name: test == operator with xml encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.name == lo0 + format: xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test eq operator with json encoding + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.name eq lo0 + format: xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/equal.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthan.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthan.yaml new file mode 100644 index 00000000..45fa25aa --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthan.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_xml/greaterthan.yaml on connection={{ ansible_connection + }}" + +- name: test gt operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + gt 5 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test > operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + > 5 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/greaterthan.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthanorequal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthanorequal.yaml new file mode 100644 index 00000000..c68be8db --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/greaterthanorequal.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_xml/greaterthanorequal.yaml on connection={{ ansible_connection + }}" + +- name: test ge operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + ge 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test >= operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + >= 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/greaterthanorequal.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/invalid.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/invalid.yaml new file mode 100644 index 00000000..c18eea87 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/invalid.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START netconf_xml/invalid.yaml on connection={{ ansible_connection + }}" + +- name: run invalid command + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show foo + provider: '{{ netconf }}' + +- debug: var=result + +- assert: + that: + - result.failed == true + - result.msg is defined + +- name: run commands that include invalid command + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + - show foo + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_xml/invalid.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthan.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthan.yaml new file mode 100644 index 00000000..b3bb08fb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthan.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_xml/lessthan.yaml on connection={{ ansible_connection + }}" + +- name: test lt operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + lt 7 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test < operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + lt 7 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/lessthan.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthanorequal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthanorequal.yaml new file mode 100644 index 00000000..25a8ad17 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/lessthanorequal.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START netconf_xml/lessthanorequal.yaml on connection={{ ansible_connection + }}" + +- name: test le operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + le 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test <= operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.local-index + <= 6 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/lessthanorequal.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/notequal.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/notequal.yaml new file mode 100644 index 00000000..7da1973b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/notequal.yaml @@ -0,0 +1,40 @@ +--- +- debug: msg="START netconf_xml/notequal.yaml on connection={{ ansible_connection + }}" + +- name: test neq operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.name neq em0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: test != operator + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show interfaces lo0 + format: xml + wait_for: + - result[1].rpc-reply.interface-information.physical-interface.name neq em0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/notequal.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/output.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/output.yaml new file mode 100644 index 00000000..4941cdec --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/output.yaml @@ -0,0 +1,65 @@ +--- +- debug: msg="START netconf_xml/output.yaml on connection={{ ansible_connection + }}" + +- name: get output for single command + register: result + junipernetworks.junos.junos_command: + commands: + - show version + format: xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands + register: result + junipernetworks.junos.junos_command: + commands: + - show version + - show route + format: xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for single command with cli transport + register: result + connection: ansible.netcommon.network_cli + junipernetworks.junos.junos_command: + commands: show version | display xml + provider: + transport: cli + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- name: get output for multiple commands with cli transport + register: result + connection: ansible.netcommon.network_cli + junipernetworks.junos.junos_command: + commands: + - show version + - show route + display: xml + provider: + transport: cli + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout_lines is defined + +- debug: msg="END netconf_xml/output.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/timeout.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/timeout.yaml new file mode 100644 index 00000000..3b337103 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_command/tests/netconf_xml/timeout.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START netconf_xml/timeout.yaml on connection={{ ansible_connection + }}" + +- name: test bad condition + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: + - show version + wait_for: + - result[0] contains bad_value_string + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END netconf_xml/timeout.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/cli_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/cli_config.yaml new file mode 100644 index 00000000..093ddd1c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/cli_config.yaml @@ -0,0 +1,16 @@ +--- +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/main.yaml new file mode 100644 index 00000000..918c284c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/main.yaml @@ -0,0 +1,9 @@ +--- +- include: netconf.yaml + +- include: cli_config.yaml + tags: + - network_cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/netconf.yaml new file mode 100644 index 00000000..3240c42a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/redirection.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/redirection.yaml new file mode 100644 index 00000000..dbb7e508 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tasks/redirection.yaml @@ -0,0 +1,16 @@ +--- +- name: collect redirection test cases + find: + paths: '{{ role_path }}/tests/redirection/' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.j2 b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.j2 new file mode 100644 index 00000000..53015042 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.j2 @@ -0,0 +1,10 @@ +interfaces { + lo0 { + unit 0 { + family inet { + address 192.0.2.1/32; + } + } + } +} + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.set b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.set new file mode 100644 index 00000000..df436bba --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.set @@ -0,0 +1 @@ +set interfaces lo0 unit 0 family inet address 192.0.2.1/32 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.xml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.xml new file mode 100644 index 00000000..a120d4bc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/templates/basic/config.xml @@ -0,0 +1,15 @@ + + + lo0 + + 0 + + +
+ 192.0.2.1/32 +
+
+
+
+
+
diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_backup.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_backup.yaml new file mode 100644 index 00000000..516b835c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_backup.yaml @@ -0,0 +1,110 @@ +--- +- 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 + 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 + 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 + 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 + 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/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_basic.yaml new file mode 100644 index 00000000..1fe62706 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_basic.yaml @@ -0,0 +1,63 @@ +--- +- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection + }}" + +- name: setup + ansible.netcommon.cli_config: &id002 + config: delete interfaces ge-0/0/1 + +- name: setup + ansible.netcommon.cli_config: &id003 + config: delete interfaces ge-0/0/2 + +- name: configure device with config + register: result + ansible.netcommon.cli_config: &id001 + config: set interfaces ge-0/0/1 description 'test-interface' + +- assert: + that: + - result.changed == true + +- name: Idempotence + register: result + ansible.netcommon.cli_config: *id001 + +- assert: + that: + - result.changed == false + +- name: configure device with config + register: result + ansible.netcommon.cli_config: + config: set interfaces ge-0/0/2 description 'test-interface' + +- name: test rollabck + register: result + ansible.netcommon.cli_config: + rollback: 1 + +- assert: + that: + - result.changed == true + - "'ge-0/0/2' in result.diff.prepared" + +- name: remove root-authethication (test error scenario) + ignore_errors: true + register: result + ansible.netcommon.cli_config: + config: delete system root-authentication + +- assert: + that: + - result.failed == true + - "'Missing mandatory statement' in result.msg" + +- name: teardown + ansible.netcommon.cli_config: *id002 + +- name: teardown + ansible.netcommon.cli_config: *id003 + +- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_replace.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_replace.yaml new file mode 100644 index 00000000..b5d23b7c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/cli_config/cli_replace.yaml @@ -0,0 +1,62 @@ +--- +- debug: msg="START cli_config/cli_replace.yaml on connection={{ ansible_connection + }}" + +- name: set interface config + loop: + - delete interfaces ge-0/0/11 + - set interfaces ge-0/0/11 description "test cli_config" + ansible.netcommon.cli_config: + config: '{{ item }}' + +- name: get running configuration + register: result + ansible.netcommon.cli_command: + command: show configuration + +- name: copy configuration to file + copy: + content: "{{ result['stdout'] }}" + dest: /tmp/junos01.cfg + +- name: modify interface ge-0/0/11 configuration + replace: + path: /tmp/junos01.cfg + regexp: test cli_config + replace: test cli_config replaced + +- name: copy config file to remote host + ansible.netcommon.net_put: + src: /tmp/junos01.cfg + dest: /var/home/{{ ansible_user }}/junos01.cfg + +- name: replace syslog test file configuration + ansible.netcommon.cli_config: + replace: /var/home/{{ ansible_user }}/junos01.cfg + +- name: get interface configuration + register: result + ansible.netcommon.cli_command: + command: show configuration interfaces ge-0/0/11 + +- name: assert that interface config change is reflected on device + assert: + that: + - "'test cli_config replaced' in result.stdout" + +- name: replace interface configuration (idempotent) + register: result + ansible.netcommon.cli_config: + replace: /var/home/{{ ansible_user }}/junos01.cfg + +- name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + +- name: delete interface config + ansible.netcommon.cli_config: + config: delete interfaces ge-0/0/11 + +- debug: msg="END cli_config/cli_replace.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/backup.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/backup.yaml new file mode 100644 index 00000000..b1f46fb7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/backup.yaml @@ -0,0 +1,121 @@ +--- +- debug: msg="START netconf/backup.yaml on connection={{ ansible_connection }}" + +- name: setup + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - delete interfaces lo0 + provider: '{{ netconf }}' + +- 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 + connection: local + with_items: '{{backup_files.files|default([])}}' + +- name: configure device with config + register: result + junipernetworks.junos.junos_config: + src: basic/config.j2 + backup: true + provider: '{{ netconf }}' + +- 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*' + register: backup_files + connection: local + +- 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 + register: result + junipernetworks.junos.junos_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 + register: result + junipernetworks.junos.junos_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 + register: result + junipernetworks.junos.junos_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 netconf/backup.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/bad_action.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/bad_action.yaml new file mode 100644 index 00000000..92aa6893 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/bad_action.yaml @@ -0,0 +1,17 @@ +--- +- debug: msg="START netconf/bad_action.yaml on connection={{ ansible_connection + }}" + +- name: configure single bad_action command + register: result + ignore_errors: true + junipernetworks.junos.junos_config: + lines: + - invalid system foo + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + +- debug: msg="END netconf/bad_action.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/invalid.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/invalid.yaml new file mode 100644 index 00000000..288f1e82 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/invalid.yaml @@ -0,0 +1,29 @@ +--- +- debug: msg="START netconf/invalid.yaml on connection={{ ansible_connection }}" + +- name: configure single invalid command + register: result + ignore_errors: true + junipernetworks.junos.junos_config: + lines: + - set system foo + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + +- name: configure multiple invalid command + register: result + ignore_errors: true + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - set system foo + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + +- debug: msg="END netconf/invalid.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/multiple.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/multiple.yaml new file mode 100644 index 00000000..81b23942 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/multiple.yaml @@ -0,0 +1,47 @@ +--- +- debug: msg="START netconf/multiple.yaml on connection={{ ansible_connection }}" + +- name: setup + register: test + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - delete interfaces lo0 + provider: '{{ netconf }}' + +- name: configure multiple commands + register: result + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - set interfaces lo0 unit 0 family inet address 192.0.2.1/32 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'host-name;' not in result.diff.prepared" + - "'address 192.0.2.1/32' in result.diff.prepared" + +- name: check multiple commands idempotent + register: result + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - set interfaces lo0 unit 0 family inet address 192.0.2.1/32 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.diff is not defined + +- name: teardown + register: test + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - delete interfaces lo0 + provider: '{{ netconf }}' + +- debug: msg="END netconf/multiple.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/single.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/single.yaml new file mode 100644 index 00000000..a7e1d570 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/single.yaml @@ -0,0 +1,80 @@ +--- +- debug: msg="START netconf/single.yaml on connection={{ ansible_connection }}" + +- name: setup + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + provider: '{{ netconf }}' + +- name: configure single command + register: result + junipernetworks.junos.junos_config: + lines: + - set system host-name localhost + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'+ host-name localhost;' in result.diff.prepared" + +- name: check single command idempotent + register: result + junipernetworks.junos.junos_config: + lines: + - set system host-name localhost + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: confirm previous commit + register: result + junipernetworks.junos.junos_config: + confirm_commit: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: teardown for rollback test + junipernetworks.junos.junos_config: + lines: + - delete system syslog file test1 + provider: '{{ netconf }}' + +- name: Configure syslog file + register: result + junipernetworks.junos.junos_config: + lines: + - set system syslog file test1 any any + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *file test1") + - result.diff.prepared is search("\+ *any any") + +- name: Rollback junos config + register: result + junipernetworks.junos.junos_config: + rollback: 1 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *file test1") + - result.diff.prepared is search("\+ *any any") + +- name: teardown + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + provider: '{{ netconf }}' + +- debug: msg="END netconf/single.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_basic.yaml new file mode 100644 index 00000000..46aaf319 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_basic.yaml @@ -0,0 +1,106 @@ +--- +- debug: msg="START netconf/src_basic.yaml on connection={{ ansible_connection }}" + +- name: setup + junipernetworks.junos.junos_config: + lines: + - set system host-name {{ inventory_hostname_short }} + - delete interfaces lo0 + provider: '{{ netconf }}' + +- name: configure device with text config + register: result + junipernetworks.junos.junos_config: + src: basic/config.j2 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: check device with config + register: result + junipernetworks.junos.junos_config: + src: basic/config.j2 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: teardown + register: result + junipernetworks.junos.junos_config: + lines: + - delete interfaces lo0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: configure device with set config + register: result + junipernetworks.junos.junos_config: + src: basic/config.set + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'address 192.0.2.1/32' in result.diff.prepared" + +- name: check device with config + register: result + junipernetworks.junos.junos_config: + src: basic/config.set + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: teardown + register: result + junipernetworks.junos.junos_config: + lines: + - delete interfaces lo0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- name: configure device with xml config + register: result + junipernetworks.junos.junos_config: + src: basic/config.xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'address 192.0.2.1/32' in result.diff.prepared" + +- name: check device with config + register: result + junipernetworks.junos.junos_config: + src: basic/config.xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: teardown + register: result + junipernetworks.junos.junos_config: + lines: + - delete interfaces lo0 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + +- debug: msg="END netconf/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_invalid.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_invalid.yaml new file mode 100644 index 00000000..217cda2e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/netconf/src_invalid.yaml @@ -0,0 +1,18 @@ +--- +- debug: msg="START netconf/src_invalid.yaml on connection={{ ansible_connection + }}" + +- name: configure with invalid src + register: result + ignore_errors: true + junipernetworks.junos.junos_config: + src: basic/foobar.j2 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.failed == true + - result.msg == 'path specified in src not found' + +- debug: msg="END netconf/src_invalid.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/redirection/shortname.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/redirection/shortname.yaml new file mode 100644 index 00000000..c8aa16a2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_config/tests/redirection/shortname.yaml @@ -0,0 +1,51 @@ +--- +- debug: msg="START redirection/netconf/shortname.yaml on connection={{ ansible_connection }}" + +- name: setup + junipernetworks.junos.config: + lines: + - delete interfaces lo0 + provider: '{{ netconf }}' + +- name: Use src with module alias + register: result + junipernetworks.junos.config: + src: basic/config.j2 + provider: '{{ netconf }}' + +- assert: + that: + # make sure that the template content was read and not the path + - result.changed == true + +- name: teardown + register: result + junipernetworks.junos.config: + lines: + - delete interfaces lo0 + provider: '{{ netconf }}' + +- name: use module alias to take configuration backup + register: result + junipernetworks.junos.config: + backup: true + backup_options: + filename: backup_with_alias.cfg + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + provider: '{{ netconf }}' + +- 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/netconf/shortname.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/netconf.yaml new file mode 100644 index 00000000..3240c42a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/facts.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/facts.yaml new file mode 100644 index 00000000..4640f635 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_facts/tests/netconf/facts.yaml @@ -0,0 +1,110 @@ +--- +- debug: msg="START netconf/facts.yaml on connection={{ ansible_connection }}" + +- name: Collect default facts from device + register: result + junipernetworks.junos.junos_facts: + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'ansible_net_hostname' in result['ansible_facts']" + - "'ansible_net_interfaces' in result['ansible_facts']" + - "'ansible_net_memfree_mb' in result['ansible_facts']" + +- name: Collect config facts from device + register: result + junipernetworks.junos.junos_facts: + gather_subset: config + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'ansible_net_config' in result['ansible_facts']" + - "'ansible_net_interfaces' not in result['ansible_facts']" + - "'ansible_net_memfree_mb' not in result['ansible_facts']" + +- name: Collect all facts from device except hardware + register: result + junipernetworks.junos.junos_facts: + gather_subset: '!hardware' + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'ansible_net_config' in result['ansible_facts']" + - "'ansible_net_interfaces' in result['ansible_facts']" + - "'ansible_net_memfree_mb' not in result['ansible_facts']" + +- name: Invalid facts subset value + ignore_errors: true + register: result + junipernetworks.junos.junos_facts: + gather_subset: test + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + - "'Subset must be one of' in result.msg" + +- name: Collect config facts from device in set format + register: result + junipernetworks.junos.junos_facts: + gather_subset: config + config_format: set + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'set system services netconf ssh' in result['ansible_facts']['ansible_net_config']" + +- name: Collect config facts from device in xml format + register: result + junipernetworks.junos.junos_facts: + gather_subset: config + config_format: xml + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'' in result['ansible_facts']['ansible_net_config']" + +- name: Collect config facts from device in json format + register: result + junipernetworks.junos.junos_facts: + gather_subset: config + config_format: json + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'{{ result['ansible_facts']['ansible_net_config']['configuration'][0]['system'][0]['service'][0]['netconf']\ + \ }}' is defined" + when: ansible_net_version == "15.1X49-D15.4" + +- assert: + that: + - result.changed == false + - "'ssh' in result['ansible_facts']['ansible_net_config']['configuration']['system']['services']['netconf']" + when: ansible_net_version == "17.3R1.10" + +- name: Collect config facts from device in text format + register: result + junipernetworks.junos.junos_facts: + gather_subset: config + config_format: text + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'netconf {' in result['ansible_facts']['ansible_net_config']" + +- debug: msg="END netconf/facts.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/aliases b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/aliases new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/netconf.yaml new file mode 100644 index 00000000..17466137 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/basic.yaml new file mode 100644 index 00000000..329df53f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/basic.yaml @@ -0,0 +1,341 @@ +--- +- debug: msg="START junos_interface netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup remove interface + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: absent + provider: '{{ netconf }}' + +- name: Create interface + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ge-0/0/1' in config.xml" + - "'test-interface' in config.xml" + +- name: Create interface (idempotent) + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate interface configuration + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + - "'ge-0/0/1' in config.xml" + +- name: Activate interface configuration + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ge-0/0/1' in config.xml" + +- name: Configure interface attributes + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: present + speed: 1g + mtu: 256 + duplex: full + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ge-0/0/1' in config.xml" + - "'full-duplex' in config.xml" + - "'256' in config.xml" + - "'1g' in config.xml" + - "'test-interface' in config.xml" + +- name: Disable interface + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + enabled: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *disable") + +- name: Enable interface + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + enabled: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *disable") + +- name: Delete interface + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + description: test-interface + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ge-0/0/1' not in config.xml" + +- name: Aggregate setup- delete interface ge-0/0/1 + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: Aggregate setup- delete interface ge-0/0/2 + register: result + junipernetworks.junos.junos_interface: + name: ge-0/0/2 + state: absent + provider: '{{ netconf }}' + +- name: Set interface on aggregate + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-1 + speed: 1g + mtu: 512 + + - name: ge-0/0/2 + description: test-interface-2 + speed: 10m + mtu: 256 + duplex: full + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *ge-0/0/1") + - result.diff.prepared is search("\+ *description test-interface-1") + - result.diff.prepared is search("\+ *speed 1g") + - result.diff.prepared is search("\+ *mtu 512") + - result.diff.prepared is search("\+ *link-mode full-duplex") + - result.diff.prepared is search("\+ *description test-interface-2") + - result.diff.prepared is search("\+ *speed 10m") + - result.diff.prepared is search("\+ * mtu 256") + - result.diff.prepared is search("\+ *link-mode full-duplex") + +- name: Set interface on aggregate (idempotent) + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-1 + speed: 1g + mtu: 512 + + - name: ge-0/0/2 + description: test-interface-2 + speed: 10m + mtu: 256 + duplex: full + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Disable interface on aggregate + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *disable") + +- name: Enable interface on aggregate + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *disable") + +- name: Deactivate interface configuration on aggregate + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-1 + speed: 1g + mtu: 512 + + - name: ge-0/0/2 + description: test-interface-2 + speed: 10m + mtu: 256 + duplex: full + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] ge-0/0/1") + - result.diff.prepared is search("! *inactive[:] ge-0/0/2") + +- name: Activate interface configuration on aggregate + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-1 + speed: 1g + mtu: 512 + + - name: ge-0/0/2 + description: test-interface-2 + speed: 10m + mtu: 256 + duplex: full + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] ge-0/0/1") + - result.diff.prepared is search("! *active[:] ge-0/0/2") + +- name: Delete interface on aggregate + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *ge-0/0/1") + - result.diff.prepared is search("\- *description test-interface-1") + - result.diff.prepared is search("\- *speed 1g") + - result.diff.prepared is search("\- *mtu 512") + - result.diff.prepared is search("\- *link-mode full-duplex") + - result.diff.prepared is search("\- *description test-interface-2") + - result.diff.prepared is search("\- *speed 10m") + - result.diff.prepared is search("\- * mtu 256") + - result.diff.prepared is search("\- *link-mode full-duplex") + +- name: Delete interface on aggregate (idempotent) + register: result + junipernetworks.junos.junos_interface: + aggregate: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_interface netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/intent.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/intent.yaml new file mode 100644 index 00000000..e023cc41 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/intent.yaml @@ -0,0 +1,98 @@ +--- +- debug: msg="START junos_interface netconf/intent.yaml on connection={{ ansible_connection + }}" + +- name: get facts + register: result + junipernetworks.junos.junos_facts: + provider: '{{ netconf }}' + +- name: Define interface name for vSRX + set_fact: + intf_name: pp0 + when: result['ansible_facts']['ansible_net_model'] is search("vSRX*") + +- name: Define interface name for vsrx + set_fact: + intf_name: pp0 + when: result['ansible_facts']['ansible_net_model'] is search("vsrx") + +- name: Define interface name for vQFX + set_fact: + intf_name: gr-0/0/0 + when: result['ansible_facts']['ansible_net_model'] is search("vqfx*") + +- name: Check intent arguments + register: result + junipernetworks.junos.junos_interface: + name: '{{ intf_name }}' + state: up + tx_rate: ge(0) + rx_rate: le(0) + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == false + +- name: Check intent arguments (failed condition) + ignore_errors: true + register: result + junipernetworks.junos.junos_interface: + name: '{{ intf_name }}' + state: down + tx_rate: gt(0) + rx_rate: lt(0) + provider: '{{ netconf }}' + +- 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" + +- name: Config + intent + register: result + junipernetworks.junos.junos_interface: + name: '{{ intf_name }}' + enabled: false + state: down + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == false + - result.diff.prepared is search("\+ *disable") + +- name: Config + intent (fail) + ignore_errors: true + register: result + junipernetworks.junos.junos_interface: + name: '{{ intf_name }}' + 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 + junipernetworks.junos.junos_interface: + aggregate: + + - name: '{{ intf_name }}' + enabled: true + state: up + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == false + +- debug: msg="END junos_interface netconf/intent.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/net_interface.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/net_interface.yaml new file mode 100644 index 00000000..86b79a8f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interface/tests/netconf/net_interface.yaml @@ -0,0 +1,40 @@ +--- +- debug: msg="START junos netconf/net_interface.yaml on connection={{ ansible_connection + }}" + +- name: setup remove interface + ansible.netcommon.net_interface: + name: ge-0/0/1 + description: test-interface + state: absent + provider: '{{ netconf }}' + +- name: Create interface using platform agnostic module + register: result + ansible.netcommon.net_interface: + name: ge-0/0/1 + description: test-interface + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ge-0/0/1' in config.xml" + - "'test-interface' in config.xml" + +- name: teardown remove interface + ansible.netcommon.net_interface: + name: ge-0/0/1 + description: test-interface + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_interface.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..431d007c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/_remove_config.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: Start junos_nterfaces deleted remove interface config ansible_connection={{ + ansible_connection }} + +- name: Setup - remove interface config + junipernetworks.junos.junos_config: + lines: + - delete interfaces ge-0/0/1 + - delete interfaces ge-0/0/2 + - delete interfaces ge-0/0/3 + - delete interfaces lo0 + +- debug: + msg: End junos_nterfaces deleted remove interface config ansible_connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..dad5f2e7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,96 @@ +--- +- debug: + msg: START junos_interfaces deleted integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_deleted_output: + + - name: fxp0 + enabled: true + +- block: + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_interfaces: &id002 + config: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + hold_time: + up: 3000 + down: 3200 + state: merged + + - name: Delete the provided interface configuration from running configuration + register: result + junipernetworks.junos.junos_interfaces: &id001 + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the provided interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_interfaces: *id002 + + - name: Delete the all interface configuration from running configuration + register: result + junipernetworks.junos.junos_interfaces: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the all interface configuration from running configuration (IDEMPOTENT) + register: result + junipernetworks.junos.junos_interfaces: + state: deleted + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_interfaces deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..26d323fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,53 @@ + + + + + + ge-0/0/1 + Configured by Ansible + + 100m + 1024 + + 2000 + 2200 + + full-duplex + + 0 + + + access + + vlan100 + + + + + + + ge-0/0/2 + Configured by Ansible + 400 + 10m + 2048 + + 3000 + 3200 + + + 0 + + + trunk + + vlan200 + vlan300 + + + + + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/gathered.yaml new file mode 100644 index 00000000..a254d40b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/gathered.yaml @@ -0,0 +1,73 @@ +--- +- debug: + msg: START junos_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_merged_output: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + enabled: true + hold_time: + up: 3000 + down: 3200 + + - name: fxp0 + enabled: true + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_interfaces: &id001 + config: + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + hold_time: + up: 3000 + down: 3200 + state: merged + + - name: Gather interfaces facts using gathered state + register: result + junipernetworks.junos.junos_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_interfaces gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/groups.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/groups.yaml new file mode 100644 index 00000000..3e41be7d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/groups.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: START junos_interfaces groups integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_group_output: + + - name: ge-0/0/11 + description: within test group + enabled: true + + - name: ge-0/0/12 + description: global interface config + enabled: true + + - name: fxp0 + enabled: true + +- name: Teardown delete interface configuration + junipernetworks.junos.junos_config: &id001 + lines: + - delete apply-groups test + - delete groups test interfaces ge-0/0/11 + - delete interfaces ge-0/0/12 + +- block: + + - name: Setup interface configuration + junipernetworks.junos.junos_config: + lines: + - set groups test interfaces ge-0/0/11 description "within test group" + - set apply-groups test + - set interfaces ge-0/0/12 description "global interface config" + + - name: get junos interfaces facts + register: result + junipernetworks.junos.junos_facts: + gather_subset: min + gather_network_resources: interfaces + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_group_output | symmetric_difference(result['ansible_facts']['ansible_network_resources']['interfaces'])|length\ + \ == 0 }}" + always: + + - name: Teardown delete interface configuration + junipernetworks.junos.junos_config: *id001 + +- debug: + msg: END junos_interfaces merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..ae927e9e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,80 @@ +--- +- debug: + msg: START junos_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_merged_output: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + enabled: true + hold_time: + up: 3000 + down: 3200 + + - name: fxp0 + enabled: true + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_interfaces: &id001 + config: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + hold_time: + up: 3000 + down: 3200 + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_interfaces merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/overridden.yaml new file mode 100644 index 00000000..cd413ecc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/overridden.yaml @@ -0,0 +1,74 @@ +--- +- debug: + msg: START junos_interfaces overridden integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_overridden_output: + + - name: ge-0/0/1 + description: Overridden by Ansible - Interface 1 + enabled: true + + - name: fxp0 + enabled: true + +- block: + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_interfaces: + config: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + hold_time: + up: 3000 + down: 3200 + state: merged + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_interfaces: &id001 + config: + + - name: ge-0/0/1 + description: Overridden by Ansible - Interface 1 + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_interfaces overridden integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..d83c6aa7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,41 @@ +--- +- debug: + msg: START junos_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - description: Configured by Ansible + duplex: full-duplex + enabled: false + hold_time: + down: 2200 + up: 2000 + mtu: 1024 + name: ge-0/0/1 + speed: 100m + + - description: Configured by Ansible + enabled: true + hold_time: + down: 3200 + up: 3000 + mtu: 2048 + name: ge-0/0/2 + speed: 10m + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..3bfe4c5c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,29 @@ +--- +- debug: + msg: START junos_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "ge-0/0/2Configured by Ansibull20m204832003200" + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_interfaces: + config: + - name: ge-0/0/2 + description: Configured by Ansibull + mtu: 2048 + speed: 20m + hold_time: + up: 3200 + down: 3200 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..611e279c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,88 @@ +--- +- debug: + msg: START junos_interfaces replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_replaced_output: + + - name: ge-0/0/1 + description: Replaced by Ansible - Interface 1 + mtu: 2048 + speed: 10m + enabled: true + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + enabled: true + hold_time: + up: 3000 + down: 3200 + + - name: fxp0 + enabled: true + +- block: + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_interfaces: + config: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + hold_time: + up: 3000 + down: 3200 + state: merged + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_interfaces: &id001 + config: + + - name: ge-0/0/1 + description: Replaced by Ansible - Interface 1 + mtu: 2048 + speed: 10m + enabled: true + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_interfaces replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rtt.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rtt.yaml new file mode 100644 index 00000000..ef4f7890 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_interfaces/tests/netconf/rtt.yaml @@ -0,0 +1,108 @@ +--- +- debug: + msg: START junos_interfaces round trip integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_revert_output: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + enabled: true + hold_time: + up: 3000 + down: 3200 + + - name: fxp0 + enabled: true + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + junipernetworks.junos.junos_interfaces: + config: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 + mtu: 1024 + speed: 100m + enabled: false + duplex: full-duplex + hold_time: + up: 2000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 + mtu: 2048 + speed: 10m + enabled: true + hold_time: + up: 3000 + down: 3200 + state: merged + + - name: Gather interfaces facts + junipernetworks.junos.junos_facts: + gather_subset: + - default + gather_network_resources: + - interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + junipernetworks.junos.junos_interfaces: + config: + + - name: ge-0/0/1 + description: Configured by Ansible - Interface 1 modified + mtu: 3048 + speed: 10m + enabled: true + duplex: half-duplex + hold_time: + up: 3000 + down: 2200 + + - name: ge-0/0/2 + description: Configured by Ansible - Interface 2 modified + mtu: 4048 + speed: 100m + enabled: false + hold_time: + up: 4000 + down: 5200 + state: merged + + - name: Assert that changes were applied + assert: + that: result['changed'] == true + + - name: Revert back to base config using facts round trip + register: revert + junipernetworks.junos.junos_interfaces: + config: "{{ ansible_facts['network_resources']['interfaces'] }}" + state: replaced + + - name: Assert that config was reverted + assert: + that: "{{ expected_revert_output | symmetric_difference(revert['after'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/netconf.yaml new file mode 100644 index 00000000..5b96a41b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/basic.yaml new file mode 100644 index 00000000..e0e87335 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/basic.yaml @@ -0,0 +1,332 @@ +--- +- debug: msg="START junos_l2_interface netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove interface address + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: setup - remove interface address + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/2 + state: absent + provider: '{{ netconf }}' + +- name: Setup create vlans + with_items: + + - vlan_id: 100 + name: red + + - vlan_id: 200 + name: blue + + - vlan_id: 300 + name: green + junipernetworks.junos.junos_vlan: + vlan_id: '{{ item.vlan_id }}' + name: '{{ item.name }}' + state: present + provider: '{{ netconf }}' + +- name: Configure interface in access mode + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.diff.prepared is search("\+ *ge-0/0/1") + - result.diff.prepared is search("\+ *description test-interface-access") + - result.diff.prepared is search("\+ *unit 0") + - result.diff.prepared is search("\+ *family ethernet-switching") + - result.diff.prepared is search("\+ *interface-mode access") + - result.diff.prepared is search("\+ *members red") + +- name: Configure interface in access mode (idempotent) + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate interface in access mode + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + active: false + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] ge-0/0/1") + - result.diff.prepared is search("! *inactive[:] unit 0") + - result.diff.prepared is search("! *inactive[:] family ethernet-switching") + - result.diff.prepared is search("! *inactive[:] vlan") + +- name: Activate interface in access mode + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] ge-0/0/1") + - result.diff.prepared is search("! *active[:] unit 0") + - result.diff.prepared is search("! *active[:] family ethernet-switching") + - result.diff.prepared is search("! *active[:] vlan") + +- name: Change interface to trunk mode + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *description test-interface-access") + - result.diff.prepared is search("\+ *description test-interface-trunk") + - result.diff.prepared is search("\+ *native-vlan-id 100") + - result.diff.prepared is search("\- *interface-mode access") + - result.diff.prepared is search("\+ *interface-mode trunk") + - result.diff.prepared is search("\- *members red") + - result.diff.prepared is search("\+ *members \[ blue green \]") + +- name: Change interface to trunk mode (idempotent) + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Delete l2 interface + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *description test-interface-trunk") + - result.diff.prepared is search("\- *native-vlan-id 100") + - result.diff.prepared is search("\- *unit 0") + - result.diff.prepared is search("\- *family ethernet-switching") + - result.diff.prepared is search("\- *interface-mode trunk") + - result.diff.prepared is search("\- *members \[ blue green \]") + +- name: Delete l2 interface (idempotent) + register: result + junipernetworks.junos.junos_l2_interface: + name: ge-0/0/1 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Configure interface in access and trunk mode using aggregate + register: result + junipernetworks.junos.junos_l2_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + + - name: ge-0/0/2 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *ge-0/0/1") + - result.diff.prepared is search("\+ *description test-interface-access") + - result.diff.prepared is search("\+ *unit 0") + - result.diff.prepared is search("\+ *family ethernet-switching") + - result.diff.prepared is search("\+ *interface-mode access") + - result.diff.prepared is search("\+ *members red") + - result.diff.prepared is search("\+ *ge-0/0/2") + - result.diff.prepared is search("\+ *description test-interface-trunk") + - result.diff.prepared is search("\+ *native-vlan-id 100") + - result.diff.prepared is search("\+ *interface-mode trunk") + - result.diff.prepared is search("\+ *members \[ blue green \]") + +- name: Configure interface in access and trunk mode using aggregate (idempotent) + register: result + junipernetworks.junos.junos_l2_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + + - name: ge-0/0/2 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Delete interface in access and trunk mode using aggregate + register: result + junipernetworks.junos.junos_l2_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + + - name: ge-0/0/2 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *ge-0/0/1") + - result.diff.prepared is search("\- *description test-interface-access") + - result.diff.prepared is search("\- *unit 0") + - result.diff.prepared is search("\- *family ethernet-switching") + - result.diff.prepared is search("\- *interface-mode access") + - result.diff.prepared is search("\- *members red") + - result.diff.prepared is search("\- *ge-0/0/2") + - result.diff.prepared is search("\- *description test-interface-trunk") + - result.diff.prepared is search("\- *native-vlan-id 100") + - result.diff.prepared is search("\- *interface-mode trunk") + - result.diff.prepared is search("\- *members \[ blue green \]") + +- name: Delete interface in access and trunk mode using aggregate (idempotent) + register: result + junipernetworks.junos.junos_l2_interface: + aggregate: + + - name: ge-0/0/1 + description: test-interface-access + mode: access + access_vlan: red + + - name: ge-0/0/2 + description: test-interface-trunk + mode: trunk + trunk_vlans: + - blue + - green + native_vlan: 100 + active: true + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Teradown delete vlans + with_items: + + - vlan_id: 100 + name: red + + - vlan_id: 200 + name: blue + + - vlan_id: 300 + name: green + junipernetworks.junos.junos_vlan: + vlan_id: '{{ item.vlan_id }}' + name: '{{ item.name }}' + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos_l2_interface netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/net_l2_interface.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/net_l2_interface.yaml new file mode 100644 index 00000000..2f0af6ea --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interface/tests/netconf/net_l2_interface.yaml @@ -0,0 +1,55 @@ +--- +- debug: msg="START junos netconf/net_l2_interface.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove interface address + ansible.netcommon.net_l2_interface: + name: ge-0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: Setup create vlan 100 + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: red + state: present + provider: '{{ netconf }}' + +- name: Configure interface in access mode using platform agnostic module + register: result + ansible.netcommon.net_l2_interface: + name: ge-0/0/1 + description: l2 interface configured by Ansible + mode: access + access_vlan: red + active: true + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.diff.prepared is search("\+ *ge-0/0/1") + - result.diff.prepared is search("\+ *description \"l2 interface configured + by Ansible\"") + - result.diff.prepared is search("\+ *unit 0") + - result.diff.prepared is search("\+ *family ethernet-switching") + - result.diff.prepared is search("\+ *interface-mode access") + - result.diff.prepared is search("\+ *members red") + +- name: teardown - remove interface address + ansible.netcommon.net_l2_interface: + name: ge-0/0/1 + state: absent + provider: '{{ netconf }}' + +- name: teardown delete vlan 100 + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: red + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_l3_interface.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..a9149c3b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_base_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_base_config.yaml new file mode 100644 index 00000000..a7eb673b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_base_config.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: Start junos_l2_interfaces base config ansible_connection={{ ansible_connection + }} + +- name: Configure vlan + junipernetworks.junos.junos_config: + lines: + - set vlans vlan100 vlan-id 100 + - set vlans vlan200 vlan-id 200 + - set vlans vlan300 vlan-id 300 + - set vlans vlan400 vlan-id 400 + +- debug: + msg: End junos_l2_interfaces base config ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..bca59f52 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/_remove_config.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: Start junos_l2_interfaces deleted remove l2 interface config ansible_connection={{ + ansible_connection }} + +- name: Setup - remove interface config + junipernetworks.junos.junos_config: + lines: + - delete interfaces ge-0/0/1 + - delete interfaces ge-0/0/2 + - delete interfaces ge-0/0/3 + - delete interfaces lo0 + - delete vlans vlan100 + - delete vlans vlan200 + - delete vlans vlan300 + - delete vlans vlan400 + +- debug: + msg: End junos_l2_interfaces deleted remove l2 interface config ansible_connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..44fa44d7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,92 @@ +--- +- debug: + msg: START junos_l2_interfaces deleted integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_deleted_output: + + - name: ge-0/0/1 + unit: 0 + enhanced_layer: true + access: + vlan: vlan100 + +- block: + + - name: Configure initial state for l2 interface + register: result + junipernetworks.junos.junos_l2_interfaces: &id002 + config: + + - name: ge-0/0/1 + access: + vlan: vlan100 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: merged + + - name: Delete the provided l2 interface configuration from running configuration + register: result + junipernetworks.junos.junos_l2_interfaces: &id001 + config: + + - name: ge-0/0/2 + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the provided l2 interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_l2_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_l2_interfaces: *id002 + + - name: Delete the all l2 interface configuration from running configuration + register: result + junipernetworks.junos.junos_l2_interfaces: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ result['after'] == [] }}" + + - name: Delete the all l2 interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_l2_interfaces: + state: deleted + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_l2_interfaces deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..42fac96a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,53 @@ + + + + + + ge-0/0/1 + Configured by Ansible + + 100m + 1024 + + 2000 + 2200 + + full-duplex + + 0 + + + access + + vlan100 + + + + + + + ge-0/0/2 + Configured by Ansible + 400 + 10m + 2048 + + 3000 + 3200 + + + 0 + + + trunk + + vlan200 + vlan300 + + + + + + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/gathered.yaml new file mode 100644 index 00000000..4c46acc0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/gathered.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START junos_l2_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_merged_output: + + - name: ge-0/0/1 + access: + vlan: vlan100 + enhanced_layer: true + unit: 0 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + enhanced_layer: true + unit: 0 + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_l2_interfaces: + config: + + - name: ge-0/0/1 + access: + vlan: vlan100 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: merged + + - name: Gather l2_interfaces facts using gathered state + register: result + junipernetworks.junos.junos_l2_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_l2_interfaces gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..7dc26fd4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,68 @@ +--- +- debug: + msg: START junos_l2_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_merged_output: + + - name: ge-0/0/1 + access: + vlan: vlan100 + enhanced_layer: true + unit: 0 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + enhanced_layer: true + unit: 0 + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_l2_interfaces: &id001 + config: + + - name: ge-0/0/1 + access: + vlan: vlan100 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided l2 interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_l2_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_l2_interfaces merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/overridden.yaml new file mode 100644 index 00000000..9a317f7f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/overridden.yaml @@ -0,0 +1,73 @@ +--- +- debug: + msg: START junos_l2_interfaces override integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_overridden_output: + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan100 + native_vlan: '200' + enhanced_layer: true + unit: 0 + +- block: + + - name: Setup initial l2 configuration + register: result + junipernetworks.junos.junos_l2_interfaces: + config: + + - name: ge-0/0/1 + access: + vlan: vlan100 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: overridden + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_l2_interfaces: &id001 + config: + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan100 + native_vlan: '200' + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Override the provided l2 interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_l2_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_l2_interfaces override integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..2cd9f3cf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: START junos_l2_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - name: ge-0/0/1 + access: + vlan: vlan100 + enhanced_layer: true + unit: 0 + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + enhanced_layer: true + unit: 0 + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_l2_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_l2_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..5488f7d0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START junos_l2_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: " + + ge-0/0/1 + + 0 + + + access + + vlan100 + + + + + + + ge-0/0/2 + + 0 + + + trunk + + vlan200 + vlan300 + + + + + 400 + + " + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_l2_interfaces: + config: + - name: ge-0/0/1 + access: + vlan: vlan100 + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan200 + - vlan300 + native_vlan: '400' + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_l2_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..f2b6ebaa --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,68 @@ +--- +- debug: + msg: START junos_l2_interfaces replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_replaced_output: + + - name: ge-0/0/1 + trunk: + allowed_vlans: + - vlan100 + - vlan300 + native_vlan: '400' + enhanced_layer: true + unit: 0 + + - name: ge-0/0/2 + access: + vlan: vlan200 + enhanced_layer: true + unit: 0 + +- block: + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_l2_interfaces: &id001 + config: + + - name: ge-0/0/1 + trunk: + allowed_vlans: + - vlan100 + - vlan300 + native_vlan: '400' + + - name: ge-0/0/2 + access: + vlan: vlan200 + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace the provided interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_l2_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_l2_interfaces replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml new file mode 100644 index 00000000..f7ad581f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l2_interfaces/tests/netconf/rtt.yml @@ -0,0 +1,79 @@ +--- +- debug: + msg: START junos_l2_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_revert_output: + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan100 + native_vlan: '200' + enhanced_layer: true + unit: 0 + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + junipernetworks.junos.junos_l2_interfaces: + config: + + - name: ge-0/0/2 + trunk: + allowed_vlans: + - vlan100 + native_vlan: '200' + state: merged + + - name: Gather interfaces facts + junipernetworks.junos.junos_facts: + gather_subset: + - default + gather_network_resources: + - l2_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + junipernetworks.junos.junos_l2_interfaces: + config: + + - name: ge-0/0/1 + trunk: + allowed_vlans: + - vlan100 + - vlan300 + native_vlan: '400' + + - name: ge-0/0/2 + access: + vlan: vlan200 + state: replaced + + - name: Assert that changes were applied + assert: + that: result['changed'] == true + + - name: Revert back to base config using facts round trip + register: revert + junipernetworks.junos.junos_l2_interfaces: + config: "{{ ansible_facts['network_resources']['l2_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ expected_revert_output | symmetric_difference(revert['after'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_l2_interfaces round trip integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/netconf.yaml new file mode 100644 index 00000000..17466137 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/basic.yaml new file mode 100644 index 00000000..ff97add7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/basic.yaml @@ -0,0 +1,271 @@ +--- +- debug: msg="START junos_l3_interface netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove interface address + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: '{{ netconf }}' + +- name: Configure interface address + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'192.0.2.1/32' in config.xml" + - "'fd5d:12c9:2201:1::1/128' in config.xml" + - result.diff.prepared is search("\+ *address 192.0.2.1/32") + - result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128") + +- name: Configure interface address (idempotent) + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate interface address + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'
' in config.xml" + - result.diff.prepared is search("! *inactive[:] address 192.0.2.1/32") + - result.diff.prepared is search("! *inactive[:] address fd5d:12c9:2201:1::1/128") + +- name: Activate interface address + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: present + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] address 192.0.2.1/32") + - result.diff.prepared is search("! *active[:] address fd5d:12c9:2201:1::1/128") + +- name: Delete interface address + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.diff.prepared is search("\- *address 192.0.2.1/32") + - result.diff.prepared is search("\- *address fd5d:12c9:2201:1::1/128") + +- name: Delete interface address (idempotent) + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Aggregate setup- delete interface ge-0/0/1 + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: '{{ netconf }}' + +- name: Aggregate setup- delete interface ge-0/0/2 + register: result + junipernetworks.junos.junos_l3_interface: + name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + state: absent + provider: '{{ netconf }}' + +- name: Configure l3 interface in aggregate + register: result + junipernetworks.junos.junos_l3_interface: + aggregate: + + - name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'edit interfaces ge-0/0/1 unit 0 family inet' in result.diff.prepared" + - result.diff.prepared is search("\+ *address 192.0.2.1/32") + - "'edit interfaces ge-0/0/1 unit 0 family inet6' in result.diff.prepared" + - result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128") + - "'edit interfaces ge-0/0/2 unit 0 family inet' in result.diff.prepared" + - result.diff.prepared is search("\+ *address 192.0.2.2/32") + - "'edit interfaces ge-0/0/2 unit 0 family inet6' in result.diff.prepared" + - result.diff.prepared is search("\+ *address fd5d:12c9:2201:2::2/128") + +- name: Configure l3 interface in aggregate (idempotent) + register: result + junipernetworks.junos.junos_l3_interface: + aggregate: + + - name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate l3 interface configuration + register: result + junipernetworks.junos.junos_l3_interface: + aggregate: + + - name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] address 192.0.2.1/32") + - result.diff.prepared is search("! *inactive[:] address fd5d:12c9:2201:1::1/128") + - result.diff.prepared is search("! *inactive[:] address 192.0.2.2/32") + - result.diff.prepared is search("! *inactive[:] address fd5d:12c9:2201:2::2/128") + +- name: Activate l3 interface configuration + register: result + junipernetworks.junos.junos_l3_interface: + aggregate: + + - name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] address 192.0.2.1/32") + - result.diff.prepared is search("! *active[:] address fd5d:12c9:2201:1::1/128") + - result.diff.prepared is search("! *active[:] address 192.0.2.2/32") + - result.diff.prepared is search("! *active[:] address fd5d:12c9:2201:2::2/128") + +- name: Delete l3 interface configuration + register: result + junipernetworks.junos.junos_l3_interface: + aggregate: + + - name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'edit interfaces ge-0/0/1 unit 0 family inet' in result.diff.prepared" + - result.diff.prepared is search("\- *address 192.0.2.1/32") + - "'edit interfaces ge-0/0/1 unit 0 family inet6' in result.diff.prepared" + - result.diff.prepared is search("\- *address fd5d:12c9:2201:1::1/128") + - "'edit interfaces ge-0/0/2 unit 0 family inet' in result.diff.prepared" + - result.diff.prepared is search("\- *address 192.0.2.2/32") + - "'edit interfaces ge-0/0/2 unit 0 family inet6' in result.diff.prepared" + - result.diff.prepared is search("\- *address fd5d:12c9:2201:2::2/128") + +- name: Delete l3 interface configuration (idempotent) + register: result + junipernetworks.junos.junos_l3_interface: + aggregate: + + - name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + + - name: ge-0/0/2 + ipv4: 192.0.2.2 + ipv6: fd5d:12c9:2201:2::2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_l3_interface netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/net_l3_interface.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/net_l3_interface.yaml new file mode 100644 index 00000000..643de1f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interface/tests/netconf/net_l3_interface.yaml @@ -0,0 +1,45 @@ +--- +- debug: msg="START junos netconf/net_l3_interface.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove interface address + ansible.netcommon.net_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: '{{ netconf }}' + +- name: Configure interface address using platform agnostic module + register: result + ansible.netcommon.net_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'192.0.2.1/32' in config.xml" + - "'fd5d:12c9:2201:1::1/128' in config.xml" + - result.diff.prepared is search("\+ *address 192.0.2.1/32") + - result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128") + +- name: teardown - remove interface address + ansible.netcommon.net_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_l3_interface.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..c4d55904 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tasks/netconf.yaml @@ -0,0 +1,16 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..bca8ef29 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,55 @@ + + + + + + ge-1/0/0 + + 0 + + +
+ 192.168.100.1/24 +
+
+ 10.200.16.20/24 +
+
+ +
+
+
+ + ge-2/0/0 + + 0 + + +
+ 192.168.100.2/24 +
+
+ 10.200.16.21/24 +
+
+ +
+
+ + 1 + + +
+ 192.178.100.2/24 +
+
+ 10.210.16.21/24 +
+
+ +
+
+
+
+
+
diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/junos_l3_interfaces.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/junos_l3_interfaces.yml new file mode 100644 index 00000000..6474dada --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/junos_l3_interfaces.yml @@ -0,0 +1,145 @@ +--- +- name: bootstrap interfaces + register: result + junipernetworks.junos.junos_l3_interfaces: + config: + + - name: ge-1/0/0 + ipv4: + + - address: 192.168.100.1/24 + + - address: 10.200.16.20/24 + + - name: ge-2/0/0 + ipv4: + + - address: 192.168.100.2/24 + + - address: 10.200.16.21/24 + + - name: ge-3/0/0 + ipv4: + + - address: 192.168.100.3/24 + + - address: 10.200.16.22/24 + state: replaced + +- assert: + that: + - result is changed + - "'192.168.100.1/24' in result.commands[0]" + - "'10.200.16.20/24' in result.commands[0]" + - result.after[0].name == 'ge-1/0/0' + - result.after[0].ipv4[0]['address'] == '192.168.100.1/24' + - result.after[0].ipv4[1]['address'] == '10.200.16.20/24' + +- name: bootstrap interfaces (idempotent) + register: result + junipernetworks.junos.junos_l3_interfaces: + config: + + - name: ge-1/0/0 + ipv4: + + - address: 192.168.100.1/24 + + - address: 10.200.16.20/24 + + - name: ge-2/0/0 + ipv4: + + - address: 192.168.100.2/24 + + - address: 10.200.16.21/24 + + - name: ge-3/0/0 + ipv4: + + - address: 192.168.100.3/24 + + - address: 10.200.16.22/24 + state: replaced + +- assert: + that: + - result is not changed + +- name: Gather l3_interfaces facts using gathered state + register: result + junipernetworks.junos.junos_l3_interfaces: + state: gathered + +- name: Assert that facts were correctly generated + assert: + that: + - result.gathered[0].name == 'ge-1/0/0' + - result.gathered[0].ipv4[0]['address'] == '192.168.100.1/24' + - result.gathered[0].ipv4[1]['address'] == '10.200.16.20/24' + - result.gathered[1].name == 'ge-2/0/0' + - result.gathered[1].ipv4[0]['address'] == '192.168.100.2/24' + - result.gathered[1].ipv4[1]['address'] == '10.200.16.21/24' + - result.gathered[2].name == 'ge-3/0/0' + - result.gathered[2].ipv4[0]['address'] == '192.168.100.3/24' + - result.gathered[2].ipv4[1]['address'] == '10.200.16.22/24' + +- name: Add another interface ip + register: result + junipernetworks.junos.junos_l3_interfaces: + config: + + - name: ge-1/0/0 + ipv4: + + - address: 100.64.0.1/10 + + - address: 100.64.0.2/10 + state: merged + +- assert: + that: + - result is changed + - "'100.64.0.1/10' in result.commands[0]" + - "'100.64.0.2/10' in result.commands[0]" + - result.after[0].name == 'ge-1/0/0' + - result.after[0].ipv4[0]['address'] == '192.168.100.1/24' + - result.after[0].ipv4[1]['address'] == '10.200.16.20/24' + - result.after[0].ipv4[2]['address'] == '100.64.0.1/10' + - result.after[0].ipv4[3]['address'] == '100.64.0.2/10' + +- name: Delete ge-2/0/0 interface config + register: result + junipernetworks.junos.junos_l3_interfaces: + config: + + - name: ge-2/0/0 + state: deleted + +- assert: + that: + - result is changed + - "'ge-2/0/00' in result.commands[0]" + +- name: Override all config + register: result + junipernetworks.junos.junos_l3_interfaces: + config: + + - name: ge-1/0/0 + ipv4: + + - address: dhcp + + - name: fxp0 + ipv4: + + - address: dhcp + state: overridden + +- assert: + that: + - result is changed + - "'fxp00'\ + \ in result.commands[0]" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..65ad2bc4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,46 @@ +--- +- debug: + msg: START junos_l3_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - name: ge-1/0/0 + ipv4: + + - address: 192.168.100.1/24 + + - address: 10.200.16.20/24 + unit: 0 + + - name: ge-2/0/0 + ipv4: + + - address: 192.168.100.2/24 + + - address: 10.200.16.21/24 + unit: 0 + + - name: ge-2/0/0 + ipv4: + + - address: 192.178.100.2/24 + + - address: 10.210.16.21/24 + unit: 1 + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_l3_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_l3_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..67c60e89 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_l3_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START junos_l3_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: " + + ge-0/0/1 + + 0 + + + access + + vlan100 + + + + + + + ge-0/0/2 + + 0 + + + trunk + + vlan200 + vlan300 + + + + + 400 + + " + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_l3_interfaces: + config: + - name: ge-1/0/0 + ipv4: + - address: 192.168.100.1/24 + - address: 10.200.16.20/24 + unit: 0 + + - name: ge-2/0/0 + ipv4: + - address: 192.168.100.2/24 + - address: 10.200.16.21/24 + unit: 0 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_l3_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..78b3e5a3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/_remove_config.yaml @@ -0,0 +1,13 @@ +--- +- debug: + msg: Start junos_lacp deleted remove lacp config ansible_connection={{ ansible_connection + }} + +- name: Setup - remove lacp config + junipernetworks.junos.junos_config: + lines: + - delete chassis aggregated-devices ethernet lacp + +- debug: + msg: End junos_lacp deleted remove lacp config ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/deleted.yaml new file mode 100644 index 00000000..c1a05216 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/deleted.yaml @@ -0,0 +1,47 @@ +--- +- debug: + msg: START junos_lacp deleted lacp tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_deleted_output: [] + +- block: + + - name: Merge global LACP attributes + register: result + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: revertive + state: merged + + - name: Delete global lacp attributes + register: result + junipernetworks.junos.junos_lacp: &id001 + config: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ result['after'] == {} }}" + + - name: Delete the provided interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp deleted lacp integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..88c8729f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,16 @@ + + + + + + + + 63 + + + + + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/gathered.yaml new file mode 100644 index 00000000..581e51ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/gathered.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START junos_lacp gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_merged_output: + system_priority: 63 + link_protection: revertive + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp: &id001 + config: + system_priority: 63 + link_protection: revertive + state: merged + + - name: Gather lacp facts using gathered state + register: result + junipernetworks.junos.junos_lacp: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output == result['gathered'] }}" + + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/merged.yaml new file mode 100644 index 00000000..a8dc9fc5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/merged.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: START junos_lacp merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_merged_output: + + - system_priority: 63 + link_protection: revertive + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp: &id001 + config: + system_priority: 63 + link_protection: revertive + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference([result['after']])\ + \ |length == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/parsed.yaml new file mode 100644 index 00000000..b57869d0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/parsed.yaml @@ -0,0 +1,23 @@ +--- +- debug: + msg: START junos_lacp parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + link_protection: revertive + system_priority: 63 + +- name: Parse externally provided lacp config to agnostic model + register: result + junipernetworks.junos.junos_lacp: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output == result['parsed'] }}" +- debug: + msg: END junos_lacp parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rendered.yaml new file mode 100644 index 00000000..a019d15d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rendered.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: START junos_lacp rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "63" + + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: revertive + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_lacp rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/replaced.yaml new file mode 100644 index 00000000..0e2fc0d5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/replaced.yaml @@ -0,0 +1,50 @@ +--- +- debug: + msg: START junos_lacp replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_replaced_output: + + - system_priority: 73 + +- block: + + - name: Set initial config + junipernetworks.junos.junos_lacp: + config: + system_priority: 73 + link_protection: revertive + state: replaced + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp: &id001 + config: + system_priority: 73 + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference([result['after']])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rtt.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rtt.yaml new file mode 100644 index 00000000..40c9152d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp/tests/netconf/rtt.yaml @@ -0,0 +1,58 @@ +--- +- debug: + msg: START junos_lacp RTT integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_revert_output: + + - system_priority: 63 + link_protection: non-revertive + +- block: + + - name: Apply the provided configuration (base config) + junipernetworks.junos.junos_lacp: + config: + system_priority: 63 + link_protection: non-revertive + state: merged + + - name: Gather interfaces facts + junipernetworks.junos.junos_facts: + gather_subset: + - default + gather_network_resources: + - lacp + + - name: Apply the provided configuration (config to be reverted) + register: result + junipernetworks.junos.junos_lacp: + config: + system_priority: 73 + link_protection: revertive + state: replaced + + - name: Assert that changes were applied + assert: + that: result['changed'] == true + + - name: Revert back to base config using facts round trip + register: revert + junipernetworks.junos.junos_lacp: + config: "{{ ansible_facts['network_resources']['lacp'] }}" + state: replaced + + - name: Assert that config was reverted + assert: + that: "{{ expected_revert_output | symmetric_difference([revert['after']])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp RTT integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/meta/main.yaml new file mode 100644 index 00000000..7f867d73 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_base_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_base_config.yaml new file mode 100644 index 00000000..359251bc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_base_config.yaml @@ -0,0 +1,18 @@ +--- +- debug: + msg: Start junos_lacp_interfaces base config ansible_connection={{ ansible_connection + }} + +- name: Configure base lag interface + junipernetworks.junos.junos_config: + lines: + - set interfaces ae1 description "Configured by Ansible" + - set interfaces ae2 description "Configured by Ansible" + - set interfaces ge-0/0/1 ether-options 802.3ad ae1 + - set interfaces ge-0/0/2 ether-options 802.3ad ae1 + - set interfaces ge-0/0/3 ether-options 802.3ad ae2 + - set interfaces ge-0/0/4 ether-options 802.3ad ae2 + +- debug: + msg: End junos_lacp_interfaces base config ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..0f480ea5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/_remove_config.yaml @@ -0,0 +1,19 @@ +--- +- debug: + msg: Start junos_nterfaces deleted remove interface config ansible_connection={{ + ansible_connection }} + +- name: Setup - remove interface config + junipernetworks.junos.junos_config: + lines: + - delete interfaces ae1 + - delete interfaces ae2 + - delete interfaces ge-0/0/1 + - delete interfaces ge-0/0/2 + - delete interfaces ge-0/0/3 + - delete interfaces ge-0/0/4 + - delete interfaces lo0 + +- debug: + msg: End junos_nterfaces deleted remove interface config ansible_connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..12cf02b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,112 @@ +--- +- debug: + msg: START junos_lacp_interfaces deleted integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_deleted_output: + + - name: ae2 + period: slow + sync_reset: disable + system: + priority: 200 + mac: + address: 00:00:00:00:00:04 + + - name: ge-0/0/3 + port_priority: 300 + +- block: + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_lacp_interfaces: &id002 + config: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + + - name: ae2 + period: slow + sync_reset: disable + system: + priority: 200 + mac: + address: 00:00:00:00:00:04 + + - name: ge-0/0/3 + port_priority: 300 + force_up: false + state: merged + + - name: Delete the provided interface configuration from running configuration + register: result + junipernetworks.junos.junos_lacp_interfaces: &id001 + config: + + - name: ae1 + + - name: ge-0/0/1 + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the provided lacp interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_lacp_interfaces: *id002 + + - name: Delete the all lacp interface configuration from running configuration + register: result + junipernetworks.junos.junos_lacp_interfaces: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ result['after'] == [] }}" + + - name: Delete the all lacp interfaces configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp_interfaces: + state: deleted + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp_interfaces deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..2fd505b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,130 @@ + + + + + + ge-0/0/1 + + + + + 100 + + ae1 + + + + + ge-0/0/2 + + + ae1 + + + + + ge-0/0/3 + + + ae2 + + + + + ge-0/0/4 + + + ae2 + + + + + ge-1/0/0 + + 0 + + +
+ 192.168.100.1/24 +
+
+ 10.200.16.20/24 +
+
+ +
+
+
+ + ge-2/0/0 + + 0 + + +
+ 192.168.100.2/24 +
+
+ 10.200.16.21/24 +
+
+ +
+
+
+ + ge-3/0/0 + + 0 + + +
+ 192.168.100.3/24 +
+
+ 10.200.16.22/24 +
+
+ +
+
+
+ + ae1 + Configured by Ansible + + + fast + enable + 100 + 00:00:00:00:00:02 + + + + + ae2 + Configured by Ansible + + + em1 + TEST + + + fxp0 + ANSIBLE + 1g + automatic + + 0 + + +
+ 10.8.38.38/24 +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/gathered.yaml new file mode 100644 index 00000000..f9f14771 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/gathered.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START junos_lacp_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_merged_output: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp_interfaces: &id001 + config: + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + state: merged + + - name: Gather interfaces facts using gathered state + register: result + junipernetworks.junos.junos_lacp_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp_interfaces gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..dddff1a6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,66 @@ +--- +- debug: + msg: START junos_lacp_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_merged_output: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp_interfaces: &id001 + config: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp_interfaces merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/overridden.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/overridden.yml new file mode 100644 index 00000000..d43fd03e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/overridden.yml @@ -0,0 +1,88 @@ +--- +- debug: + msg: START junos_lacp_interfaces overide integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_overridden_output: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:01 + +- block: + + - name: Configure initial state for lacp interface + register: result + junipernetworks.junos.junos_lacp_interfaces: + config: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + + - name: ae2 + period: slow + sync_reset: disable + system: + priority: 200 + mac: + address: 00:00:00:00:00:04 + + - name: ge-0/0/3 + port_priority: 300 + force_up: false + state: merged + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp_interfaces: &id001 + config: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:01 + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp_interfaces override integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..cfdca38a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START junos_lacp_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_lacp_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_lacp_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..ceeae445 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,34 @@ +--- +- debug: + msg: START junos_lacp_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "ae1fastenable00:00:00:00:00:02100ge-0/0/1100" + + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_lacp_interfaces: + config: + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_lacp_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..460befe5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,120 @@ +--- +- debug: + msg: START junos_lacp_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_replaced_output: + + - name: ae1 + period: slow + sync_reset: disable + system: + priority: 10 + mac: + address: 00:00:00:00:00:03 + + - name: ae2 + period: fast + system: + priority: 300 + + - name: ge-0/0/1 + force_up: true + port_priority: 100 + + - name: ge-0/0/2 + port_priority: 250 + + - name: ge-0/0/3 + port_priority: 300 + + - name: ge-0/0/4 + port_priority: 400 + force_up: true + +- block: + + - name: Configure initial state for lacp interface + register: result + junipernetworks.junos.junos_lacp_interfaces: + config: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:02 + + - name: ge-0/0/1 + port_priority: 100 + force_up: true + + - name: ae2 + period: slow + sync_reset: disable + system: + priority: 200 + mac: + address: 00:00:00:00:00:04 + + - name: ge-0/0/3 + port_priority: 300 + force_up: false + state: merged + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lacp_interfaces: &id001 + config: + + - name: ae1 + period: slow + sync_reset: disable + system: + priority: 10 + mac: + address: 00:00:00:00:00:03 + + - name: ge-0/0/2 + port_priority: 250 + force_up: false + + - name: ae2 + period: fast + system: + priority: 300 + + - name: ge-0/0/4 + port_priority: 400 + force_up: true + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lacp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp_interfaces replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rtt.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rtt.yaml new file mode 100644 index 00000000..63556796 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lacp_interfaces/tests/netconf/rtt.yaml @@ -0,0 +1,104 @@ +--- +- debug: + msg: START junos_lacp_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_revert_output: + + - name: ae1 + period: slow + sync_reset: disable + system: + priority: 10 + mac: + address: 00:00:00:00:00:03 + + - name: ae2 + period: fast + system: + priority: 300 + + - name: ge-0/0/2 + port_priority: 250 + force_up: true + + - name: ge-0/0/4 + port_priority: 400 + force_up: true + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + junipernetworks.junos.junos_lacp_interfaces: + config: + + - name: ae1 + period: slow + sync_reset: disable + system: + priority: 10 + mac: + address: 00:00:00:00:00:03 + + - name: ge-0/0/2 + port_priority: 250 + force_up: false + + - name: ae2 + period: fast + system: + priority: 300 + + - name: ge-0/0/4 + port_priority: 400 + force_up: true + state: merged + + - name: Gather interfaces facts + junipernetworks.junos.junos_facts: + gather_subset: + - default + gather_network_resources: + - lacp_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + junipernetworks.junos.junos_lacp_interfaces: + config: + + - name: ae1 + period: fast + sync_reset: enable + system: + priority: 100 + mac: + address: 00:00:00:00:00:01 + state: merged + + - name: Assert that changes were applied + assert: + that: result['changed'] == true + + - name: Revert back to base config using facts round trip + register: revert + junipernetworks.junos.junos_lacp_interfaces: + config: "{{ ansible_facts['network_resources']['lacp_interfaces'] }}" + state: overridden + + - name: Assert that config was reverted + assert: + that: "{{ expected_revert_output | symmetric_difference(revert['after'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lacp_interfaces round trip integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_base_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_base_config.yaml new file mode 100644 index 00000000..07dfa74c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_base_config.yaml @@ -0,0 +1,14 @@ +--- +- debug: + msg: Start junos_lag_interfaces base config ansible_connection={{ ansible_connection + }} + +- name: Configure base lag interface + junipernetworks.junos.junos_config: + lines: + - set interfaces ae1 description "Configured by Ansible" + - set interfaces ae2 description "Configured by Ansible" + +- debug: + msg: End junos_lag_interfaces base config ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..53ab1090 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/_remove_config.yaml @@ -0,0 +1,18 @@ +--- +- debug: + msg: Start junos_lag_interfaces teardown ansible_connection={{ ansible_connection + }} + +- name: Remove interface config + junipernetworks.junos.junos_config: + lines: + - delete interfaces ge-0/0/1 + - delete interfaces ge-0/0/2 + - delete interfaces ge-0/0/3 + - delete interfaces ge-0/0/4 + - delete interfaces ae1 + - delete interfaces ae2 + +- debug: + msg: End junos_lag_interfaces teardown ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..ce42708f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,103 @@ +--- +- debug: + msg: START junos_lag_interfaces deleted integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_deleted_1_output: + + - name: ae1 + members: + + - member: ge-0/0/1 + + - member: ge-0/0/2 + mode: active + expected_deleted_2_output: [] + +- block: + + - name: Base LAG configuration + junipernetworks.junos.junos_lag_interfaces: &id002 + config: + + - name: ae1 + members: + + - member: ge-0/0/1 + + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + state: merged + + - name: Delete the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lag_interfaces: &id001 + config: + + - name: ae2 + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_1_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lag_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Configure initial state for lag interface + register: result + junipernetworks.junos.junos_lag_interfaces: *id002 + + - name: Delete the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lag_interfaces: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_2_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the provided configuration with the exisiting running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lag_interfaces: + state: deleted + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lag_interfaces deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..99a37d1c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,135 @@ + + + + + + ge-0/0/1 + + + ae1 + + + + + ge-0/0/2 + + + ae1 + + + + + ge-0/0/3 + + + ae2 + + + + + + ge-0/0/4 + + + ae2 + + + + + + ge-1/0/0 + + 0 + + +
+ 192.168.100.1/24 +
+
+ 10.200.16.20/24 +
+
+ + +
+
+
+ + ge-2/0/0 + + 0 + + +
+ 192.168.100.2/24 +
+
+ 10.200.16.21/24 +
+
+ + +
+
+
+ + ge-3/0/0 + + 0 + + +
+ 192.168.100.3/24 +
+
+ 10.200.16.22/24 +
+
+ + +
+
+
+ + ae1 + Configured by Ansible + + + + + + + + ae2 + Configured by Ansible + + + + + + + + + + em1 + TEST + + + fxp0 + ANSIBLE + 1g + automatic + + 0 + + +
+ 10.8.38.38/24 +
+
+
+
+
+
+
+
diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml new file mode 100644 index 00000000..a3a869e7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/gathered.yaml @@ -0,0 +1,68 @@ +--- +- debug: + msg: START junos_lag_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_merged_output: + + - name: ae1 + members: + - member: ge-0/0/1 + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lag_interfaces: &id001 + config: + + - name: ae1 + members: + - member: ge-0/0/1 + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + - member: ge-0/0/3 + link_type: primary + - member: ge-0/0/4 + link_type: backup + mode: passive + state: merged + + - name: Gather lag interfaces facts using gathered state + register: result + junipernetworks.junos.junos_lag_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lag_interfaces gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..0d2ad044 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,80 @@ +--- +- debug: + msg: START junos_lag_interfaces merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_merged_output: + + - name: ae1 + members: + + - member: ge-0/0/1 + + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lag_interfaces: &id001 + config: + + - name: ae1 + members: + + - member: ge-0/0/1 + + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lag_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lag_interfaces merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml new file mode 100644 index 00000000..bbae046f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/overridden.yaml @@ -0,0 +1,78 @@ +--- +- debug: + msg: START junos_lag_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_overridden_output: + + - name: ae1 + members: + + - member: ge-0/0/2 + mode: active + +- block: + + - name: Base LAG configuration + junipernetworks.junos.junos_lag_interfaces: + config: + + - name: ae1 + members: + + - member: ge-0/0/1 + + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + state: merged + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lag_interfaces: &id001 + config: + + - name: ae1 + members: + + - member: ge-0/0/2 + mode: active + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lag_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lag_interfaces overridden integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..935618b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: START junos_lag_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - name: ae1 + members: + - member: ge-0/0/1 + - member: ge-0/0/2 + mode: active + - name: ae2 + link_protection: true + members: + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_lag_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_lag_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..e349008a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,36 @@ +--- +- debug: + msg: START junos_lag_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "ae1ge-0/0/1ae1ge-0/0/2ae1ae2ge-0/0/3ae2ge-0/0/4ae2" + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_lag_interfaces: + config: + - name: ae1 + members: + - member: ge-0/0/1 + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + - member: ge-0/0/3 + link_type: primary + - member: ge-0/0/4 + link_type: backup + mode: passive + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_lag_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..dd2dc6ef --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lag_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,89 @@ +--- +- debug: + msg: START junos_lag_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_replaced_output: + + - name: ae1 + members: + + - member: ge-0/0/1 + mode: passive + + - name: ae2 + link_protection: true + members: + + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + +- block: + + - name: Base LAG configuration + junipernetworks.junos.junos_lag_interfaces: + config: + + - name: ae1 + members: + + - member: ge-0/0/1 + + - member: ge-0/0/2 + mode: active + + - name: ae2 + link_protection: true + members: + + - member: ge-0/0/3 + link_type: primary + + - member: ge-0/0/4 + link_type: backup + mode: passive + state: merged + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lag_interfaces: &id001 + config: + + - name: ae1 + members: + + - member: ge-0/0/1 + mode: passive + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lag_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_lag_interfaces replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tasks/netconf.yaml new file mode 100644 index 00000000..c5806ab5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/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 + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/basic.yaml new file mode 100644 index 00000000..6a3686ed --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/basic.yaml @@ -0,0 +1,245 @@ +--- +- debug: msg="START junos_linkagg netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove linkagg + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: absent + provider: '{{ netconf }}' + +- name: configure linkagg + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ae0' in config.xml" + - "'4' in config.xml" + - "'ae0' in config.xml" + - "'' in config.xml" + +- name: configure linkagg (idempotent) + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: configure lacp in passive + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: passive + device_count: 4 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + +- name: delete lacp + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: false + device_count: 4 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' not in config.xml" + +- name: Change device count + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + device_count: 2 + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'2' in config.xml" + +- name: Disable linkagg interface + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + state: down + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *disable") + +- name: Enable linkagg interface + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + state: up + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *disable") + +- name: Deactivate linkagg + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ae0' in config.xml" + - "'4' in config.xml" + + - "'inactive: ae0' in result.diff.prepared" + +- name: Activate linkagg + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + - "'ae0' in config.xml" + + - "'active: device-count 4' in result.diff.prepared" + + - "'active: ae0' in result.diff.prepared" + +- name: Delete linkagg + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' not in config.xml" + - "'ae0' not in config.xml" + - "'4' not in config.xml" + - "'ae0' not in config.xml" + +- name: Delete linkagg (idempotent) + register: result + junipernetworks.junos.junos_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_linkagg netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/net_linkagg.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/net_linkagg.yaml new file mode 100644 index 00000000..11a556b2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_linkagg/tests/netconf/net_linkagg.yaml @@ -0,0 +1,54 @@ +--- +- debug: msg="START junos netconf/net_linkagg.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove linkagg + ansible.netcommon.net_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: absent + provider: '{{ netconf }}' + +- name: configure linkagg using platform agnostic module + register: result + ansible.netcommon.net_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ae0' in config.xml" + - "'4' in config.xml" + - "'ae0' in config.xml" + - "'' in config.xml" + +- name: teardown - remove linkagg + ansible.netcommon.net_linkagg: + name: ae0 + members: + - ge-0/0/6 + - ge-0/0/7 + mode: active + device_count: 4 + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_linkagg.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tasks/netconf.yaml new file mode 100644 index 00000000..c5806ab5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/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 + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/basic.yaml new file mode 100644 index 00000000..65c986c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/basic.yaml @@ -0,0 +1,140 @@ +--- +- debug: msg="START junos_lldp netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - name: setup - Disable lldp and remove it's configuration + junipernetworks.junos.junos_lldp: + state: absent + provider: '{{ netconf }}' + + - name: Enable lldp + register: result + junipernetworks.junos.junos_lldp: + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + + - name: Enable lldp (idempotent) + register: result + junipernetworks.junos.junos_lldp: + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == false + + - name: configure lldp parameters and enable lldp + register: result + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 2 + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *advertisement-interval 10") + - result.diff.prepared is search("\+ *transmit-delay 2") + - result.diff.prepared is search("\+ *hold-multiplier 5") + + - name: configure lldp parameters and enable lldp(idempotent) + register: result + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 2 + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == false + + - name: configure lldp parameters and disable lldp + register: result + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 2 + state: disabled + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *disable") + - "'advertisement-interval 10;' not in result.diff.prepared" + - "'transmit-delay 2;' not in result.diff.prepared" + - "'hold-multiplier 5;' not in result.diff.prepared" + + - name: configure lldp parameters and enable lldp + register: result + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 2 + state: enabled + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *disable") + - "'advertisement-interval 10;' not in result.diff.prepared" + - "'transmit-delay 2;' not in result.diff.prepared" + - "'hold-multiplier 5;' not in result.diff.prepared" + + - name: Remove lldp configuration and diable lldp + register: result + junipernetworks.junos.junos_lldp: + interval: 10 + hold_multiplier: 5 + transmit_delay: 2 + state: absent + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *disable") + - result.diff.prepared is search("\- *advertisement-interval 10") + - result.diff.prepared is search("\- *transmit-delay 2") + - result.diff.prepared is search("\- *hold-multiplier 5") + + - name: Remove lldp (idempotent) + register: result + junipernetworks.junos.junos_lldp: + state: absent + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == false + when: lldp_supported + +- debug: msg="END junos_lldp netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/net_lldp.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/net_lldp.yaml new file mode 100644 index 00000000..2bb56d13 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp/tests/netconf/net_lldp.yaml @@ -0,0 +1,45 @@ +--- +- debug: msg="START junos netconf/net_lldp.yaml on connection={{ ansible_connection + }}" + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - name: setup - Disable lldp - setup + ansible.netcommon.net_lldp: + state: absent + provider: '{{ netconf }}' + + - name: Enable lldp using platform agnostic module + register: result + ansible.netcommon.net_lldp: + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + + - name: setup - Disable lldp - teardown + ansible.netcommon.net_lldp: + state: absent + provider: '{{ netconf }}' + when: lldp_supported + +- debug: msg="START junos netconf/net_lldp.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..68a7b0f8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/_remove_config.yaml @@ -0,0 +1,13 @@ +--- +- debug: + msg: Start junos_lldp_global deleted remove interface config ansible_connection={{ + ansible_connection }} + +- name: Setup - remove lldp global config + junipernetworks.junos.junos_config: + lines: + - delete protocols lldp + +- debug: + msg: End junos_lldp_global deleted remove interface config ansible_connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/deleted.yaml new file mode 100644 index 00000000..5d28d041 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/deleted.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START junos_lldp_global deleted integration tests on connection={{ ansible_connection + }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_deleted_output: [] + + - name: Configure initial state for lldp global + register: result + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + + - name: Delete the provided configuration from running configuration + register: result + junipernetworks.junos.junos_lldp_global: &id001 + config: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ result['after'] == {} }}" + + - name: Delete the provided configuration from running configuration (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_global: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_global deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..28735efb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,28 @@ + + + + + + + 0.0.0.0 + + ge-0/0/0.0 + + + + + 10.1.1.1 + 10000 + 400 + 10 + + ge-0/0/1 + + + ge-0/0/2 + + + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/gathered.yaml new file mode 100644 index 00000000..2d62d741 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/gathered.yaml @@ -0,0 +1,57 @@ +--- +- debug: + msg: START junos_lldp_global gathered integration tests on connection={{ + ansible_connection }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- set_fact: + expected_merged_output: + - interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 1 + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_global: &id001 + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + + - name: Gather lldp_global facts using gathered state + register: result + junipernetworks.junos.junos_lldp_global: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output == result['gathered'] }}" + + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_global gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/merged.yaml new file mode 100644 index 00000000..c55a82e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/merged.yaml @@ -0,0 +1,66 @@ +--- +- debug: + msg: START junos_lldp_global merged integration tests on connection={{ ansible_connection + }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_merged_output: + + - interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_global: &id001 + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference([result['after']])\ + \ |length == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_global: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_global merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/parsed.yaml new file mode 100644 index 00000000..58795ddc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/parsed.yaml @@ -0,0 +1,25 @@ +--- +- debug: + msg: START junos_lldp_global parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + address: 10.1.1.1 + hold_multiplier: 10 + interval: 10000 + transmit_delay: 400 + +- name: Parse externally provided lldp_global config to agnostic model + register: result + junipernetworks.junos.junos_lldp_global: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output == result['parsed'] }}" +- debug: + msg: END junos_lldp_global parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rendered.yaml new file mode 100644 index 00000000..26d6d717 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rendered.yaml @@ -0,0 +1,27 @@ +--- +- debug: + msg: START junos_lldp_global rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "10.1.1.11000040010" + + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_lldp_global rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/replaced.yaml new file mode 100644 index 00000000..975b4f68 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/replaced.yaml @@ -0,0 +1,78 @@ +--- +- debug: + msg: START junos_lldp_global replaced integration tests on connection={{ ansible_connection + }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_replaced_output: + + - interval: 20000 + address: 10.1.1.2 + transmit_delay: 500 + hold_multiplier: 5 + enabled: false + + - name: Configure initial state for lldp global + register: result + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_global: &id001 + config: + interval: 20000 + address: 10.1.1.2 + transmit_delay: 500 + hold_multiplier: 5 + enabled: false + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference([result['after']])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_global: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_global replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rtt.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rtt.yaml new file mode 100644 index 00000000..bca9af01 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_global/tests/netconf/rtt.yaml @@ -0,0 +1,83 @@ +--- +- debug: + msg: START junos_lldp_global round trip integration tests on connection={{ ansible_connection + }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_revert_output: + + - interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + + - name: Apply the provided configuration (base config) + register: base_config + junipernetworks.junos.junos_lldp_global: + config: + interval: 10000 + address: 10.1.1.1 + transmit_delay: 400 + hold_multiplier: 10 + state: merged + + - name: Gather interfaces facts + junipernetworks.junos.junos_facts: + gather_subset: + - default + gather_network_resources: + - lldp_global + + - name: Apply the provided configuration (config to be reverted) + register: result + junipernetworks.junos.junos_lldp_global: + config: + interval: 20000 + address: 10.1.1.2 + transmit_delay: 500 + hold_multiplier: 5 + enabled: false + state: replaced + + - name: Assert that changes were applied + assert: + that: result['changed'] == true + + - name: Revert back to base config using facts round trip + register: revert + junipernetworks.junos.junos_lldp_global: + config: "{{ ansible_facts['network_resources']['lldp_global'] }}" + state: replaced + + - name: Assert that config was reverted + assert: + that: "{{ expected_revert_output | symmetric_difference([revert['after']])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_global round trip integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tasks/netconf.yaml new file mode 100644 index 00000000..65197396 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/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 + connection: local + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml new file mode 100644 index 00000000..16a25305 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/basic.yaml @@ -0,0 +1,127 @@ +--- +- debug: msg="START junos_lldp_interface netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - name: setup - Remove lldp interface configuration + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: absent + provider: '{{ netconf }}' + + - name: lldp interface configuration + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *interface ge-0/0/5") + + - name: lldp interface configuration (idempotent) + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == false + + - name: Deactivate lldp interface configuration + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + active: false + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/5") + + - name: Activate lldp interface configuration + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: present + active: true + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] interface ge-0/0/5") + + - name: Disable lldp on particular interface + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: disabled + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *disable") + + - name: Enable lldp on particular interface + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: enabled + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *disable") + + - name: Delete lldp on particular interface + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: absent + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *interface ge-0/0/5") + + - name: Delete lldp on particular interface (idempotent) + register: result + junipernetworks.junos.junos_lldp_interface: + name: ge-0/0/5 + state: absent + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == false + when: lldp_supported + +- debug: msg="END junos_lldp_interface netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/net_lldp_interface.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/net_lldp_interface.yaml new file mode 100644 index 00000000..aa3799ea --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interface/tests/netconf/net_lldp_interface.yaml @@ -0,0 +1,49 @@ +--- +- debug: msg="START junos netconf/net_lldp_interface.yaml on connection={{ ansible_connection + }}" + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - name: setup - Remove lldp interface configuration + ansible.netcommon.net_lldp_interface: + name: ge-0/0/5 + state: absent + provider: '{{ netconf }}' + + - name: lldp interface configuration using platform agnostic module + register: result + ansible.netcommon.net_lldp_interface: + name: ge-0/0/5 + state: present + provider: '{{ netconf }}' + + - assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *interface ge-0/0/5") + + - name: teardown - Remove lldp interface configuration + ansible.netcommon.net_lldp_interface: + name: ge-0/0/5 + state: absent + provider: '{{ netconf }}' + when: lldp_supported + +- debug: msg="END junos netconf/net_lldp_interface.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..6fdc44dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/_remove_config.yaml @@ -0,0 +1,13 @@ +--- +- debug: + msg: Start junos_lldp_interfaces deleted remove interface config ansible_connection={{ + ansible_connection }} + +- name: Setup - remove lldp interfaces config + junipernetworks.junos.junos_config: + lines: + - delete protocols lldp + +- debug: + msg: End junos_lldp_interfaces deleted remove interface config ansible_connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..2427d2c3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,97 @@ +--- +- debug: + msg: START junos_lldp_interfaces deleted integration tests on connection={{ + ansible_connection }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_deleted_output: + + - name: ge-0/0/1 + + - name: Configure initial state for lldp interfaces + register: result + junipernetworks.junos.junos_lldp_interfaces: &id002 + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + state: merged + + - name: Delete the provided lldp interface configuration from running configuration + register: result + junipernetworks.junos.junos_lldp_interfaces: &id001 + config: + + - name: ge-0/0/2 + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_deleted_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Delete the provided lldp interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_lldp_interfaces: *id002 + + - name: Delete the all lldp interface configuration from running configuration + register: result + junipernetworks.junos.junos_lldp_interfaces: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ result['after'] == []}}" + + - name: Delete the all lldp interface configuration from running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_interfaces: + state: deleted + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_interfaces deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..7875abec --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,24 @@ + + + + + + + 0.0.0.0 + + ge-0/0/0.0 + + + + + + ge-0/0/1 + + + ge-0/0/2 + + + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/gathered.yaml new file mode 100644 index 00000000..a0502cf5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/gathered.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START junos_lldp_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- set_fact: + expected_merged_output: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_interfaces: &id001 + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + state: merged + + - name: Gather lag interfaces facts using gathered state + register: result + junipernetworks.junos.junos_lldp_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_merged_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_interfaces gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..ddb6588d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,67 @@ +--- +- debug: + msg: START junos_lldp_interfaces merged integration tests on connection={{ ansible_connection + }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_merged_output: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_interfaces: &id001 + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_interfaces merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/overridden.yaml new file mode 100644 index 00000000..c5dd5e4c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/overridden.yaml @@ -0,0 +1,72 @@ +--- +- debug: + msg: START junos_lldp_interfaces overridden integration tests on connection={{ + ansible_connection }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_overridden_output: + + - name: ge-0/0/2 + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_lldp_interfaces: + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + state: merged + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_interfaces: &id001 + config: + + - name: ge-0/0/2 + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_interfaces overridden integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..24d611c6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,27 @@ +--- +- debug: + msg: START junos_lldp_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + +- name: Parse externally provided lldp interfaces config to agnostic model + register: result + junipernetworks.junos.junos_lldp_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_lldp_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..9eb9fddd --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,28 @@ +--- +- debug: + msg: START junos_lldp_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "ge-0/0/1ge-0/0/2" + + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_lldp_interfaces: + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_lldp_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..be552bf4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,76 @@ +--- +- debug: + msg: START junos_lldp_interfaces replaced integration tests on connection={{ + ansible_connection }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_replaced_output: + + - name: ge-0/0/1 + enabled: false + + - name: ge-0/0/2 + enabled: false + + - name: Configure initial state for interface + register: result + junipernetworks.junos.junos_lldp_interfaces: + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_lldp_interfaces: &id001 + config: + + - name: ge-0/0/1 + enabled: false + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_lldp_interfaces: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_interfaces replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rtt.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rtt.yaml new file mode 100644 index 00000000..f82acc10 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_lldp_interfaces/tests/netconf/rtt.yaml @@ -0,0 +1,81 @@ +--- +- debug: + msg: START junos_lldp_interfaces round trip integration tests on connection={{ + ansible_connection }} + +- name: get supported protocols + register: result + ignore_errors: true + junipernetworks.junos.junos_command: + commands: show lldp + +- name: lldp supported + set_fact: + lldp_supported: true + when: not result.failed + +- name: lldp not supported + set_fact: + lldp_supported: false + when: result.failed + +- block: + + - include_tasks: _remove_config.yaml + + - set_fact: + expected_revert_output: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + + - name: Apply the provided configuration (base config) + register: base_config + junipernetworks.junos.junos_lldp_interfaces: + config: + + - name: ge-0/0/1 + + - name: ge-0/0/2 + enabled: false + state: merged + + - name: Gather interfaces facts + junipernetworks.junos.junos_facts: + gather_subset: + - default + gather_network_resources: + - lldp_interfaces + + - name: Apply the provided configuration (config to be reverted) + register: result + junipernetworks.junos.junos_lldp_interfaces: + config: + + - name: ge-0/0/2 + state: overridden + + - name: Assert that changes were applied + assert: + that: result['changed'] == true + + - name: Revert back to base config using facts round trip + register: revert + junipernetworks.junos.junos_lldp_interfaces: + config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}" + state: replaced + + - name: Assert that config was reverted + assert: + that: "{{ expected_revert_output | symmetric_difference(revert['after'])\ + \ |length == 0 }}" + always: + + - include_tasks: _remove_config.yaml + when: lldp_supported + +- debug: + msg: END junos_lldp_interfaces round trip integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/aliases new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tasks/netconf.yaml new file mode 100644 index 00000000..c5806ab5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/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 + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml new file mode 100644 index 00000000..da482502 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/basic.yaml @@ -0,0 +1,443 @@ +--- +- debug: msg="START junos_logging netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove file logging + junipernetworks.junos.junos_logging: + dest: file + name: test + facility: pfe + level: error + state: absent + provider: '{{ netconf }}' + +- name: Create file logging + register: result + junipernetworks.junos.junos_logging: + dest: file + name: test_file + facility: pfe + level: error + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_file' in config.xml" + - "'pfe' in config.xml" + - "'' in config.xml" + +- name: Create file logging (idempotent) + register: result + junipernetworks.junos.junos_logging: + dest: file + name: test_file + facility: pfe + level: error + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate logging configuration + register: result + junipernetworks.junos.junos_logging: + dest: file + name: test_file + facility: pfe + level: error + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + - "'' in config.xml" + +- name: Activate logging configuration + register: result + junipernetworks.junos.junos_logging: + dest: file + name: test_file + facility: pfe + level: error + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_file' in config.xml" + - "'pfe' in config.xml" + - "'' in config.xml" + +- name: Delete logging configuration + register: result + junipernetworks.junos.junos_logging: + dest: file + name: test_file + facility: pfe + level: error + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_file' not in config.xml" + +- name: Configure console logging + register: result + junipernetworks.junos.junos_logging: + dest: console + facility: kernel + level: emergency + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + - "'kernel' in config.xml" + - "'' in config.xml" + +- name: Configure console logging (idempotent) + register: result + junipernetworks.junos.junos_logging: + dest: console + facility: kernel + level: emergency + state: present + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Disable console logging + register: result + junipernetworks.junos.junos_logging: + dest: console + facility: kernel + level: emergency + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + +- name: Delete console logging + register: result + junipernetworks.junos.junos_logging: + dest: console + facility: kernel + level: emergency + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' not in config.xml" + +- name: Configure logging parameters + register: result + junipernetworks.junos.junos_logging: + size: 65536 + files: 40 + rotate_frequency: 20 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'64k' in config.xml" + - "'40' in config.xml" + - "'20' in config.xml" + +- name: Configure logging parameters (idempotent) + register: result + junipernetworks.junos.junos_logging: + size: 65536 + files: 40 + rotate_frequency: 20 + state: present + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Disable logging parameters + register: result + junipernetworks.junos.junos_logging: + size: 65536 + files: 40 + rotate_frequency: 20 + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'64k' in config.xml" + - "'40' in config.xml" + - "'20'\ + \ in config.xml" + +- name: Activate logging parameters + register: result + junipernetworks.junos.junos_logging: + size: 65536 + files: 40 + rotate_frequency: 20 + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'64k' in config.xml" + - "'40' in config.xml" + - "'20' in config.xml" + +- name: Delete logging parameters + register: result + junipernetworks.junos.junos_logging: + size: 65536 + files: 40 + rotate_frequency: 20 + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'64k' not in config.xml" + - "'40' not in config.xml" + - "'20' not in config.xml" + +- name: Seup file logging using aggregate + register: result + junipernetworks.junos.junos_logging: + aggregate: + + - dest: file + name: test-1 + facility: pfe + level: critical + state: absent + + - dest: file + name: test-2 + facility: kernel + level: emergency + state: absent + provider: '{{ netconf }}' + +- name: Configure file logging using aggregate + register: result + junipernetworks.junos.junos_logging: + aggregate: + + - dest: file + name: test-1 + facility: pfe + level: critical + active: true + + - dest: file + name: test-2 + facility: kernel + level: emergency + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *file test-1") + - result.diff.prepared is search("\+ *pfe critical") + - result.diff.prepared is search("\+ *file test-2") + - result.diff.prepared is search("\+ *kernel emergency") + +- name: Deactivate file logging configuration using aggregate + register: result + junipernetworks.junos.junos_logging: + aggregate: + + - dest: file + name: test-1 + facility: pfe + level: critical + + - dest: file + name: test-2 + facility: kernel + level: emergency + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] file test-1") + - result.diff.prepared is search("! *inactive[:] pfe") + - result.diff.prepared is search("! *inactive[:] file test-2") + - result.diff.prepared is search("! *inactive[:] kernel") + +- name: activate file logging configuration using aggregate + register: result + junipernetworks.junos.junos_logging: + aggregate: + + - dest: file + name: test-1 + facility: pfe + level: critical + + - dest: file + name: test-2 + facility: kernel + level: emergency + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] file test-1") + - result.diff.prepared is search("! *active[:] pfe") + - result.diff.prepared is search("! *active[:] file test-2") + - result.diff.prepared is search("! *active[:] kernel") + +- name: Delete file logging using aggregate + register: result + junipernetworks.junos.junos_logging: + aggregate: + + - dest: file + name: test-1 + facility: pfe + level: critical + + - dest: file + name: test-2 + facility: kernel + level: emergency + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *file test-1") + - result.diff.prepared is search("\- *pfe critical") + - result.diff.prepared is search("\- *file test-2") + - result.diff.prepared is search("\- *kernel emergency") + +- name: Delete file logging using aggregate (idempotent) + register: result + junipernetworks.junos.junos_logging: + aggregate: + + - dest: file + name: test-1 + facility: pfe + level: critical + + - dest: file + name: test-2 + facility: kernel + level: emergency + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_logging netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/net_logging.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/net_logging.yaml new file mode 100644 index 00000000..396b9910 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_logging/tests/netconf/net_logging.yaml @@ -0,0 +1,47 @@ +--- +- debug: msg="START junos netconf/net_logging.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove file logging + ansible.netcommon.net_logging: + dest: file + name: test + facility: pfe + level: error + state: absent + provider: '{{ netconf }}' + +- name: Create file logging using platform agnostic module + register: result + ansible.netcommon.net_logging: + dest: file + name: test_file + facility: pfe + level: error + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_file' in config.xml" + - "'pfe' in config.xml" + - "'' in config.xml" + +- name: teardown - remove file logging + ansible.netcommon.net_logging: + dest: file + name: test + facility: pfe + level: error + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_logging.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/cli.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/cli.yaml new file mode 100644 index 00000000..5ee50150 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/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 + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/main.yaml new file mode 100644 index 00000000..07b0f2e9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: cli.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/changeport.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/changeport.yaml new file mode 100644 index 00000000..cec5bc9b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/changeport.yaml @@ -0,0 +1,107 @@ +--- +- debug: msg="START netconf/changeport.yaml on connection={{ ansible_connection + }}" + +- name: Setup + junipernetworks.junos.junos_netconf: + state: present + +- name: Change port + register: result + junipernetworks.junos.junos_netconf: + state: present + netconf_port: 8022 + +- assert: + that: + - result.changed == true + +- name: idempotent tests + register: result + junipernetworks.junos.junos_netconf: + state: present + netconf_port: 8022 + +- assert: + that: + - result.changed == false + +- name: wait for netconf port tcp/8022 to be open + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 8022 + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can communicate over 8022 + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=8022 is_ignore_errors=false' + +- name: wait for netconf port tcp/830 to be closed + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + state: stopped + with_inventory_hostnames: junos + +- name: Ensure we can NOT communicate over default port + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=true' + +- assert: + that: + - result.failed == true + +- name: Set back netconf to default port + junipernetworks.junos.junos_netconf: + state: present + +- name: wait for netconf port tcp/830 to be open + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can communicate over netconf + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=false' + +- name: Change port (check mode) + register: result + check_mode: true + junipernetworks.junos.junos_netconf: + state: present + netconf_port: 12345 + +- assert: + that: + - result.changed == true + +- name: wait for netconf port tcp/12345 to be closed + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 12345 + state: stopped + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can NOT communicate over non-default port + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=12345 is_ignore_errors=true' + +- assert: + that: + - result.failed == true + +- name: Ensure we can communicate over default port + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=false' + +- debug: msg="END netconf/changeport.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/netconf.yaml new file mode 100644 index 00000000..97a6dd0f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/cli/netconf.yaml @@ -0,0 +1,121 @@ +--- +- debug: msg="START netconf/netconf.yaml on connection={{ ansible_connection }}" + +- name: Ensure netconf is enabled + junipernetworks.junos.junos_netconf: + state: present + +- name: idempotent tests + register: result + junipernetworks.junos.junos_netconf: + state: present + +- assert: + that: + - result.changed == false + +- name: wait for netconf port tcp/830 to be open + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can communicate over netconf + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=false' + +- name: Disable netconf (check mode) + register: result + check_mode: true + junipernetworks.junos.junos_netconf: + state: absent + +- assert: + that: + - result.changed == true + +- name: wait for netconf port tcp/830 to be open + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can communicate over netconf + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=false' + +- name: Disable netconf + register: result + junipernetworks.junos.junos_netconf: + state: absent + +- assert: + that: + - result.changed == true + +- name: idempotent tests + register: result + junipernetworks.junos.junos_netconf: + state: absent + +- assert: + that: + - result.changed == false + +- name: wait for netconf port tcp/830 to be closed + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + state: stopped + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can NOT talk via netconf + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=true' + +- assert: + that: + - result.failed == true + +- name: Enable netconf (check mode) + register: result + check_mode: true + junipernetworks.junos.junos_netconf: + state: present + +- assert: + that: + - result.changed == true + +- name: wait for netconf port tcp/830 to be closed + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + state: stopped + with_inventory_hostnames: junos + +- name: Reset ansible connections + meta: reset_connection + +- name: Ensure we can NOT talk via netconf + include: '{{ role_path }}/tests/utils/junos_command.yaml ansible_connection=ansible.netcommon.netconf + ansible_port=830 is_ignore_errors=true' + +- assert: + that: + - result.failed == true + +- name: re-enable netconf + junipernetworks.junos.junos_netconf: + state: present + +- debug: msg="END netconf/netconfg.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/utils/junos_command.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/utils/junos_command.yaml new file mode 100644 index 00000000..20342d22 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_netconf/tests/utils/junos_command.yaml @@ -0,0 +1,6 @@ +--- +- name: run junos_command to check netconf connectivity + register: result + ignore_errors: '{{ is_ignore_errors }}' + junipernetworks.junos.junos_command: + rpcs: get-software-information diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/defaults/main.yaml new file mode 100644 index 00000000..164afead --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/main.yaml new file mode 100644 index 00000000..cc27f174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: netconf.yaml, tags: ['netconf'] } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/netconf.yaml new file mode 100644 index 00000000..3eed8424 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_initial_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_initial_config.yaml new file mode 100644 index 00000000..34310bbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_initial_config.yaml @@ -0,0 +1,18 @@ +--- +- debug: + msg: "START junos_ospfv2 initial config on connection={{ ansible_connection }}" + +- name: Set initial configuration for ospf + junos_ospfv2: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + +- debug: + msg: "END junos_ospfv2 initial config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_reset_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_reset_config.yaml new file mode 100644 index 00000000..dd351302 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/_reset_config.yaml @@ -0,0 +1,11 @@ +--- +- debug: + msg: "START junos_ospfv2 reset config on connection={{ ansible_connection }}" + +- name: Reset configuration for ospf and routing-options + junos_config: + lines: + - delete protocols ospf + - delete routing-options +- debug: + msg: "END junos_ospfv2 reset config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/deleted.yaml new file mode 100644 index 00000000..a7285a12 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/deleted.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: "START junos_ospfv2 deleted integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + + - name: Delete an area + junos_ospfv2: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: deleted + register: result + + - debug: + var: result.after + + - debug: + var: config + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - set_fact: + config: [] + + - name: Delete all ospf config from the device + junos_ospfv2: + state: deleted + register: result + + - name: Assert changed + assert: *changed + + tags: deleted + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv2 deleted integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/merged.yaml new file mode 100644 index 00000000..9925e3c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/merged.yaml @@ -0,0 +1,57 @@ +--- +- debug: + msg: "START junos_ospfv2 merged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - areas: + - area_id: 0.0.0.100 + interfaces: + - metric: 5 + name: so-0/0/0.0 + priority: 3 + stub: + default_metric: 200 + set: true + router_id: 10.200.16.75 + + - name: Merge the provided configuration with the exisiting running configuration + junos_ospfv2: &merged + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_ospfv2: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv2 merged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/overridden.yaml new file mode 100644 index 00000000..c53de15c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/overridden.yaml @@ -0,0 +1,64 @@ +--- +- debug: + msg: "START junos_ospfv2 overridden integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + + - name: Override Junos OSPF config + junos_ospfv2: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: overridden + register: result + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Assert changed + assert: *changed + + tags: overridden + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv2 overridden integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/replaced.yaml new file mode 100644 index 00000000..d905a5be --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf/tests/netconf/replaced.yaml @@ -0,0 +1,41 @@ +--- +- debug: + msg: "START junos_ospfv2 replaced integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + + - name: Replace configuration + junos_ospfv2: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: replaced + register: result + + - name: Assert configuration + assert: + that: + - "{{ config|symmetric_difference(result.after) == [] }}" + + tags: replaced + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv2 replaced integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/defaults/main.yaml new file mode 100644 index 00000000..164afead --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/main.yaml new file mode 100644 index 00000000..cc27f174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: netconf.yaml, tags: ['netconf'] } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/netconf.yaml new file mode 100644 index 00000000..3eed8424 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_initial_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_initial_config.yaml new file mode 100644 index 00000000..b37c69f9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_initial_config.yaml @@ -0,0 +1,20 @@ +--- +- debug: + msg: "START junos_ospf_interfaces initial config on connection={{ ansible_connection }}" + +- name: Set initial configuration for ospf interfaces + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: merged + +- debug: + msg: "END junos_ospf_interfaces initial config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml new file mode 100644 index 00000000..9fdd1e17 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/_reset_config.yaml @@ -0,0 +1,11 @@ +--- +- debug: + msg: "START junos_ospfv3 reset config on connection={{ ansible_connection }}" + +- name: Reset configuration for ospf3 and routing-options + junos_config: + lines: + - delete protocols ospf + - delete routing-options +- debug: + msg: "END junos_ospfv3 reset config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/deleted.yaml new file mode 100644 index 00000000..d7edb19c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/deleted.yaml @@ -0,0 +1,69 @@ +--- +- debug: + msg: "START junos_ospf_interfaces deleted integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_config: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + name: 'ge-0/0/2.0' + router_id: '10.200.16.75' + - name: Merge the provided configuration with the exisiting running configuration + junipernetworks.junos.junos_ospf_interfaces: &merged + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/3.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.3' + priority: 3 + metric: 5 + state: merged + - name: Delete single ospf interface configuration + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: 10.200.16.75 + name: 'ge-0/0/3.0' + state: deleted + register: result + + - debug: + var: result.after + + - debug: + var: config + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ expected_config|symmetric_difference(result.after) == [] }}" + + - set_fact: + expected_config: [] + + - name: Delete all ospf config from the device + junipernetworks.junos.junos_ospf_interfaces: + state: deleted + register: result + + - name: Assert changed + assert: *changed + + tags: deleted + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospf_interfaces deleted integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/empty_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/empty_config.yaml new file mode 100644 index 00000000..4cfc023a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START junos_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 + junipernetworks.junos.junos_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 + junipernetworks.junos.junos_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 + junipernetworks.junos.junos_ospf_interfaces: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + junipernetworks.junos.junos_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/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..750b3d81 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,23 @@ + + + + + + + 0.0.0.2 + + 200 + + + ge-0/0/2.0 + 5 + 3 + + + + + + 10.200.16.75 + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/gathered.yaml new file mode 100644 index 00000000..00d04fb8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/gathered.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START junos_ospf_interfaces gathered integration tests on connection={{ + ansible_connection }} + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_gathered_output: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + name: 'ge-0/0/2.0' + router_id: '10.200.16.75' + + - name: Gather interfaces facts using gathered state + register: result + junipernetworks.junos.junos_ospf_interfaces: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_gathered_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _reset_config.yaml + +- debug: + msg: END junos_ospf_interfaces gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged.yaml new file mode 100644 index 00000000..91cf68d5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: "START junos_ospf_interfaces merged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + expected_config: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + name: 'ge-0/0/2.0' + router_id: '10.200.16.75' + + - name: Merge the provided configuration with the exisiting running configuration + junipernetworks.junos.junos_ospf_interfaces: &merged + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ expected_config | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_ospf_interfaces: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospf_interfaces merged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged_update.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged_update.yaml new file mode 100644 index 00000000..5ec2cd2c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/merged_update.yaml @@ -0,0 +1,67 @@ +--- +- debug: + msg: "START junos_ospf_interfaces merged update integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + + - set_fact: + expected_config: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + name: 'ge-0/0/2.0' + router_id: '10.200.16.75' + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.3' + priority: 3 + metric: 5 + name: 'ge-0/0/3.0' + router_id: '10.200.16.75' + + - name: Merge the provided configuration with the exisiting running configuration + junipernetworks.junos.junos_ospf_interfaces: &merged + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/3.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.3' + priority: 3 + metric: 5 + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ expected_config | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_ospf_interfaces: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged_update + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospf_interfaces merged update integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/overridden.yaml new file mode 100644 index 00000000..fd85b694 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/overridden.yaml @@ -0,0 +1,69 @@ +--- +- debug: + msg: "START junos_ospf_interfaces overridden integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_config: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 6 + metric: 7 + name: 'ge-0/0/1.0' + router_id: '10.200.16.75' + - name: Merge the provided configuration with the exisiting running configuration + junipernetworks.junos.junos_ospf_interfaces: &merged + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/3.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.3' + priority: 3 + metric: 5 + state: merged + - name: Override configuration + junipernetworks.junos.junos_ospf_interfaces: &overridden + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/1.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 6 + metric: 7 + state: overridden + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ expected_config | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Override the provided configuration with the existing running configuration (IDEMPOTENT) + junos_ospf_interfaces: *overridden + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: overridden + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospf_interfaces overridden integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/parsed.yaml new file mode 100644 index 00000000..e82d6fe7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/parsed.yaml @@ -0,0 +1,31 @@ +--- +- debug: + msg: START junos_ospf_interfaces parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + metric: 5 + priority: 3 + name: 'ge-0/0/2.0' + router_id: '10.200.16.75' + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_ospf_interfaces: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_ospf_interfaces parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/rendered.yaml new file mode 100644 index 00000000..bd1b563c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/rendered.yaml @@ -0,0 +1,31 @@ +--- +- debug: + msg: START junos_ospf_interfaces rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "0.0.0.2ge-0/0/2.035" + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.2' + priority: 3 + metric: 5 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_ospf_interfaces rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/replaced.yaml new file mode 100644 index 00000000..cf2f65df --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospf_interfaces/tests/netconf/replaced.yaml @@ -0,0 +1,46 @@ +--- +- debug: + msg: "START junos_ospf_interfaces replaced integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_config: + - address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 6 + metric: 7 + name: 'ge-0/0/2.0' + router_id: '10.200.16.75' + + - name: Replace configuration + junipernetworks.junos.junos_ospf_interfaces: + config: + - router_id: '10.200.16.75' + name: 'ge-0/0/2.0' + address_family: + - afi: 'ipv4' + processes: + area: + area_id: '0.0.0.1' + priority: 6 + metric: 7 + state: replaced + register: result + + - name: Assert configuration + assert: + that: + - "{{ expected_config|symmetric_difference(result.after) == [] }}" + + tags: replaced + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospf_interfaces replaced integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/defaults/main.yaml new file mode 100644 index 00000000..164afead --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "[^_].*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/meta/main.yaml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/meta/main.yaml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/main.yaml new file mode 100644 index 00000000..cc27f174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- { include: netconf.yaml, tags: ['netconf'] } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/netconf.yaml new file mode 100644 index 00000000..3eed8424 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_initial_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_initial_config.yaml new file mode 100644 index 00000000..92918c73 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_initial_config.yaml @@ -0,0 +1,18 @@ +--- +- debug: + msg: "START junos_ospfv3 initial config on connection={{ ansible_connection }}" + +- name: Set initial configuration for ospf + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + +- debug: + msg: "END junos_ospfv3 initial config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_reset_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_reset_config.yaml new file mode 100644 index 00000000..864925cd --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/_reset_config.yaml @@ -0,0 +1,11 @@ +--- +- debug: + msg: "START junos_ospfv3 reset config on connection={{ ansible_connection }}" + +- name: Reset configuration for ospf3 and routing-options + junos_config: + lines: + - delete protocols ospf3 + - delete routing-options +- debug: + msg: "END junos_ospfv3 reset config on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/deleted.yaml new file mode 100644 index 00000000..250cedb4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/deleted.yaml @@ -0,0 +1,56 @@ +--- +- debug: + msg: "START junos_ospfv3 deleted integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + + - name: Delete an area + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: deleted + register: result + + - debug: + var: result.after + + - debug: + var: config + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - set_fact: + config: [] + + - name: Delete all ospf config from the device + junipernetworks.junos.junos_ospfv3: + state: deleted + register: result + + - name: Assert changed + assert: *changed + + tags: deleted + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv3 deleted integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/empty_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/empty_config.yaml new file mode 100644 index 00000000..1e96a301 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/empty_config.yaml @@ -0,0 +1,49 @@ +--- +- debug: + msg: START junos_ospfv3 empty_config integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + junipernetworks.junos.junos_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 + junipernetworks.junos.junos_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 + junipernetworks.junos.junos_ospfv3: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + junipernetworks.junos.junos_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/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/fixtures/parsed.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/fixtures/parsed.cfg new file mode 100644 index 00000000..cf355a9a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/fixtures/parsed.cfg @@ -0,0 +1,35 @@ + + + + + + + 0.0.0.100 + + 200 + + + so-0/0/0.0 + + 5 + 3 + + + + + 0.0.0.200 + + ge-1/1/0.0 + + + ge-2/2/0.0 + + + + + + 10.200.16.75 + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/gathered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/gathered.yaml new file mode 100644 index 00000000..932ac994 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/gathered.yaml @@ -0,0 +1,37 @@ +--- +- debug: + msg: START junos_ospfv3 gathered integration tests on connection={{ + ansible_connection }} + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + expected_gathered_output: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + + - name: Gather interfaces facts using gathered state + register: result + junipernetworks.junos.junos_ospfv3: + state: gathered + + - name: Assert that facts were correctly generated + assert: + that: "{{ expected_gathered_output | symmetric_difference(result['gathered']) |length\ + \ == 0 }}" + + always: + + - include_tasks: _reset_config.yaml + +- debug: + msg: END junos_ospfv3 gathered integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/merged.yaml new file mode 100644 index 00000000..6e579144 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/merged.yaml @@ -0,0 +1,57 @@ +--- +- debug: + msg: "START junos_ospfv3 merged integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - metric: 5 + name: so-0/0/0.0 + priority: 3 + stub: + default_metric: 200 + set: true + + - name: Merge the provided configuration with the exisiting running configuration + junipernetworks.junos.junos_ospfv3: &merged + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + state: merged + register: result + + - name: Assert the configuration is reflected on host + assert: + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) + junos_ospfv3: *merged + register: result + + - name: Assert that the previous task was idempotent + assert: + that: + - result.changed == False + + tags: merged + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv3 merged integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/overridden.yaml new file mode 100644 index 00000000..c795fe05 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/overridden.yaml @@ -0,0 +1,64 @@ +--- +- debug: + msg: "START junos_ospfv3 overridden integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + + - name: Override Junos OSPF config + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: overridden + register: result + + - name: Assert changed + assert: &changed + that: + - result.changed == True + - "{{ config|symmetric_difference(result.after) == [] }}" + + - name: Assert changed + assert: *changed + + tags: overridden + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv3 overridden integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/parsed.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/parsed.yaml new file mode 100644 index 00000000..b62ddaa5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/parsed.yaml @@ -0,0 +1,39 @@ +--- +- debug: + msg: START junos_ospfv3 parsed integration tests on connection={{ ansible_connection + }} + +- set_fact: + expected_parsed_output: + + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + +- name: Parse externally provided interfaces config to agnostic model + register: result + junipernetworks.junos.junos_ospfv3: + running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" + state: parsed + +- name: Assert that config was correctly parsed + assert: + that: + - "{{ expected_parsed_output | symmetric_difference(result['parsed']) |length ==\ + \ 0 }}" +- debug: + msg: END junos_ospfv3 parsed integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/rendered.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/rendered.yaml new file mode 100644 index 00000000..4f07ff5c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/rendered.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START junos_ospfv3 rendered integration tests on connection={{ + ansible_connection }} + +- set_fact: + expected_rendered_output: "0.0.0.100so-0/0/0.0352000.0.0.200ge-1/1/0.0ge-2/2/0.0" + +- name: Render platform specific commands from task input using rendered state + register: result + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + stub: + default_metric: 200 + set: true + interfaces: + - name: so-0/0/0.0 + priority: 3 + metric: 5 + flood_reduction: true + passive: true + - area_id: 0.0.0.200 + interfaces: + - name: ge-1/1/0.0 + - name: ge-2/2/0.0 + state: rendered + +- name: Assert that correct set of commands were rendered + assert: + that: + - "{{ expected_rendered_output == result['rendered'] }}" + +- debug: + msg: END junos_ospfv3 rendered integration tests on connection={{ + ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/replaced.yaml new file mode 100644 index 00000000..c07a09e1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_ospfv3/tests/netconf/replaced.yaml @@ -0,0 +1,41 @@ +--- +- debug: + msg: "START junos_ospfv3 replaced integration tests on connection={{ ansible_connection }}" + +- block: + - include_tasks: _reset_config.yaml + - include_tasks: _initial_config.yaml + + - set_fact: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.200 + interfaces: + - name: ge-2/2/0.0 + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + + - name: Replace configuration + junipernetworks.junos.junos_ospfv3: + config: + - router_id: 10.200.16.75 + areas: + - area_id: 0.0.0.100 + interfaces: + - name: so-0/0/0.0 + state: replaced + register: result + + - name: Assert configuration + assert: + that: + - "{{ config|symmetric_difference(result.after) == [] }}" + + tags: replaced + always: + - include_tasks: _reset_config.yaml + +- debug: + msg: "END junos_ospfv3 replaced integration tests on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/netconf.yaml new file mode 100644 index 00000000..e7950174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tests/netconf/rpc.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tests/netconf/rpc.yaml new file mode 100644 index 00000000..cd4068c2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_rpc/tests/netconf/rpc.yaml @@ -0,0 +1,74 @@ +--- +- debug: msg="START netconf/rpc.yaml on connection={{ ansible_connection }}" + +- name: Execute RPC on device + register: result + junipernetworks.junos.junos_rpc: + rpc: get-interface-information + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - "'\nlo0\n' in result['xml']" + - "'\nem0\n' not in result['xml']" + - "'\fxp0\n' not in result['xml']" + +- name: Execute RPC on device and get output in text format + register: result + junipernetworks.junos.junos_rpc: + rpc: get-interface-information + output: text + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.output is defined + - result.output_lines is defined + - "'Physical interface' in result['output']" + +- name: Execute RPC on device and get output in json format + register: result + junipernetworks.junos.junos_rpc: + rpc: get-interface-information + output: json + args: + interface-name: lo0 + media: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + - result.output is defined + - result['output']['interface-information'][0]['physical-interface'][0]['name'][0]['data'] + == "lo0" + +- name: Execute invalid RPC + register: result + ignore_errors: true + junipernetworks.junos.junos_rpc: + rpc: show-interface-information + provider: '{{ netconf }}' + +- assert: + that: + - result.failed == true + +- debug: msg="END netconf/rpc.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/defaults/main.yaml new file mode 100644 index 00000000..9ef5ba51 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: "*" +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/cli.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/cli.yaml new file mode 100644 index 00000000..b120a3fe --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/cli.yaml @@ -0,0 +1,16 @@ +--- +- name: collect cli test cases + find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/main.yaml new file mode 100644 index 00000000..cfecd923 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/main.yaml @@ -0,0 +1,3 @@ +--- +- { include: cli.yaml, tags: ['network_cli'] } +- { include: netconf.yaml, tags: ['netconf'] } diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/netconf.yaml new file mode 100644 index 00000000..59ef55ad --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tasks/netconf.yaml @@ -0,0 +1,22 @@ +--- +- name: collect netconf test cases + find: + paths: "{{ role_path }}/tests/netconf" + patterns: "{{ testcase }}.yaml" + connection: local + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test case (connection=netconf) + include: "{{ test_case_to_run }} ansible_connection=netconf" + with_items: "{{ test_items }}" + loop_control: + loop_var: test_case_to_run + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/cli/reboot.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/cli/reboot.yaml new file mode 100644 index 00000000..5313446f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/cli/reboot.yaml @@ -0,0 +1,21 @@ +--- +- debug: + msg: START cli/cli_reboot.yaml on connection={{ ansible_connection }} +- block: + + - ansible.netcommon.cli_command: + command: request system reboot + prompt: + - Reboot the system? + answer: + - y + + - wait_for_connection: + delay: 30 + sleep: 20 + + - ansible.netcommon.cli_command: + command: show version + when: ansible_connection == 'ansible.netcommon.network_cli' + +- debug: msg="END cli/reboot.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/common_utils.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/common_utils.yaml new file mode 100644 index 00000000..2306f276 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/common_utils.yaml @@ -0,0 +1,56 @@ +--- +# junos interface -> remove_default_spec() conditional() +- debug: msg="START junos_interface netconf/common_utils.yaml on connection={{ ansible_connection }}" + +- name: get facts + junos_facts: + provider: "{{ netconf }}" + register: result + + +- name: Define interface name for vSRX + set_fact: + intf_name: pp0 + when: result['ansible_facts']['ansible_net_model'] is search("vSRX*") + +- name: Define interface name for vsrx + set_fact: + intf_name: pp0 + when: result['ansible_facts']['ansible_net_model'] is search("vsrx") + +- name: Define interface name for vQFX + set_fact: + intf_name: gr-0/0/0 + when: result['ansible_facts']['ansible_net_model'] is search("vqfx*") + +- name: Check intent arguments + junos_interface: + name: "{{ intf_name }}" + state: up + tx_rate: ge(0) + rx_rate: le(0) + provider: "{{ netconf }}" + register: result + +- assert: + that: + - "result.failed == false" + +- name: Check intent arguments (failed condition) + junos_interface: + name: "{{ intf_name }}" + state: down + tx_rate: gt(0) + rx_rate: lt(0) + provider: "{{ netconf }}" + 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 junos_interface netconf/common_utils.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/module_utils_junos.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/module_utils_junos.yaml new file mode 100644 index 00000000..efafc4ea --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_smoke/tests/netconf/module_utils_junos.yaml @@ -0,0 +1,99 @@ +--- +- debug: msg="START netconf/module_utils_junos.yaml on connection={{ ansible_connection }}" + +# hit get_capabilities() + +- name: get output for single command + junos_command: + commands: ['show version'] + format: json + provider: "{{ netconf }}" + register: result + +- assert: + that: + - "result.changed == false" + - "result.stdout is defined" + - "result.stdout_lines is defined" + +# hit commit_configuration() +- name: setup - remove login banner + junos_banner: + banner: login + state: absent + provider: "{{ netconf }}" + +- name: Create login banner + junos_banner: + banner: login + text: this is my login banner + state: present + provider: "{{ netconf }}" + register: result + +- name: Get running configuration + junos_rpc: + rpc: get-configuration + provider: "{{ netconf }}" + register: config + +- assert: + that: + - "result.changed == true" + - "'this is my login banner' in config.xml" + +# hit discard_changes() +- name: check mode + junos_banner: + banner: login + text: this is not the banner you're looking for + state: present + provider: "{{ netconf }}" + register: result + check_mode: true + +- assert: + that: + - "result.changed == true" + - "result.failed == false" + + +# hit field_top in map_obj_to_ele +- name: setup - remove interface address + net_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: "{{ netconf }}" + +- name: Configure interface address using platform agnostic module + net_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: present + provider: "{{ netconf }}" + register: result + +- name: Get running configuration + junos_rpc: + rpc: get-configuration + provider: "{{ netconf }}" + register: config + +- assert: + that: + - "result.changed == true" + - "'192.0.2.1/32' in config.xml" + - "'fd5d:12c9:2201:1::1/128' in config.xml" + - result.diff.prepared is search("\+ *address 192.0.2.1/32") + - result.diff.prepared is search("\+ *address fd5d:12c9:2201:1::1/128") + +- name: teardown - remove interface address + net_l3_interface: + name: ge-0/0/1 + ipv4: 192.0.2.1 + ipv6: fd5d:12c9:2201:1::1 + state: absent + provider: "{{ netconf }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tasks/netconf.yaml new file mode 100644 index 00000000..c5806ab5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/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 + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/basic.yaml new file mode 100644 index 00000000..3dea474e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/basic.yaml @@ -0,0 +1,285 @@ +--- +- debug: msg="START junos_static_route netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove static route + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + state: absent + provider: '{{ netconf }}' + +- name: Confgiure static route + register: result + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'1.1.1.0/24' in config.xml" + - "'3.3.3.3' in config.xml" + - "'' in config.xml" + - "'5.5.5.5' in config.xml" + - "'30' in config.xml" + - "'10' in config.xml" + +- name: Confgiure static route (idempotent) + register: result + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate static route + register: result + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + + - "'inactive: route 1.1.1.0/24' in result.diff.prepared" + +- name: Activate static route + register: result + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'1.1.1.0/24' in config.xml" + - "'3.3.3.3' in config.xml" + - "'' in config.xml" + - "'5.5.5.5' in config.xml" + - "'30' in config.xml" + - "'10' in config.xml" + + - "'inactive: route 1.1.1.0/24' not in result.diff" + +- name: Delete static route + register: result + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: absent + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'1.1.1.0/24' not in config.xml" + +- name: Delete static route (idempotent) + register: result + junipernetworks.junos.junos_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: absent + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Setup static route for aggegrate + junipernetworks.junos.junos_static_route: + aggregate: + + - address: 4.4.4.0/24 + + - address: 5.5.5.0/24 + state: absent + provider: '{{ netconf }}' + +- name: Confgiure static route using aggegrate + register: result + junipernetworks.junos.junos_static_route: + aggregate: + + - address: 4.4.4.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + + - address: 5.5.5.0/24 + next_hop: 6.6.6.6 + preference: 11 + qualified_next_hop: 7.7.7.7 + qualified_preference: 30 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *route 4.4.4.0/24") + - result.diff.prepared is search("\+ *next-hop 3.3.3.3") + - result.diff.prepared is search("\+ *qualified-next-hop 5.5.5.5") + - result.diff.prepared is search("\+ *preference 30") + - result.diff.prepared is search("\+ *preference 10") + - result.diff.prepared is search("\+ *route 5.5.5.0/24") + - result.diff.prepared is search("\+ *next-hop 6.6.6.6") + - result.diff.prepared is search("\+ *qualified-next-hop 7.7.7.7") + - result.diff.prepared is search("\+ *preference 30") + - result.diff.prepared is search("\+ *preference 11") + +- name: Deactivate static route configuration using aggegrate + register: result + junipernetworks.junos.junos_static_route: + aggregate: + + - address: 4.4.4.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + + - address: 5.5.5.0/24 + next_hop: 6.6.6.6 + preference: 11 + qualified_next_hop: 7.7.7.7 + qualified_preference: 30 + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] route 4.4.4.0/24") + - result.diff.prepared is search("! *inactive[:] qualified-next-hop 5.5.5.5") + - result.diff.prepared is search("! *inactive[:] preference") + - result.diff.prepared is search("! *inactive[:] route 5.5.5.0/24") + - result.diff.prepared is search("! *inactive[:] qualified-next-hop 7.7.7.7") + - result.diff.prepared is search("! *inactive[:] preference") + +- name: Activate static route configuration using aggegrate + register: result + junipernetworks.junos.junos_static_route: + aggregate: + + - address: 4.4.4.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + + - address: 5.5.5.0/24 + next_hop: 6.6.6.6 + preference: 11 + qualified_next_hop: 7.7.7.7 + qualified_preference: 30 + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] route 4.4.4.0/24") + - result.diff.prepared is search("! *active[:] qualified-next-hop 5.5.5.5") + - result.diff.prepared is search("! *active[:] preference") + - result.diff.prepared is search("! *active[:] route 5.5.5.0/24") + - result.diff.prepared is search("! *active[:] qualified-next-hop 7.7.7.7") + - result.diff.prepared is search("! *active[:] preference") + +- name: Delete static route configuration using aggegrate + register: result + junipernetworks.junos.junos_static_route: + aggregate: + + - address: 4.4.4.0/24 + + - address: 5.5.5.0/24 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *route 4.4.4.0/24") + - result.diff.prepared is search("\- *next-hop 3.3.3.3") + - result.diff.prepared is search("\- *qualified-next-hop 5.5.5.5") + - result.diff.prepared is search("\- *preference 30") + - result.diff.prepared is search("\- *preference 10") + - result.diff.prepared is search("\- *route 5.5.5.0/24") + - result.diff.prepared is search("\- *next-hop 6.6.6.6") + - result.diff.prepared is search("\- *qualified-next-hop 7.7.7.7") + - result.diff.prepared is search("\- *preference 30") + - result.diff.prepared is search("\- *preference 11") + +- name: Delete static route configuration using aggegrate (idempotent) + register: result + junipernetworks.junos.junos_static_route: + aggregate: + + - address: 4.4.4.0/24 + + - address: 5.5.5.0/24 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_static_route netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/net_static_route.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/net_static_route.yaml new file mode 100644 index 00000000..bd0fda69 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_route/tests/netconf/net_static_route.yaml @@ -0,0 +1,45 @@ +--- +- debug: msg="START junos netconf/net_static_route.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove static route + ansible.netcommon.net_static_route: + address: 1.1.1.0/24 + state: absent + provider: '{{ netconf }}' + +- name: Confgiure static route using platform agnostic module + register: result + ansible.netcommon.net_static_route: + address: 1.1.1.0/24 + next_hop: 3.3.3.3 + preference: 10 + qualified_next_hop: 5.5.5.5 + qualified_preference: 30 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'1.1.1.0/24' in config.xml" + - "'3.3.3.3' in config.xml" + - "'' in config.xml" + - "'5.5.5.5' in config.xml" + - "'30' in config.xml" + - "'10' in config.xml" + +- name: setup - remove static route + ansible.netcommon.net_static_route: + address: 1.1.1.0/24 + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_static_route.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/meta/main.yaml new file mode 100644 index 00000000..7f867d73 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_base_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_base_config.yaml new file mode 100644 index 00000000..5e18d693 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_base_config.yaml @@ -0,0 +1,30 @@ +--- +- debug: + msg: Start junos_static_routes base config ansible_connection={{ ansible_connection + }} + +- name: Configure base static_routes + junipernetworks.junos.junos_static_routes: + config: + + - address_families: + + - afi: ipv4 + routes: + + - dest: 192.168.0.0/24 + next_hop: + + - forward_router_address: 192.168.0.1 + + - afi: ipv6 + routes: + + - dest: 2001:db8::5/128 + next_hop: + + - forward_router_address: 2001:db8:0:1:2a0:a502:0:19da + +- debug: + msg: End junos_static_routes base config ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..4d50dc98 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/_remove_config.yaml @@ -0,0 +1,19 @@ +--- +- debug: + msg: Start junos_static_routes teardown ansible_connection={{ ansible_connection + }} + +- name: Remove static route config + junipernetworks.junos.junos_static_routes: + config: + + - address_families: + + - afi: ipv4 + + - afi: ipv6 + state: deleted + +- debug: + msg: End junos_static_routes teardown ansible_connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/deleted.yaml new file mode 100644 index 00000000..61911208 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/deleted.yaml @@ -0,0 +1,45 @@ +--- +- debug: + msg: START junos_static_routes deleted integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- block: + + - name: Delete the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_static_routes: &id001 + config: + + - address_families: + + - afi: ipv4 + + - afi: ipv6 + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - not result.after + debugger: on_failed + + - name: Delete the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_static_routes: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_static_routes deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/merged.yaml new file mode 100644 index 00000000..69aa5a12 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/merged.yaml @@ -0,0 +1,99 @@ +--- +- debug: + msg: START junos_static_routes merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_merged_output: + + - address_families: + + - afi: ipv6 + routes: + + - dest: 2001:db8::5/128 + next_hop: + + - forward_router_address: 2001:db8:0:1:2a0:a502:0:19da + + - dest: ::/0 + next_hop: + + - forward_router_address: 2001:db8:0:1:2a0:a502:0:19da + + - afi: ipv4 + routes: + + - dest: 192.168.0.0/24 + next_hop: + + - forward_router_address: 192.168.0.1 + + - dest: 192.168.1.0/24 + metric: 2 + next_hop: + + - forward_router_address: 192.168.1.1 + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_static_routes: &id001 + config: + + - address_families: + + - afi: ipv4 + routes: + + - dest: 192.168.0.0/24 + next_hop: + + - forward_router_address: 192.168.0.1 + + - dest: 192.168.1.0/24 + next_hop: + + - forward_router_address: 192.168.1.1 + metric: 2 + + - afi: ipv6 + routes: + + - dest: 2001:db8::5/128 + next_hop: + + - forward_router_address: 2001:db8:0:1:2a0:a502:0:19da + + - dest: ::/0 + next_hop: + + - forward_router_address: 2001:db8:0:1:2a0:a502:0:19da + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + debugger: on_failed + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_static_routes: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_static_routes merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/overridden.yaml new file mode 100644 index 00000000..e4b720fd --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/overridden.yaml @@ -0,0 +1,65 @@ +--- +- debug: + msg: START junos_static_routes overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_overridden_output: + + - address_families: + + - afi: ipv4 + routes: + + - dest: 192.168.20.0/24 + next_hop: + + - forward_router_address: 192.168.20.1 + metric: 10 + +- block: + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_static_routes: &id001 + config: + + - address_families: + + - afi: ipv4 + routes: + + - dest: 192.168.20.0/24 + next_hop: + + - forward_router_address: 192.168.20.1 + metric: 10 + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + debugger: on_failed + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_static_routes: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_static_routes overridden integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/replaced.yaml new file mode 100644 index 00000000..d302b06e --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_static_routes/tests/netconf/replaced.yaml @@ -0,0 +1,71 @@ +--- +- debug: + msg: START junos_static_routes overridden integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_overridden_output: + + - address_families: + + - afi: ipv6 + routes: + + - dest: 2001:db8::5/128 + next_hop: + + - forward_router_address: 2001:db8:0:1:2a0:a502:0:19da + + - afi: ipv4 + routes: + + - dest: 192.168.0.0/24 + next_hop: + + - forward_router_address: 192.168.20.1 + +- block: + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_static_routes: &id001 + config: + + - address_families: + + - afi: ipv4 + routes: + + - dest: 192.168.0.0/24 + next_hop: + + - forward_router_address: 192.168.20.1 + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + debugger: on_failed + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_static_routes: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_static_routes overridden integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/aliases b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/aliases new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tasks/netconf.yaml new file mode 100644 index 00000000..c5806ab5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/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 + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/basic.yaml new file mode 100644 index 00000000..3335ee32 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/basic.yaml @@ -0,0 +1,409 @@ +--- +- debug: msg="START junos_system netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove hostname + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: absent + provider: '{{ netconf }}' + +- name: Set hostname + register: result + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'vsrx01' in config.xml" + +- name: Set hostname (idempotent) + register: result + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate hostname configuration + register: result + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + +- name: Activate hostname configuration + register: result + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'vsrx01' in config.xml" + +- name: Delete hostname configuration + register: result + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'vsrx01' in config.xml" + +- name: Teardown - set hostname + junipernetworks.junos.junos_system: + hostname: vsrx01 + state: present + provider: '{{ netconf }}' + +- name: setup - remove domain name + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: absent + provider: '{{ netconf }}' + +- name: Set domain name + register: result + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ansible.com' in config.xml" + +- name: Set domain name (idempotent) + register: result + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate domain name + register: result + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + +- name: Activate domain name + register: result + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ansible.com' in config.xml" + +- name: Delete domain name + register: result + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'ansible.com' not in config.xml" + +- name: Teardown - set domain name + junipernetworks.junos.junos_system: + domain_name: ansible.com + state: present + provider: '{{ netconf }}' + +- name: Setup - delete domain search + register: result + junipernetworks.junos.junos_system: + domain_search: + - test.com + - sample.com + state: absent + provider: '{{ netconf }}' + +- name: Set domain search + register: result + junipernetworks.junos.junos_system: + domain_search: + - test.com + - sample.com + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test.com' in config.xml" + - "'sample.com' in config.xml" + +- name: Set domain search (idempotency) + register: result + junipernetworks.junos.junos_system: + domain_search: + - test.com + - sample.com + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate domain search + register: result + junipernetworks.junos.junos_system: + domain_search: + - test.com + - sample.com + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test.com' in config.xml" + - "'sample.com' in config.xml" + +- name: Activate domain search + register: result + junipernetworks.junos.junos_system: + domain_search: + - test.com + - sample.com + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test.com' in config.xml" + - "'sample.com' in config.xml" + +- name: Delete domain search + register: result + junipernetworks.junos.junos_system: + domain_search: + - test.com + - sample.com + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test.com' not in config.xml" + - "'sample.com' not in config.xml" + +- name: Setup - delete name servers + register: result + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + state: absent + provider: '{{ netconf }}' + +- name: Set name servers + register: result + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'8.8.8.8' in config.xml" + - "'8.8.4.4' in config.xml" + +- name: Set name servers (idempotent) + register: result + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate name servers + register: result + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + +- name: Activate name servers + register: result + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'8.8.8.8' in config.xml" + - "'8.8.4.4' in config.xml" + +- name: Delete name servers + register: result + junipernetworks.junos.junos_system: + name_servers: + - 8.8.8.8 + - 8.8.4.4 + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'8.8.8.8' not in config.xml" + - "'8.8.4.4' not in config.xml" + +- debug: msg="END junos_system netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/net_system.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/net_system.yaml new file mode 100644 index 00000000..2e10b692 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_system/tests/netconf/net_system.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START junos netconf/net_system.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove hostname + ansible.netcommon.net_system: + hostname: vsrx01 + state: absent + provider: '{{ netconf }}' + +- name: Set hostname using platform agnostic module + register: result + ansible.netcommon.net_system: + hostname: vsrx01 + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'vsrx01' in config.xml" + +- name: teardown - remove hostname + ansible.netcommon.net_system: + hostname: vsrx01 + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_system.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/defaults/main.yaml new file mode 100644 index 00000000..55ad5760 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_cases: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/netconf.yaml new file mode 100644 index 00000000..e7950174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/basic.yaml new file mode 100644 index 00000000..e417ebbb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/basic.yaml @@ -0,0 +1,225 @@ +--- +- debug: msg="START junos_user netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove user + junipernetworks.junos.junos_user: + name: test_user + state: absent + provider: '{{ netconf }}' + +- name: Create user + register: result + junipernetworks.junos.junos_user: + name: test_user + state: present + full_name: test_user + role: operator + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_user' in config.xml" + - "'test_user' in config.xml" + - "'operator' in config.xml" + +- name: Create user again (idempotent) + register: result + junipernetworks.junos.junos_user: + name: test_user + state: present + full_name: test_user + role: operator + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate user + register: result + junipernetworks.junos.junos_user: + name: test_user + state: present + full_name: test_user + role: operator + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + - "'test_user' in config.xml" + +- name: Activate user + register: result + junipernetworks.junos.junos_user: + name: test_user + state: present + full_name: test_user + role: operator + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_user' in config.xml" + - "'test_user' in config.xml" + - "'operator' in config.xml" + +- name: Delete user + register: result + junipernetworks.junos.junos_user: + name: test_user + state: absent + full_name: test_user + role: operator + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_user' not in config.xml" + - "'test_user' not in config.xml" + +- name: Delete user again (idempotent check) + register: result + junipernetworks.junos.junos_user: + name: test_user + state: absent + full_name: test_user + role: operator + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Teardown list of users + register: result + junipernetworks.junos.junos_user: + aggregate: + + - name: test_user1 + state: absent + + - name: test_user2 + state: absent + provider: '{{ netconf }}' + +- name: Create list of users + register: result + junipernetworks.junos.junos_user: + aggregate: + + - name: test_user1 + full_name: test_user2 + role: operator + state: present + + - name: test_user2 + full_name: test_user2 + role: read-only + state: present + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_user1' in config.xml" + - "'test_user2' in config.xml" + +- name: Delete list of users + register: result + junipernetworks.junos.junos_user: + aggregate: + + - name: test_user1 + full_name: test_user2 + role: operator + state: absent + + - name: test_user2 + full_name: test_user2 + role: read-only + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_user1' not in config.xml" + - "'test_user2' not in config.xml" + +- name: Create list of users + register: result + junipernetworks.junos.junos_user: + aggregate: + + - name: "{{ ansible_user|default('ansible') }}" + + - name: test_user1 + full_name: test_user2 + role: operator + + - name: test_user2 + full_name: test_user2 + role: read-only + provider: '{{ netconf }}' + +- name: Purge users except the users in aggregate + register: result + junipernetworks.junos.junos_user: + aggregate: + + - name: "{{ ansible_user|default('ansible') }}" + purge: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *user test_user1") + - result.diff.prepared is search("\- *user test_user2") + +- debug: msg="END junos_user netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/net_user.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/net_user.yaml new file mode 100644 index 00000000..e3fa3d87 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_user/tests/netconf/net_user.yaml @@ -0,0 +1,40 @@ +--- +- debug: msg="START junos netconf/net_user.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove user + ansible.netcommon.net_user: + name: test_user + state: absent + provider: '{{ netconf }}' + +- name: Create user with platform agnostic module + register: result + ansible.netcommon.net_user: + name: test_user + state: present + full_name: test_user + role: operator + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test_user' in config.xml" + - "'test_user' in config.xml" + - "'operator' in config.xml" + +- name: teardown - remove user + ansible.netcommon.net_user: + name: test_user + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_user.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/netconf.yaml new file mode 100644 index 00000000..e7950174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/basic.yaml new file mode 100644 index 00000000..be7dcb62 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/basic.yaml @@ -0,0 +1,213 @@ +--- +- debug: msg="START junos_vlan netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove vlan + junipernetworks.junos.junos_vlan: + name: test-vlan + description: test vlan + state: absent + provider: '{{ netconf }}' + +- name: Create vlan + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: test-vlan + state: present + description: test vlan + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test-vlan' in config.xml" + - "'100' in config.xml" + +- name: Create vlan again (idempotent) + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: test-vlan + state: present + description: test vlan + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Deactivate vlan + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: test-vlan + state: present + active: false + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'' in config.xml" + - "'test-vlan' in config.xml" + +- name: Activate vlan + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: test-vlan + state: present + active: true + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test-vlan' in config.xml" + +- name: Delete vlan + register: result + junipernetworks.junos.junos_vlan: + vlan_id: 100 + name: test-vlan + state: absent + provider: '{{ netconf }}' + +- name: Get running configuration + register: config + junipernetworks.junos.junos_rpc: + rpc: get-configuration + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'test-vlan' not in config.xml" + +- name: Setup vlan configuration for aggregate + junipernetworks.junos.junos_vlan: + aggregate: + + - vlan_id: 159 + name: test_vlan_1 + + - vlan_id: 160 + name: test_vlan_2 + state: absent + provider: '{{ netconf }}' + +- name: Create vlan configuration using aggregate + register: result + junipernetworks.junos.junos_vlan: + aggregate: + + - vlan_id: 159 + name: test_vlan_1 + + - vlan_id: 161 + name: test_vlan_2 + description: test vlan + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *test_vlan_1") + - result.diff.prepared is search("\+ *vlan-id 159") + - result.diff.prepared is search("\+ *vlan-id 161") + - result.diff.prepared is search("\+ *description \"test vlan\"") + +- name: Deactivate vlan configuration using aggregate + register: result + junipernetworks.junos.junos_vlan: + aggregate: + + - vlan_id: 159 + name: test_vlan_1 + description: test vlan-1 + + - name: test_vlan_2 + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *inactive[:] test_vlan_1") + - result.diff.prepared is search("! *inactive[:] test_vlan_2") + +- name: activate vlan configuration using aggregate + register: result + junipernetworks.junos.junos_vlan: + aggregate: + + - vlan_id: 159 + name: test_vlan_1 + description: test vlan-1 + + - name: test_vlan_2 + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("! *active[:] test_vlan_1") + - result.diff.prepared is search("! *active[:] test_vlan_2") + +- name: Delete vlan configuration using aggregate + register: result + junipernetworks.junos.junos_vlan: + aggregate: + + - vlan_id: 159 + name: test_vlan_1 + + - name: test_vlan_2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *test_vlan_1") + - result.diff.prepared is search("\- *vlan-id 159") + - result.diff.prepared is search("\- *test_vlan_2") + +- name: Delete vlan configuration using aggregate (idempotent) + register: result + junipernetworks.junos.junos_vlan: + aggregate: + + - vlan_id: 159 + name: test_vlan_1 + + - name: test_vlan_2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_vlan netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/net_vlan.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/net_vlan.yaml new file mode 100644 index 00000000..be0eaa06 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlan/tests/netconf/net_vlan.yaml @@ -0,0 +1,29 @@ +--- +- debug: msg="START junos netconf/net_vlan.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove vlan + ansible.netcommon.net_vlan: + name: test-vlan + description: test vlan + state: absent + provider: '{{ netconf }}' + +- name: Create vlan using platform agnostic vlan module + register: result + ansible.netcommon.net_vlan: + vlan_id: 100 + name: test-vlan + state: present + description: test vlan + provider: '{{ netconf }}' + +- name: teardown - remove vlan + ansible.netcommon.net_vlan: + name: test-vlan + description: test vlan + state: absent + provider: '{{ netconf }}' + +- debug: msg="END junos netconf/net_vlan.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/meta/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/meta/main.yaml new file mode 100644 index 00000000..7f867d73 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/main.yaml new file mode 100644 index 00000000..0552e353 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: netconf.yaml + tags: + - netconf diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/netconf.yaml new file mode 100644 index 00000000..cc36c8ca --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tasks/netconf.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + use_regex: true + connection: local + register: test_cases + +- 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 diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_base_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_base_config.yaml new file mode 100644 index 00000000..dfe9fc84 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_base_config.yaml @@ -0,0 +1,13 @@ +--- +- debug: + msg: Start junos_vlans base config ansible_connection={{ ansible_connection + }} + +- name: Configure base vlans + junipernetworks.junos.junos_config: + lines: + - set vlans vlan1 vlan-id 1 + - set vlans vlan2 vlan-id 2 + +- debug: + msg: End junos_vlans base config ansible_connection={{ ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_remove_config.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_remove_config.yaml new file mode 100644 index 00000000..960027c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/_remove_config.yaml @@ -0,0 +1,12 @@ +--- +- debug: + msg: Start junos_vlans teardown ansible_connection={{ ansible_connection }} + +- name: Remove interface config + junipernetworks.junos.junos_config: + lines: + - delete vlan vlan1 + - delete vlan vlan2 + +- debug: + msg: End junos_vlans teardown ansible_connection={{ ansible_connection }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/deleted.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/deleted.yaml new file mode 100644 index 00000000..ef411d2b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/deleted.yaml @@ -0,0 +1,38 @@ +--- +- debug: + msg: START junos_vlans deleted integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- block: + + - name: Delete the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_vlans: &id001 + config: + state: deleted + + - name: Assert the configuration is reflected on host + assert: + that: + - not result.after + + - name: Delete the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_vlans: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_vlans deleted integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/merged.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/merged.yaml new file mode 100644 index 00000000..05e0bba4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/merged.yaml @@ -0,0 +1,52 @@ +--- +- debug: + msg: START junos_vlans merged integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- set_fact: + expected_merged_output: + + - name: vlan1 + vlan_id: 1 + + - name: vlan2 + vlan_id: 2 + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_vlans: &id001 + config: + + - name: vlan1 + vlan_id: 1 + + - name: vlan2 + vlan_id: 2 + state: merged + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_merged_output | symmetric_difference(result['after']) |length\ + \ == 0 }}" + + - name: Merge the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_vlans: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_vlans merged integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/overridden.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/overridden.yaml new file mode 100644 index 00000000..ba24583b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/overridden.yaml @@ -0,0 +1,48 @@ +--- +- debug: + msg: START junos_vlans overridden integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_overridden_output: + + - name: vlan1 + vlan_id: 100 + +- block: + + - name: Override the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_vlans: &id001 + config: + + - name: vlan1 + vlan_id: 100 + state: overridden + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_overridden_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Override the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_vlans: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_vlans overridden integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/replaced.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/replaced.yaml new file mode 100644 index 00000000..556338b1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vlans/tests/netconf/replaced.yaml @@ -0,0 +1,51 @@ +--- +- debug: + msg: START junos_vlans replaced integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _base_config.yaml + +- set_fact: + expected_replaced_output: + + - name: vlan1 + vlan_id: 10 + + - name: vlan2 + vlan_id: 2 + +- block: + + - name: Replace the provided configuration with the exisiting running configuration + register: result + junipernetworks.junos.junos_vlans: &id001 + config: + + - name: vlan1 + vlan_id: 10 + state: replaced + + - name: Assert the configuration is reflected on host + assert: + that: + - "{{ expected_replaced_output | symmetric_difference(result['after'])\ + \ |length == 0 }}" + + - name: Replace the provided configuration with the existing running configuration + (IDEMPOTENT) + register: result + junipernetworks.junos.junos_vlans: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + +- debug: + msg: END junos_vlans replaced integration tests on connection={{ ansible_connection + }} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/defaults/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/meta/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/meta/main.yml new file mode 100644 index 00000000..d80f5fbf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - prepare_junos_tests diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/main.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/main.yaml new file mode 100644 index 00000000..e51116a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include: netconf.yaml diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/netconf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/netconf.yaml new file mode 100644 index 00000000..e7950174 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tasks/netconf.yaml @@ -0,0 +1,26 @@ +--- +- name: collect netconf test cases + find: + paths: '{{ role_path }}/tests/netconf' + patterns: '{{ testcase }}.yaml' + register: test_cases + connection: local + +- 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_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: + - local diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/basic.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/basic.yaml new file mode 100644 index 00000000..29683407 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/basic.yaml @@ -0,0 +1,338 @@ +--- +- debug: msg="START junos_vrf netconf/basic.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove vrf + junipernetworks.junos.junos_vrf: + name: test-1 + state: absent + provider: '{{ netconf }}' + +- name: Configure vrf and its parameter + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/6 + - ge-0/0/5 + rd: 192.0.2.3:10 + target: target:65513:111 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *test-1") + - result.diff.prepared is search("\+ *description test-vrf-1") + - result.diff.prepared is search("\+ *instance-type vrf") + - result.diff.prepared is search("\+ *interface ge-0/0/5.0") + - result.diff.prepared is search("\+ *interface ge-0/0/6.0") + - result.diff.prepared is search("\+ *route-distinguisher 192.0.2.3:10") + - result.diff.prepared is search("\+ *vrf-target target:65513:111") + +- name: Configure vrf and its parameter (idempotent) + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/6 + - ge-0/0/5 + rd: 192.0.2.3:10 + target: target:65513:111 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Change vrf parameter + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'[edit routing-instances test-1]' in result.diff.prepared" + - result.diff.prepared is search("\+ *interface ge-0/0/2.0") + - result.diff.prepared is search("\+ *interface ge-0/0/3.0") + - "'[edit routing-instances test-1]' in result.diff.prepared" + - result.diff.prepared is search("\+ *route-distinguisher 192.0.2.1:10") + - result.diff.prepared is search("\+ *vrf-target target:65514:113") + +- name: Deactivate vrf + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: present + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'[edit routing-instances]' in result.diff.prepared" + - result.diff.prepared is search("! *inactive[:] test-1") + - "'[edit routing-instances test-1]' in result.diff.prepared" + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/2.0") + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/3.0") + - "'[edit routing-instances test-1]' in result.diff.prepared" + - result.diff.prepared is search("! *inactive[:] route-distinguisher") + - result.diff.prepared is search("! *inactive[:] vrf-target") + +- name: Activate vrf + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: present + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'[edit routing-instances]' in result.diff.prepared" + - result.diff.prepared is search("! *active[:] test-1") + - "'[edit routing-instances test-1]' in result.diff.prepared" + - result.diff.prepared is search("! *active[:] interface ge-0/0/2.0") + - result.diff.prepared is search("! *active[:] interface ge-0/0/3.0") + - "'[edit routing-instances test-1]' in result.diff.prepared" + - result.diff.prepared is search("! *active[:] route-distinguisher") + - result.diff.prepared is search("! *active[:] vrf-target") + +- name: Delete vrf + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *test-1") + - result.diff.prepared is search("\- *description test-vrf-1") + - result.diff.prepared is search("\- *instance-type vrf") + - result.diff.prepared is search("\- *interface ge-0/0/2.0") + - result.diff.prepared is search("\- *interface ge-0/0/3.0") + - result.diff.prepared is search("\- *route-distinguisher 192.0.2.1:10") + - result.diff.prepared is search("\- *vrf-target target:65514:113") + +- name: Delete vrf (idempotent) + register: result + junipernetworks.junos.junos_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- name: Setup vrf using aggregate + register: result + junipernetworks.junos.junos_vrf: + aggregate: + + - name: test-1 + + - name: test-2 + state: absent + provider: '{{ netconf }}' + +- name: Create vrf using aggregate + register: result + junipernetworks.junos.junos_vrf: + aggregate: + + - name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + + - name: test-2 + description: test-vrf-2 + interfaces: + - ge-0/0/4 + - ge-0/0/5 + rd: 192.0.2.2:10 + target: target:65515:114 + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *test-1") + - result.diff.prepared is search("\+ *description test-vrf-1") + - result.diff.prepared is search("\+ *instance-type vrf") + - result.diff.prepared is search("\+ *interface ge-0/0/2.0") + - result.diff.prepared is search("\+ *interface ge-0/0/3.0") + - result.diff.prepared is search("\+ *route-distinguisher 192.0.2.1:10") + - result.diff.prepared is search("\+ *vrf-target target:65514:113") + - result.diff.prepared is search("\+ *test-2") + - result.diff.prepared is search("\+ *description test-vrf-2") + - result.diff.prepared is search("\+ *instance-type vrf") + - result.diff.prepared is search("\+ *interface ge-0/0/4.0") + - result.diff.prepared is search("\+ *interface ge-0/0/5.0") + - result.diff.prepared is search("\+ *route-distinguisher 192.0.2.2:10") + - result.diff.prepared is search("\+ *vrf-target target:65515:114") + +- name: Deactivate vrf configuration using aggregate + register: result + junipernetworks.junos.junos_vrf: + aggregate: + + - name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + + - name: test-2 + description: test-vrf-2 + interfaces: + - ge-0/0/4 + - ge-0/0/5 + rd: 192.0.2.2:10 + target: target:65515:114 + active: false + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'edit routing-instances test-1' in result.diff.prepared" + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/2.0") + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/3.0") + - result.diff.prepared is search("! *inactive[:] route-distinguisher") + - result.diff.prepared is search("! *inactive[:] vrf-target") + - "'edit routing-instances test-2' in result.diff.prepared" + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/4.0") + - result.diff.prepared is search("! *inactive[:] interface ge-0/0/5.0") + - result.diff.prepared is search("! *inactive[:] route-distinguisher") + - result.diff.prepared is search("! *inactive[:] vrf-target") + +- name: Deactivate vrf configuration using aggregate + register: result + junipernetworks.junos.junos_vrf: + aggregate: + + - name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/3 + - ge-0/0/2 + rd: 192.0.2.1:10 + target: target:65514:113 + + - name: test-2 + description: test-vrf-2 + interfaces: + - ge-0/0/4 + - ge-0/0/5 + rd: 192.0.2.2:10 + target: target:65515:114 + active: true + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - "'edit routing-instances test-1' in result.diff.prepared" + - result.diff.prepared is search("! *active[:] interface ge-0/0/2.0") + - result.diff.prepared is search("! *active[:] interface ge-0/0/3.0") + - result.diff.prepared is search("! *active[:] route-distinguisher") + - result.diff.prepared is search("! *active[:] vrf-target") + - "'edit routing-instances test-2' in result.diff.prepared" + - result.diff.prepared is search("! *active[:] interface ge-0/0/4.0") + - result.diff.prepared is search("! *active[:] interface ge-0/0/5.0") + - result.diff.prepared is search("! *active[:] route-distinguisher") + - result.diff.prepared is search("! *active[:] vrf-target") + +- name: Delete vrf configuration using aggregate + register: result + junipernetworks.junos.junos_vrf: + aggregate: + + - name: test-1 + + - name: test-2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\- *test-1") + - result.diff.prepared is search("\- *description test-vrf-1") + - result.diff.prepared is search("\- *instance-type vrf") + - result.diff.prepared is search("\- *interface ge-0/0/2.0") + - result.diff.prepared is search("\- *interface ge-0/0/3.0") + - result.diff.prepared is search("\- *route-distinguisher 192.0.2.1:10") + - result.diff.prepared is search("\- *vrf-target target:65514:113") + - result.diff.prepared is search("\- *test-2") + - result.diff.prepared is search("\- *description test-vrf-2") + - result.diff.prepared is search("\- *instance-type vrf") + - result.diff.prepared is search("\- *interface ge-0/0/4.0") + - result.diff.prepared is search("\- *interface ge-0/0/5.0") + - result.diff.prepared is search("\- *route-distinguisher 192.0.2.2:10") + - result.diff.prepared is search("\- *vrf-target target:65515:114") + +- name: Delete vrf configuration using aggregate (idempotent) + register: result + junipernetworks.junos.junos_vrf: + aggregate: + + - name: test-1 + + - name: test-2 + state: absent + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == false + +- debug: msg="END junos_vrf netconf/basic.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/net_vrf.yaml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/net_vrf.yaml new file mode 100644 index 00000000..4e6c7b9c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/junos_vrf/tests/netconf/net_vrf.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START junos netconf/net_vrf.yaml on connection={{ ansible_connection + }}" + +- name: setup - remove vrf + ansible.netcommon.net_vrf: + name: test-1 + state: absent + provider: '{{ netconf }}' + +- name: Configure vrf and its parameter using platform agnostic vrf module + register: result + ansible.netcommon.net_vrf: + name: test-1 + description: test-vrf-1 + interfaces: + - ge-0/0/6 + - ge-0/0/5 + rd: 192.0.2.3:10 + target: target:65513:111 + state: present + provider: '{{ netconf }}' + +- assert: + that: + - result.changed == true + - result.diff.prepared is search("\+ *test-1") + - result.diff.prepared is search("\+ *description test-vrf-1") + - result.diff.prepared is search("\+ *instance-type vrf") + - result.diff.prepared is search("\+ *interface ge-0/0/5.0") + - result.diff.prepared is search("\+ *interface ge-0/0/6.0") + - result.diff.prepared is search("\+ *route-distinguisher 192.0.2.3:10") + - result.diff.prepared is search("\+ *vrf-target target:65513:111") + +- name: teardown - remove vrf + ansible.netcommon.net_vrf: + name: test-1 + state: absent + provider: '{{ netconf }}' + +- debug: msg="START junos netconf/net_vrf.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml new file mode 100644 index 00000000..c797b6f1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/integration/targets/prepare_junos_tests/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- debug: msg="START prepare_junos_tests/main.yaml" + +- name: Ensure netconf is enabled + connection: ansible.netcommon.network_cli + tags: netconf + junipernetworks.junos.junos_netconf: + state: present + +- name: wait for netconf server to come up + delegate_to: localhost + wait_for: + host: '{{ hostvars[item].ansible_host }}' + port: 830 + with_inventory_hostnames: junos diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.10.txt new file mode 100644 index 00000000..05945554 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.10.txt @@ -0,0 +1,2 @@ +plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.9.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.9.txt new file mode 100644 index 00000000..9b2424b5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/ignore-2.9.txt @@ -0,0 +1,17 @@ +plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` +plugins/modules/junos_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_l2_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_l2_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_l3_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_l3_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_linkagg.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_linkagg.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_lldp.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_lldp.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_lldp_interface.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_lldp_interface.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_static_route.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_static_route.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict +plugins/modules/junos_vlan.py validate-modules:deprecation-mismatch # 2.9 expects METADATA +plugins/modules/junos_vlan.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/requirements.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/sanity/requirements.txt new file mode 100644 index 00000000..3e3a9669 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/builtins.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/builtins.py new file mode 100644 index 00000000..bfc8adfb --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/compat/mock.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py new file mode 100644 index 00000000..9a40af03 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/mock.py @@ -0,0 +1,128 @@ +# (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 + +import _io + +""" +Compat module for Python3.x's unittest.mock module +""" +import sys + +# 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/junipernetworks/junos/tests/unit/compat/unittest.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/compat/unittest.py new file mode 100644 index 00000000..df3379b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/mock/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/loader.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/loader.py new file mode 100644 index 00000000..c21188ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/mock/path.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/path.py new file mode 100644 index 00000000..0b3ac4a9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/path.py @@ -0,0 +1,12 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +from ansible_collections.junipernetworks.junos.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/junipernetworks/junos/tests/unit/mock/procenv.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py new file mode 100644 index 00000000..3e61aaf9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/procenv.py @@ -0,0 +1,96 @@ +# (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.junipernetworks.junos.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/junipernetworks/junos/tests/unit/mock/vault_helper.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/vault_helper.py new file mode 100644 index 00000000..b34ae134 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/mock/yaml_helper.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/mock/yaml_helper.py new file mode 100644 index 00000000..5df30aae --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/modules/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/conftest.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/conftest.py new file mode 100644 index 00000000..e19a1e04 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tests/unit/modules/network/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply.txt new file mode 100644 index 00000000..1d5b2399 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply.txt @@ -0,0 +1,7 @@ + + + set version 15.1X49-D15.4 + set system host-name vsrx01 + set system domain-name ansible.com + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_diff.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_diff.txt new file mode 100644 index 00000000..c2b803f8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_diff.txt @@ -0,0 +1,12 @@ + + + +[edit interfaces] ++ ae11 { ++ unit 0 { ++ description Test; ++ } ++ } + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_json.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_json.txt new file mode 100644 index 00000000..a1d7345a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/get_configuration_rpc_reply_json.txt @@ -0,0 +1,190 @@ + +{ + "configuration" : [ + { + "system" : [ + { + "host-name" : [ + { + "data" : "vsrx01" + } + ], + "domain-name" : [ + { + "data" : "junos.com" + } + ], + "name-server" : [ + { + "name" : + { + "data" : "172.26.1.1" + } + }, + { + "name" : + { + "data" : "8.8.8.8" + } + } + ], + "services" : [ + { + "ssh" : [ + { + } + ], + "telnet" : [ + { + } + ], + "netconf" : [ + { + "ssh" : [ + { + "port" : [ + { + "data" : "830" + } + ] + } + ], + "traceoptions" : [ + { + "file" : [ + { + "filename" : [ + { + "data" : "netconf-ops.log" + } + ] + } + ], + "flag" : [ + { + "name" : + { + "data" : "all" + } + } + ] + } + ] + } + ], + "web-management" : [ + { + "http" : [ + { + "interface" : [ + { + "data" : "fxp0.0" + } + ] + } + ] + } + ] + } + ], + "syslog" : [ + { + "user" : [ + { + "name" : + { + "data" : "*" + }, + "contents" : [ + { + "name" : + { + "data" : "any" + }, + "emergency" : [ + { + "data" : null + } + ] + } + ] + } + ], + "file" : [ + { + "name" : + { + "data" : "messages" + }, + "contents" : [ + { + "name" : + { + "data" : "any" + }, + "any" : [ + { + "data" : null + } + ] + }, + { + "name" : + { + "data" : "authorization" + }, + "info" : [ + { + "data" : null + } + ] + } + ] + }, + { + "name" : + { + "data" : "interactive-commands" + }, + "contents" : [ + { + "name" : + { + "data" : "interactive-commands" + }, + "any" : [ + { + "data" : null + } + ] + } + ] + }, + { + "name" : + { + "data" : "test1" + }, + "contents" : [ + { + "name" : + { + "data" : "any" + }, + "any" : [ + { + "data" : null + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] +} + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global.cfg new file mode 100644 index 00000000..e9750cb1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global.cfg @@ -0,0 +1,22 @@ +description "This is configured with Junos_bgp resource module replace"; +preference 2; +hold-time 5; +advertise-inactive; +out-delay 10; +bgp-error-tolerance { + malformed-route-limit 40000000; +} +authentication-algorithm md5; +advertise-bgp-static { + policy static-to-bgp; +} +bfd-liveness-detection { + version automatic; + minimum-receive-interval 8; + multiplier 30; + no-adaptation; + transmit-interval { + minimum-interval 4; + } +} +egress-te-sid-stats; \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global_config.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global_config.cfg new file mode 100644 index 00000000..711cc28c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_bgp_global_config.cfg @@ -0,0 +1,38 @@ + + + + 18.4R1-S2.4 + + + + + This is configured with Junos_bgp resource module + + 2 + 5 + + + + 10 + + + + 30000000 + + md5 + + + + + + 172.16.17.0/24 + + + + 10.200.16.75 + + 65432 + + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.json b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.json new file mode 100644 index 00000000..46fb623d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.json @@ -0,0 +1,28 @@ + +{ + "interfaces" : [ + { + "interface" : [ + { + "name" : + { + "data" : "ae11" + }, + "unit" : [ + { + "name" : + { + "data" : "0" + }, + "description" : [ + { + "data" : "Test" + } + ] + } + ] + } + ] + } + ] +} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.set b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.set new file mode 100644 index 00000000..c822fdb4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.set @@ -0,0 +1,2 @@ +delete interfaces ae11 +set interfaces ae11 unit 0 description Test \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.text b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.text new file mode 100644 index 00000000..b3d61b99 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.text @@ -0,0 +1,8 @@ + +interfaces { + ae11 { + unit 0 { + description Test + } + } + } \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.xml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.xml new file mode 100644 index 00000000..a0e8fe1b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_config.xml @@ -0,0 +1,9 @@ + + + ae11 + + 0 + Test + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces.cfg new file mode 100644 index 00000000..8a707327 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces.cfg @@ -0,0 +1,10 @@ +ge-0/0/0 { + description "Configured by Ansi-Team"; +} +fxp0 { + unit 0 { + family inet { + dhcp; + } + } +} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces_config.xml b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces_config.xml new file mode 100644 index 00000000..42fac96a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_interfaces_config.xml @@ -0,0 +1,53 @@ + + + + + + ge-0/0/1 + Configured by Ansible + + 100m + 1024 + + 2000 + 2200 + + full-duplex + + 0 + + + access + + vlan100 + + + + + + + ge-0/0/2 + Configured by Ansible + 400 + 10m + 2048 + + 3000 + 3200 + + + 0 + + + trunk + + vlan200 + vlan300 + + + + + + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l2_interfaces.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l2_interfaces.cfg new file mode 100644 index 00000000..9974d746 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l2_interfaces.cfg @@ -0,0 +1,31 @@ +ge-0/0/0 { + description "Configured by Ansi-Team"; +} +ge-0/0/1 { + unit 0 { + family ethernet-switching { + interface-mode access; + vlan { + members vlan100; + } + } + } +} +ge-0/0/2 { + native-vlan-id 400; + unit 0 { + family ethernet-switching { + interface-mode trunk; + vlan { + members [ vlan200 vlan300 ]; + } + } + } +} +fxp0 { + unit 0 { + family inet { + dhcp; + } + } +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l3_interfaces.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l3_interfaces.cfg new file mode 100644 index 00000000..fe81e715 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_l3_interfaces.cfg @@ -0,0 +1,39 @@ +ge-0/0/0 { + description "Configured by Ansi-Team"; +} +ge-0/0/1 { + unit 0 { + family ethernet-switching { + interface-mode access; + vlan { + members vlan100; + } + } + } +} +ge-0/0/2 { + native-vlan-id 400; + unit 0 { + family ethernet-switching { + interface-mode trunk; + vlan { + members [ vlan200 vlan300 ]; + } + } + } +} +ge-1/0/0 { + unit 0 { + family inet { + address 100.64.0.1/10; + address 100.64.0.2/10; + } + } +} +fxp0 { + unit 0 { + family inet { + dhcp; + } + } +} diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces.cfg new file mode 100644 index 00000000..f146b5c0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces.cfg @@ -0,0 +1,7 @@ +area 0.0.0.2 { + interface ge-0/0/2.0 { + metric 5; + priority 3; + } +} + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces_config.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces_config.cfg new file mode 100644 index 00000000..5d4bdc75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospf_interfaces_config.cfg @@ -0,0 +1,34 @@ + + + + + + + 0.0.0.10 + + 200 + + + so-0/0/0.0 + + 5 + 3 + + + + + 0.0.0.20 + + ge-1/1/0.0 + + + ge-2/2/0.0 + + + + + + 10.200.16.77 + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2.cfg new file mode 100644 index 00000000..7df43d60 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2.cfg @@ -0,0 +1,6 @@ +Sun Jun 14 12:10:47.455 UTC +router ospf 30 + area 100 + default-metric 10 + ! +! diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2_config.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2_config.cfg new file mode 100644 index 00000000..d86fb40d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv2_config.cfg @@ -0,0 +1,34 @@ + + + + + + + 0.0.0.10 + + 200 + + + so-0/0/0.0 + + 5 + 3 + + + + + 0.0.0.20 + + ge-1/1/0.0 + + + ge-2/2/0.0 + + + + + + 10.200.16.77 + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3.cfg new file mode 100644 index 00000000..13241363 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3.cfg @@ -0,0 +1,6 @@ +Sun Jun 14 12:10:47.455 UTC +router ospfv3 30 + area 100 + default-metric 10 + ! +! diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3_config.cfg b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3_config.cfg new file mode 100644 index 00000000..5d4bdc75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ospfv3_config.cfg @@ -0,0 +1,34 @@ + + + + + + + 0.0.0.10 + + 200 + + + so-0/0/0.0 + + 5 + 3 + + + + + 0.0.0.20 + + ge-1/1/0.0 + + + ge-2/2/0.0 + + + + + + 10.200.16.77 + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.10_count_2 b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.10_count_2 new file mode 100644 index 00000000..9fcc94a6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.10_count_2 @@ -0,0 +1,7 @@ +PING 10.10.10.10 (10.10.10.10): 56 data bytes +64 bytes from 10.10.10.10: icmp_seq=0 ttl=64 time=18.041 ms +64 bytes from 10.10.10.10: icmp_seq=1 ttl=64 time=15.710 ms + +--- 10.10.10.10 ping statistics --- +2 packets transmitted, 2 packets received, 0% packet loss +round-trip min/avg/max/stddev = 15.710/16.876/18.041/1.165 ms diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.11_count_5_size_512_interval_2 b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.11_count_5_size_512_interval_2 new file mode 100644 index 00000000..68d44d7f --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.11_count_5_size_512_interval_2 @@ -0,0 +1,11 @@ +PING 10.10.10.11 (10.10.10.11): 56 data bytes +64 bytes from 10.10.10.11: icmp_seq=0 ttl=64 time=18.041 ms +64 bytes from 10.10.10.11: icmp_seq=1 ttl=64 time=15.710 ms +64 bytes from 10.10.10.11: icmp_seq=0 ttl=64 time=16.051 ms +64 bytes from 10.10.10.11: icmp_seq=0 ttl=64 time=17.024 ms +64 bytes from 10.10.10.11: icmp_seq=0 ttl=64 time=20.090 ms + + +--- 10.10.10.11 ping statistics --- +5 packets transmitted, 5 packets received, 0% packet loss +round-trip min/avg/max/stddev = 18.710/17.876/20.041/2.165 ms diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.20_count_4 b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.20_count_4 new file mode 100644 index 00000000..70cff3bc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/junos_ping_ping_10.10.10.20_count_4 @@ -0,0 +1,4 @@ +PING 10.10.10.20 (10.10.10.20): 56 data bytes + +--- 10.10.10.20 ping statistics --- +4 packets transmitted, 0 packets received, 100% packet loss diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/load_configuration_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/load_configuration_xml.txt new file mode 100644 index 00000000..72ba03fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/load_configuration_xml.txt @@ -0,0 +1,6 @@ + + + + 0 + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_hardware_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_hardware_xml.txt new file mode 100644 index 00000000..a0853b8c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_hardware_xml.txt @@ -0,0 +1,26 @@ + + + + Chassis + adc382ed18b0 + VSRX + + Midplane + + + System IO + + + Routing Engine + VSRX RE + + + FPC 0 + Virtual FPC + + + Power Supply 0 + + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_routing-engine_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_routing-engine_xml.txt new file mode 100644 index 00000000..ccdcaca2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_chassis_routing-engine_xml.txt @@ -0,0 +1,52 @@ + + + + 0 + master + master (default) + OK + 30 degrees C / 86 degrees F + 27 degrees C / 80 degrees F + 16349 MB + (16384 MB installed) + 16 + 3 + 0 + 5 + 1 + 92 + RE-S-EX9200-1800X4 + 0123456789 + 2017-04-27 12:25:03 PDT + 139 days, 3 hours, 12 minutes, 35 seconds + Router rebooted after a normal shutdown. + 0.03 + 0.06 + 0.02 + + + 1 + backup + backup (default) + OK + 30 degrees C / 86 degrees F + 27 degrees C / 80 degrees F + 16349 MB + (16384 MB installed) + 10 + 0 + 0 + 0 + 0 + 100 + RE-S-EX9200-1800X4 + 0123456789 + 2017-09-13 10:24:59 PDT + 5 hours, 12 minutes, 36 seconds + Router rebooted after a normal shutdown. + 0.00 + 0.00 + 0.00 + + + diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_interfaces_details_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_interfaces_details_xml.txt new file mode 100644 index 00000000..5ba581bf --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_interfaces_details_xml.txt @@ -0,0 +1,25 @@ + + + + em0 + up + up + 8 + 17 + 1 + Ethernet + Ethernet + 1514 + 1000mbps + Unspecified + Unspecified + 0 + 0 + 52:54:00:8a:af:30 + 52:54:00:8a:af:30 + Unspecified + Never + Never + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_memory_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_memory_xml.txt new file mode 100644 index 00000000..541b6614 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_memory_xml.txt @@ -0,0 +1,20 @@ + + + + 983500 + 100% + 17844 + 1% + 67284 + 6% + 148268 + 15% + 288908 + 29% + 260500 + 26% + 200684 + 20% + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_storage_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_storage_xml.txt new file mode 100644 index 00000000..ecd29ba1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_system_storage_xml.txt @@ -0,0 +1,20 @@ + + + + /dev/vtbd0s1a + 1025132 + 583460 + 359664 + 62 + / + + + devfs + 2 + 2 + 0 + 100 + /dev + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_json.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_json.txt new file mode 100644 index 00000000..eacfd12d --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_json.txt @@ -0,0 +1,42 @@ + +{ + "software-information" : [ + { + "host-name" : [ + { + "data" : "vsrx01" + } + ], + "product-model" : [ + { + "data" : "vSRX" + } + ], + "product-name" : [ + { + "data" : "vsrx" + } + ], + "junos-version" : [ + { + "data" : "15.1X49-D15.4" + } + ], + "package-information" : [ + { + "name" : [ + { + "data" : "junos" + } + ], + "comment" : [ + { + "data" : "JUNOS Software Release [15.1X49-D15.4]" + } + ] + } + ] + } + ] + } + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_text.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_text.txt new file mode 100644 index 00000000..81e0f3a8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_text.txt @@ -0,0 +1,8 @@ + + + Hostname: vsrx01 + Model: vSRX + Junos: 15.1X49-D15.4 + JUNOS Software Release [15.1X49-D15.4] + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_xml.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_xml.txt new file mode 100644 index 00000000..996c2a35 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/fixtures/show_version_xml.txt @@ -0,0 +1,12 @@ + + + vsrx01 + vSRX + vsrx + 15.1X49-D15.4 + + junos + JUNOS Software Release [15.1X49-D15.4] + + + \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/junos_module.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/junos_module.py new file mode 100644 index 00000000..401051f7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/junos_module.py @@ -0,0 +1,103 @@ +# (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 + +import os +import json + +try: + from lxml.etree import parse +except ImportError: + from xml.etree.ElementTree import parse + +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + AnsibleExitJson, + AnsibleFailJson, + ModuleTestCase, +) + + +fixture_path = os.path.join(os.path.dirname(__file__), "fixtures") +fixture_data = {} + + +def load_fixture(name, content="xml"): + path = os.path.join(fixture_path, name) + if path in fixture_data: + return fixture_data[path] + + if content == "str": + with open(path) as f: + data = f.read() + try: + data = json.load(path) + except Exception: + pass + else: + try: + data = parse(path).getroot() + except Exception: + pass + + fixture_data[path] = data + return data + + +class TestJunosModule(ModuleTestCase): + def execute_module( + self, + failed=False, + changed=False, + commands=None, + sort=True, + defaults=False, + format="text", + ): + + self.load_fixtures(commands, format, changed=changed) + + if failed: + result = self.failed() + self.assertTrue(result["failed"], result) + else: + result = self.changed(changed) + self.assertEqual(result["changed"], changed, result) + + 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, format=None, changed=None): + pass diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py new file mode 100644 index 00000000..709cdf42 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_bgp_global.py @@ -0,0 +1,316 @@ +# -*- 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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_bgp_global, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosBgp_globalModule(TestJunosModule): + module = junos_bgp_global + + def setUp(self): + super(TestJunosBgp_globalModule, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.bgp_global.bgp_global.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.bgp_global.bgp_global.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_connection = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.bgp_global.bgp_global." + "Bgp_globalFacts.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.conn = self.get_connection() + self.conn.get = MagicMock() + + self.mock_get_xml_dict = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts." + "bgp_global.bgp_global.Bgp_globalFacts._get_xml_dict" + ) + self._get_xml_dict = self.mock_get_xml_dict.start() + + def tearDown(self): + super(TestJunosBgp_globalModule, self).tearDown() + self.mock_get_connection.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_connection.return_value = load_fixture( + "junos_bgp_global_config.cfg" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_bgp_global_merged(self): + set_module_args( + dict( + config=dict( + damping=True, + description="This is configured with Junos_bgp resource module", + preference="2", + bfd_liveness_detection=dict( + minimum_receive_interval=4, + multiplier=10, + no_adaptation=True, + version="automatic", + ), + ), + state="merged", + ) + ) + + commands = [ + '' + "This is configured with Junos_bgp resource module" + "2" + "4" + "10" + "automatic" + "" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_bgp_global_merged_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_bgp_global_config.cfg" + ) + src = load_fixture("junos_bgp_global.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=dict( + advertise_from_main_vpn_tables=True, + accept_remote_nexthop=True, + damping=True, + no_advertise_peer_as=True, + description="This is configured with Junos_bgp resource module", + preference="2", + ), + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_bgp_global_replaced(self): + set_module_args( + dict( + config=dict( + damping=True, + description="Replaced by Junos bgp global module", + preference="3", + bfd_liveness_detection=dict( + minimum_receive_interval=4, + multiplier=20, + no_adaptation=True, + version="automatic", + ), + ), + state="replaced", + ) + ) + commands = [ + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + "Replaced by Junos bgp global module3" + "4" + "20" + "automatic" + "" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_bgp_global_replaced_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_bgp_global_config.cfg" + ) + src = load_fixture("junos_bgp_global.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=dict( + advertise_from_main_vpn_tables=True, + accept_remote_nexthop=True, + damping=True, + no_advertise_peer_as=True, + description="This is configured with Junos_bgp resource module", + preference="2", + ), + state="replaced", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_bgp_global_delete(self): + self.get_connection.return_value = load_fixture( + "junos_bgp_global_config.cfg" + ) + src = load_fixture("junos_bgp_global.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args(dict(config=dict(), state="deleted")) + + commands = [ + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_bgp_global_delete_idempotent(self): + set_module_args(dict(state="deleted")) + self.execute_module(changed=False, commands=[]) + + def test_junos_bgp_global_purged(self): + self.get_connection.return_value = load_fixture( + "junos_bgp_global_config.cfg" + ) + src = load_fixture("junos_bgp_global.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args(dict(config=dict(), state="purged")) + + commands = [ + '' + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_bgp_global_purged_idempotent(self): + set_module_args(dict(state="purged")) + self.execute_module(changed=False, commands=[]) + + def test_junos_bgp_global_rendered(self): + set_module_args( + dict( + config=dict( + damping=True, + description="This is configured with Junos_bgp resource module", + preference="2", + bfd_liveness_detection=dict( + minimum_receive_interval=4, + multiplier=10, + no_adaptation=True, + version="automatic", + ), + ), + state="merged", + ) + ) + commands = [ + '' + "This is configured with Junos_bgp resource module" + "2" + "4" + "10automatic" + "" + "" + ] + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py new file mode 100644 index 00000000..ddfbfa7b --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_command.py @@ -0,0 +1,185 @@ +# (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 + +try: + from lxml.etree import fromstring +except ImportError: + from xml.etree.ElementTree import fromstring + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_command, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + +RPC_CLI_MAP = {"get-software-information": "show version"} + + +class TestJunosCommandModule(TestJunosModule): + + module = junos_command + + def setUp(self): + super(TestJunosCommandModule, self).setUp() + + self.mock_conn = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.Connection" + ) + self.conn = self.mock_conn.start() + + self.mock_netconf = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.NetconfConnection" + ) + self.netconf_conn = self.mock_netconf.start() + + self.mock_exec_rpc = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_command.exec_rpc" + ) + self.exec_rpc = self.mock_exec_rpc.start() + + self.mock_netconf_rpc = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection" + ) + self.netconf_rpc = self.mock_netconf_rpc.start() + + self.mock_get_connection = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_command.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.mock_get_capabilities = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_command.get_capabilities" + ) + self.get_capabilities = self.mock_get_capabilities.start() + self.get_capabilities.return_value = {"network_api": "netconf"} + + def tearDown(self): + super(TestJunosCommandModule, self).tearDown() + self.mock_conn.stop() + self.mock_netconf.stop() + self.mock_get_capabilities.stop() + self.mock_netconf_rpc.stop() + self.mock_exec_rpc.stop() + self.mock_get_connection.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + def load_from_file(*args, **kwargs): + element = fromstring(args[1]) + if element.text: + path = str(element.text) + else: + path = RPC_CLI_MAP[str(element.tag)] + + filename = path.replace(" ", "_") + filename = "%s_%s.txt" % (filename, format) + return load_fixture(filename) + + self.exec_rpc.side_effect = load_from_file + + def test_junos_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("Hostname:")) + + def test_junos_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("Hostname:")) + + def test_junos_command_wait_for(self): + wait_for = 'result[0] contains "Junos:"' + set_module_args(dict(commands=["show version"], wait_for=wait_for)) + self.execute_module() + + def test_junos_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.exec_rpc.call_count, 10) + + def test_junos_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.exec_rpc.call_count, 2) + + def test_junos_command_match_any(self): + wait_for = [ + 'result[0] contains "Junos:"', + 'result[0] contains "test string"', + ] + set_module_args( + dict(commands=["show version"], wait_for=wait_for, match="any") + ) + self.execute_module() + + def test_junos_command_match_all(self): + wait_for = [ + 'result[0] contains "Junos:"', + 'result[0] contains "JUNOS Software Release"', + ] + set_module_args( + dict(commands=["show version"], wait_for=wait_for, match="all") + ) + self.execute_module() + + def test_junos_command_match_all_failure(self): + wait_for = [ + 'result[0] contains "Junos:"', + '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) + + def test_junos_command_simple_json(self): + set_module_args(dict(commands=["show version"], display="json")) + result = self.execute_module(format="json") + self.assertEqual(len(result["stdout"]), 1) + self.assertTrue("software-information" in result["stdout"][0]) + + def test_junos_command_simple_rpc_text(self): + set_module_args( + dict(rpcs=["get-software-information"], display="text") + ) + result = self.execute_module(format="text") + self.assertEqual(len(result["stdout"]), 1) + self.assertTrue(result["stdout"][0].startswith("Hostname:")) + + def test_junos_command_simple_rpc_json(self): + set_module_args( + dict(rpcs=["get-software-information"], display="json") + ) + result = self.execute_module(format="json") + self.assertEqual(len(result["stdout"]), 1) + self.assertTrue("software-information" in result["stdout"][0]) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py new file mode 100644 index 00000000..5c274dab --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_config.py @@ -0,0 +1,229 @@ +# +# (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.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_config, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from ansible.module_utils._text import to_text +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosConfigModule(TestJunosModule): + + module = junos_config + + def setUp(self): + super(TestJunosConfigModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_config.get_configuration" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_load_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_config.load_configuration" + ) + self.load_configuration = self.mock_load_configuration.start() + + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_config.commit_configuration" + ) + self.commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_diff = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_config.get_diff" + ) + self.get_diff = self.mock_get_diff.start() + + self.mock_conn = patch("ansible.module_utils.connection.Connection") + self.conn = self.mock_conn.start() + + self.mock_netconf = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.NetconfConnection" + ) + self.netconf_conn = self.mock_netconf.start() + + self.mock_exec_rpc = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_config.exec_rpc" + ) + self.exec_rpc = self.mock_exec_rpc.start() + + self.mock_netconf_rpc = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection" + ) + self.netconf_rpc = self.mock_netconf_rpc.start() + + def tearDown(self): + super(TestJunosConfigModule, self).tearDown() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + self.mock_get_diff.stop() + self.load_configuration.stop() + self.mock_conn.stop() + self.mock_netconf.stop() + self.mock_exec_rpc.stop() + self.mock_netconf_rpc.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_config.return_value = load_fixture( + "get_configuration_rpc_reply.txt" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_config_unchanged(self): + src = load_fixture("junos_config.set", content="str") + set_module_args(dict(src=src)) + self.execute_module() + + def test_junos_config_src_set(self): + src = load_fixture("junos_config.set", content="str") + set_module_args(dict(src=src)) + self.execute_module(changed=True) + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["action"], "set") + self.assertEqual(kwargs["format"], "text") + + def test_junos_config_backup(self): + set_module_args(dict(backup=True)) + result = self.execute_module() + self.assertIn("__backup__", result) + + def test_junos_config_lines(self): + set_module_args( + dict( + lines=[ + "delete interfaces ae11", + "set interfaces ae11 unit 0 description Test", + ] + ) + ) + self.execute_module(changed=True) + args, kwargs = self.load_config.call_args + self.assertEqual( + args[1][0], "set interfaces ae11 unit 0 description Test" + ) + self.assertEqual(kwargs["action"], "set") + self.assertEqual(kwargs["format"], "text") + + def test_junos_config_confirm(self): + src = load_fixture("junos_config.set", content="str") + set_module_args(dict(src=src, confirm=40)) + self.execute_module(changed=True) + args, kwargs = self.commit_configuration.call_args + self.assertEqual(kwargs["confirm_timeout"], to_text(40)) + + def test_junos_config_rollback(self): + rollback = 10 + set_module_args(dict(rollback=rollback)) + self.execute_module(changed=True) + self.assertEqual(self.get_diff.call_count, 1) + self.assertEqual(self.load_configuration.call_count, 1) + self.assertEqual(self.commit_configuration.call_count, 1) + load_configuration_args = self.load_configuration.call_args + self.assertEqual(rollback, load_configuration_args[1].get("rollback")) + + def test_junos_config_src_text(self): + src = load_fixture("junos_config.text", content="str") + set_module_args(dict(src=src)) + self.execute_module(changed=True) + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["action"], "merge") + self.assertEqual(kwargs["format"], "text") + + def test_junos_config_src_xml(self): + src = load_fixture("junos_config.xml", content="str") + set_module_args(dict(src=src)) + self.execute_module(changed=True) + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["action"], "merge") + self.assertEqual(kwargs["format"], "xml") + + def test_junos_config_src_json(self): + src = load_fixture("junos_config.json", content="str") + set_module_args(dict(src=src)) + self.execute_module(changed=True) + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["action"], "merge") + self.assertEqual(kwargs["format"], "json") + + def test_junos_config_update_override(self): + src = load_fixture("junos_config.xml", content="str") + set_module_args(dict(src=src, update="override")) + self.execute_module() + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["action"], "override") + self.assertEqual(kwargs["format"], "xml") + + def test_junos_config_update_replace(self): + src = load_fixture("junos_config.json", content="str") + set_module_args(dict(src=src, update="replace")) + self.execute_module() + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["action"], "replace") + self.assertEqual(kwargs["format"], "json") + + def test_junos_config_zeroize(self): + set_module_args(dict(zeroize="yes")) + self.execute_module(changed=True) + self.assertEqual(self.exec_rpc.call_count, 1) + + def test_junos_config_src_format_xml(self): + src = load_fixture("junos_config.json", content="str") + set_module_args(dict(src=src, src_format="xml")) + self.execute_module() + args, kwargs = self.load_config.call_args + self.assertEqual(kwargs["format"], "xml") + + def test_junos_config_confirm_commit(self): + set_module_args(dict(confirm_commit=True)) + self.execute_module(changed=True) + self.assertEqual(self.commit_configuration.call_count, 1) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py new file mode 100644 index 00000000..9c7a84af --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_facts.py @@ -0,0 +1,182 @@ +# (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 + +try: + from lxml.etree import fromstring +except ImportError: + from xml.etree.ElementTree import fromstring + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_facts, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + +RPC_CLI_MAP = { + "get-software-information": "show version", + "get-interface-information": "show interfaces details", + "get-system-memory-information": "show system memory", + "get-chassis-inventory": "show chassis hardware", + "get-route-engine-information": "show chassis routing-engine", + "get-system-storage": "show system storage", +} + + +class TestJunosCommandModule(TestJunosModule): + + module = junos_facts + + def setUp(self): + super(TestJunosCommandModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.legacy.base.get_configuration" + ) + self.get_config = self.mock_get_config.start() + + self.mock_netconf = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.NetconfConnection" + ) + self.netconf_conn = self.mock_netconf.start() + + self.mock_exec_rpc = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.legacy.base.exec_rpc" + ) + self.exec_rpc = self.mock_exec_rpc.start() + + self.mock_netconf_rpc = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection" + ) + self.netconf_rpc = self.mock_netconf_rpc.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.junipernetworks.junos.plugins.module_utils.network.junos.facts.legacy.base.get_capabilities" + ) + self.get_capabilities = self.mock_get_capabilities.start() + + self.get_capabilities.return_value = { + "device_info": { + "network_os": "junos", + "network_os_hostname": "vsrx01", + "network_os_model": "vsrx", + "network_os_version": "17.3R1.10", + }, + "network_api": "netconf", + } + + def tearDown(self): + super(TestJunosCommandModule, self).tearDown() + self.mock_netconf.stop() + self.mock_exec_rpc.stop() + self.mock_netconf_rpc.stop() + self.mock_get_capabilities.stop() + self.mock_get_resource_connection.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + def load_from_file(*args, **kwargs): + element = fromstring(args[1]) + + if element.text: + path = str(element.text) + else: + path = RPC_CLI_MAP[str(element.tag)] + + filename = path.replace(" ", "_") + filename = "%s_%s.txt" % (filename, format) + return load_fixture(filename) + + self.exec_rpc.side_effect = load_from_file + + def test_junos_get_facts(self): + set_module_args(dict()) + result = self.execute_module(format="xml") + facts = result["ansible_facts"] + + self.assertEqual(facts["ansible_net_hostname"], "vsrx01") + self.assertTrue("em0" in facts["ansible_net_interfaces"]) + self.assertEqual( + facts["ansible_net_interfaces"]["em0"]["type"], "Ethernet" + ) + self.assertEqual(facts["ansible_net_memtotal_mb"], 983500) + self.assertEqual(facts["ansible_net_filesystems"][0], "/dev/vtbd0s1a") + self.assertTrue("ansible_net_config" not in facts) + self.assertEqual( + facts["ansible_net_routing_engines"]["0"]["model"], + "RE-S-EX9200-1800X4", + ) + self.assertEqual(facts["ansible_net_modules"][0]["name"], "Midplane") + self.assertTrue(facts["ansible_net_has_2RE"]) + + def test_junos_get_facts_subset_config_set(self): + self.get_config.return_value = load_fixture( + "get_configuration_rpc_reply.txt" + ) + set_module_args(dict(gather_subset="config", config_format="set")) + result = self.execute_module(format="xml") + facts = result["ansible_facts"] + + self.assertTrue("ansible_net_config" in facts) + self.assertTrue(facts["ansible_net_config"].startswith("set")) + self.assertEqual(facts["ansible_net_hostname"], "vsrx01") + self.assertTrue("ansible_net_interfaces" not in facts) + + def test_junos_get_facts_subset_config_json(self): + self.get_config.return_value = load_fixture( + "get_configuration_rpc_reply_json.txt" + ) + set_module_args(dict(gather_subset="config", config_format="json")) + result = self.execute_module(format="xml") + facts = result["ansible_facts"] + + self.assertTrue("ansible_net_config" in facts) + self.assertTrue("configuration" in facts["ansible_net_config"]) + self.assertEqual(facts["ansible_net_hostname"], "vsrx01") + self.assertTrue("ansible_net_interfaces" not in facts) + + def test_junos_get_facts_subset_list(self): + set_module_args(dict(gather_subset=["hardware", "interfaces"])) + result = self.execute_module(format="xml") + facts = result["ansible_facts"] + + self.assertTrue("ansible_net_config" not in facts) + self.assertEqual( + facts["ansible_net_interfaces"]["em0"]["oper-status"], "up" + ) + self.assertEqual(facts["ansible_net_memfree_mb"], 200684) + + def test_junos_get_facts_wrong_subset(self): + set_module_args(dict(gather_subset=["hardware", "interfaces", "test"])) + result = self.execute_module(format="xml", failed=True) + + self.assertTrue(result["msg"].startswith("Subset must be one")) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py new file mode 100644 index 00000000..9dbe74e6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_interfaces.py @@ -0,0 +1,276 @@ +# -*- 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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_interfaces, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosInterfacesModule(TestJunosModule): + module = junos_interfaces + + def setUp(self): + super(TestJunosInterfacesModule, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.interfaces.interfaces.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.interfaces.interfaces.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.interfaces.interfaces." + "InterfacesFacts.get_config" + ) + self.get_config = self.mock_get_config.start() + + def tearDown(self): + super(TestJunosInterfacesModule, self).tearDown() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_interfaces_merged(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + description="This is configured with ansible resource module", + mtu=1024, + speed="100m", + ) + ], + state="merged", + ) + ) + commands = [ + '' + "ge-0/0/1" + "This is configured with ansible resource module" + "100m" + "1024" + "" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_interfaces_merged_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/0", description="Configured by Ansi-Team" + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_interfaces_replaced(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/2", + description="This is configured with ansible", + mtu=1024, + speed="100m", + ) + ], + state="replaced", + ) + ) + result = self.execute_module(changed=True) + + commands = [ + '' + "ge-0/0/2" + '' + '' + '' + '' + "ge-0/0/2" + "This is configured with ansible" + "100m1024" + "" + ] + + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_interfaces_replaced_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/0", description="Configured by Ansi-Team" + ) + ], + state="replaced", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_interfaces_overridden(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/2", + description="This is configured with ansible", + mtu=1024, + speed="100m", + ) + ], + state="overridden", + ) + ) + commands = [ + '' + "ge-0/0/2" + '' + '' + '' + '' + "ge-0/0/2" + "This is configured with ansible" + "100m1024" + "" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_interfaces_overridden_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/0", description="Configured by Ansi-Team" + ) + ], + state="overridden", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_interfaces_delete(self): + set_module_args(dict(config=[dict(name="ge-0/0/2")], state="deleted")) + + commands = [ + '' + "ge-0/0/2" + '' + '' + '' + '' + ] + + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_interfaces_delete_idempotent(self): + set_module_args(dict(config=[dict(name="ge-0/0/4")], state="deleted")) + self.execute_module(changed=False, commands=[]) + + def test_junos_interfaces_rendered(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + description="This is configured with ansible resource module", + mtu=1024, + speed="100m", + ) + ], + state="rendered", + ) + ) + commands = [ + '' + "ge-0/0/1" + "This is configured with ansible resource module" + "100m" + "1024" + "" + ] + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py new file mode 100644 index 00000000..e584eab6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l2_interfaces.py @@ -0,0 +1,241 @@ +# -*- 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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_l2_interfaces, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosL2InterfacesModule(TestJunosModule): + module = junos_l2_interfaces + + def setUp(self): + super(TestJunosL2InterfacesModule, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.l2_interfaces.l2_interfaces.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.l2_interfaces.l2_interfaces.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.l2_interfaces.l2_interfaces." + "L2_interfacesFacts.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_get_res_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.l2_interfaces.l2_interfaces." + "L2_interfaces.get_res_config" + ) + self.get_res_config = self.mock_get_res_config.start() + + def tearDown(self): + super(TestJunosL2InterfacesModule, self).tearDown() + self.mock_get_config.stop() + self.mock_get_res_config.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_l2_interfaces_merged(self): + set_module_args( + dict( + config=[dict(name="ge-0/0/1", access=dict(vlan="vlan100"))], + state="merged", + ) + ) + commands = [ + '' + "ge-0/0/10" + "access" + "vlan100" + "" + "" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_l2_interfaces_merged_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l2_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[dict(name="ge-0/0/1", access=dict(vlan="vlan100"))], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_l2_interfaces_replaced(self): + self.get_res_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + set_module_args( + dict( + config=[dict(name="ge-0/0/2", access=dict(vlan="vlan200"))], + state="replaced", + ) + ) + commands = [ + '' + "ge-0/0/20" + "" + '' + '' + "ge-0/0/2" + "0" + "access" + "vlan200" + "" + ] + result = self.execute_module(changed=True) + + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_l2_interfaces_replaced_idempotent(self): + self.get_res_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l2_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[dict(name="ge-0/0/1", access=dict(vlan="vlan100"))], + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_l2_interfaces_overridden(self): + set_module_args( + dict( + config=[dict(name="ge-0/0/3", access=dict(vlan="vlan300"))], + state="overridden", + ) + ) + commands = [ + '' + "ge-0/0/30" + "" + "accessvlan300" + "" + ] + result = self.execute_module(changed=True) + + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_l2_interfaces_overridden_idempotent(self): + self.get_res_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l2_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[dict(name="ge-0/0/1", access=dict(vlan="vlan100"))], + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_l2_interfaces_delete(self): + self.get_res_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l2_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args(dict(config=[dict(name="ge-0/0/1")], state="deleted")) + commands = [ + '' + "ge-0/0/10" + '' + '' + '' + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_l2_interfaces_delete_idempotent(self): + set_module_args(dict(config=[dict(name="ge-0/0/4")], state="deleted")) + self.execute_module(changed=False, commands=[]) + + def test_junos_l2_interfaces_rendered(self): + set_module_args( + dict( + config=[dict(name="ge-0/0/1", access=dict(vlan="vlan100"))], + state="merged", + ) + ) + commands = [ + '' + "ge-0/0/10" + "access" + "vlan100" + "" + "" + ] + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py new file mode 100644 index 00000000..bb949025 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_l3_interfaces.py @@ -0,0 +1,259 @@ +# -*- 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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_l3_interfaces, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosL3InterfacesModule(TestJunosModule): + module = junos_l3_interfaces + + def setUp(self): + super(TestJunosL3InterfacesModule, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.l3_interfaces.l3_interfaces.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.l3_interfaces.l3_interfaces.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.l3_interfaces.l3_interfaces." + "L3_interfacesFacts.get_config" + ) + self.get_config = self.mock_get_config.start() + + def tearDown(self): + super(TestJunosL3InterfacesModule, self).tearDown() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_l3_interfaces_merged(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="merged", + ) + ) + commands = [ + '' + "ge-0/0/10" + "100.64.0.1/10" + "100.64.0.2/10" + "" + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_l3_interfaces_merged_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l3_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_l3_interfaces_replaced(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/2", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="replaced", + ) + ) + commands = [ + '' + "ge-0/0/20" + "100.64.0.1/10" + "100.64.0.2/10" + "" + ] + result = self.execute_module(changed=True) + + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_l3_interfaces_replaced_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l3_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_l3_interfaces_overridden(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="overridden", + ) + ) + commands = [ + '' + "ge-0/0/10" + "100.64.0.1/10" + "100.64.0.2/10" + "" + ] + result = self.execute_module(changed=True) + + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_l3_interfaces_overridden_idempotent(self): + self.get_config.return_value = load_fixture( + "junos_interfaces_config.xml" + ) + src = load_fixture("junos_l3_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_l3_interfaces_rendered(self): + set_module_args( + dict( + config=[ + dict( + name="ge-0/0/1", + ipv4=[ + dict(address="100.64.0.1/10"), + dict(address="100.64.0.2/10"), + ], + ) + ], + state="rendered", + ) + ) + commands = [ + '' + "ge-0/0/10" + "100.64.0.1/10" + "100.64.0.2/10" + "" + ] + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py new file mode 100644 index 00000000..39108189 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_netconf.py @@ -0,0 +1,131 @@ +# (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.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_netconf, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule + + +class TestJunosCommandModule(TestJunosModule): + + module = junos_netconf + + def setUp(self): + super(TestJunosCommandModule, self).setUp() + + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + + self.mock_conn = patch("ansible.module_utils.connection.Connection") + self.conn = self.mock_conn.start() + + self.mock_netconf = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.NetconfConnection" + ) + self.netconf_conn = self.mock_netconf.start() + + self.mock_netconf_rpc = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection" + ) + self.netconf_rpc = self.mock_netconf_rpc.start() + + self.mock_get_capabilities = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.get_capabilities" + ) + self.get_capabilities = self.mock_get_capabilities.start() + self.get_capabilities.return_value = {"network_api": "netconf"} + + def tearDown(self): + super(TestJunosCommandModule, self).tearDown() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_conn.stop() + self.mock_netconf.stop() + self.mock_netconf_rpc.stop() + self.mock_get_capabilities.stop() + + def test_junos_netconf_enable(self): + self.netconf_conn().get.return_value = "" + set_module_args(dict(state="present")) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], ["set system services netconf ssh port 830"] + ) + + def test_junos_netconf_disable(self): + out = """ + ssh { + port 830; + } + """ + self.netconf_conn().get.return_value = out + set_module_args(dict(state="absent")) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], ["delete system services netconf"] + ) + + def test_junos_netconf_port_change(self): + out = """ + ssh { + port 830; + } + """ + self.netconf_conn().get.return_value = out + set_module_args(dict(state="present", netconf_port=22)) + result = self.execute_module(changed=True) + self.assertEqual( + result["commands"], ["set system services netconf ssh port 22"] + ) + + def test_junos_netconf_port_error(self): + out = """ + ssh { + port 22; + } + """ + self.netconf_conn().get.return_value = out + set_module_args(dict(state="present", netconf_port=0)) + result = self.execute_module(changed=True, failed=True) + self.assertEqual( + result["msg"], "netconf_port must be between 1 and 65535" + ) + + def test_junos_netconf_config_error(self): + self.netconf_conn().get.return_value = None + set_module_args(dict(state="present")) + result = self.execute_module(failed=True) + self.assertEqual(result["msg"], "unable to retrieve current config") diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py new file mode 100644 index 00000000..fa580f96 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospf_interfaces.py @@ -0,0 +1,348 @@ +# -*- 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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_ospf_interfaces, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosOspfv3Module(TestJunosModule): + module = junos_ospf_interfaces + + def setUp(self): + super(TestJunosOspfv3Module, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospf_interfaces.ospf_interfaces.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospf_interfaces.ospf_interfaces.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_connection = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospf_interfaces.ospf_interfaces." + "Ospf_interfacesFacts.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.conn = self.get_connection() + self.conn.get = MagicMock() + + self.mock_get_xml_dict = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts." + "ospf_interfaces.ospf_interfaces.Ospf_interfacesFacts._get_xml_dict" + ) + self._get_xml_dict = self.mock_get_xml_dict.start() + + def tearDown(self): + super(TestJunosOspfv3Module, self).tearDown() + self.mock_get_connection.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_connection.return_value = load_fixture( + "junos_ospf_interfaces_config.cfg" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_ospf_interfaces_merged(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + name="ge-0/0/2.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.2"), + priority=3, + metric=5, + ), + ) + ], + ) + ], + state="merged", + ) + ) + commands = [ + '' + "0.0.0.2ge-0/0/2.0" + "35", + '' + "10.200.16.75", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_ospf_interfaces_merged_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospf_interfaces_config.cfg" + ) + src = load_fixture("junos_ospf_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.77", + name="so-0/0/0.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.10"), + priority=3, + metric=5, + ), + ) + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_ospf_interfaces_replaced(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + name="ge-0/0/2.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.1"), + priority=6, + metric=7, + ), + ) + ], + ) + ], + state="replaced", + ) + ) + result = self.execute_module(changed=True) + commands = [ + '' + "0.0.0.1ge-0/0/2.0" + "67", + '' + "10.200.16.75", + ] + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospf_interfaces_replaced_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospf_interfaces_config.cfg" + ) + src = load_fixture("junos_ospf_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + name="ge-0/0/2.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.1"), + priority=6, + metric=7, + ), + ) + ], + ) + ], + state="replaced", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_ospf_interfaces_overridden(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + name="ge-0/0/2.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.1"), + priority=6, + metric=7, + ), + ) + ], + ) + ], + state="overridden", + ) + ) + commands = [ + '' + "0.0.0.1ge-0/0/2.0" + "67", + '' + "10.200.16.75", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospf_interfaces_overridden_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospf_interfaces_config.cfg" + ) + src = load_fixture("junos_ospf_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + name="ge-0/0/2.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.1"), + priority=6, + metric=7, + ), + ) + ], + ) + ], + state="overridden", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_ospf_interfaces_delete(self): + self.get_connection.return_value = load_fixture( + "junos_ospf_interfaces_config.cfg" + ) + src = load_fixture("junos_ospf_interfaces.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[dict(router_id="10.200.16.75", name="ge-0/0/2.0")], + state="deleted", + ) + ) + + commands = [ + '', + '', + ] + + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospf_interfaces_delete_idempotent(self): + set_module_args( + dict( + config=[dict(router_id="10.200.16.75", name="ge-0/0/2.0")], + state="deleted", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_ospf_interfaces_rendered(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + name="ge-0/0/2.0", + address_family=[ + dict( + afi="ipv4", + processes=dict( + area=dict(area_id="0.0.0.1"), + priority=6, + metric=7, + ), + ) + ], + ) + ], + state="rendered", + ) + ) + commands = [ + '' + "0.0.0.1ge-0/0/2.0" + "67", + '' + "10.200.16.75", + ] + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py new file mode 100644 index 00000000..621b810a --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv2.py @@ -0,0 +1,395 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Red Hat +# GNU General Public License v2.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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_ospfv2, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosOspfv2Module(TestJunosModule): + module = junos_ospfv2 + + def setUp(self): + super(TestJunosOspfv2Module, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospf.ospf.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospf.ospf.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_connection = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospf.ospf." + "OspfFacts.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.conn = self.get_connection() + self.conn.get = MagicMock() + + self.mock_get_xml_dict = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospf.ospf.OspfFacts._get_xml_dict" + ) + self._get_xml_dict = self.mock_get_xml_dict.start() + + def tearDown(self): + super(TestJunosOspfv2Module, self).tearDown() + self.mock_get_connection.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_connection.return_value = load_fixture( + "junos_ospfv2_config.cfg" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_ospfv2_merged(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "35" + "200", + '' + "10.200.16.75", + ] + result = self.execute_module(changed=True) + + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_ospfv2_merged_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospfv2_config.cfg" + ) + src = load_fixture("junos_ospfv2.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="30", + areas=[ + dict( + area_id="100", + stub=dict(default_metric=10, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv2_replaced(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="replaced", + ) + ) + result = self.execute_module(changed=True) + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "3" + "5" + "200" + "0.0.0.100" + "so-0/0/0.0" + "35" + "200", + '' + "10.200.16.7510.200.16.75", + ] + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospfv2_replaced_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospfv2_config.cfg" + ) + src = load_fixture("junos_ospfv2.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="30", + areas=[ + dict( + area_id="100", + stub=dict(default_metric=10, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="replaced", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv2_overridden(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "3" + "5" + "200", + '' + "10.200.16.75", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospfv2_overridden_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospfv2_config.cfg" + ) + src = load_fixture("junos_ospfv2.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="30", + areas=[ + dict( + area_id="100", + stub=dict(default_metric=10, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv2_delete(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[dict(name="so-0/0/0.0")], + ) + ], + ) + ], + state="deleted", + ) + ) + + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "200", + '' + "10.200.16.75", + ] + + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospfv2_delete_idempotent(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.70", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[dict(name="so-0/0/0.0")], + ) + ], + ) + ], + state="deleted", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv2_parsed(self): + + set_module_args( + dict( + running_config='\n' + '\n' + '' + "\n\n\n\n0.0.0.100\n\n" + "200\n\n\nso-0/0/0.0" + "\n\n5\n3\n" + "\n\n\n\n\n" + "10.200.16.75\n\n" + "\n", + state="parsed", + ) + ) + result = self.execute_module(changed=False) + self.assertEqual([], result["parsed"]) + + def test_junos_ospfv2_rendered(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="rendered", + ) + ) + commands = ( + '' + "0.0.0.100so-0/0/0.0" + "35" + "200" + ) + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py new file mode 100644 index 00000000..8284a9b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ospfv3.py @@ -0,0 +1,394 @@ +# -*- 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. +# +############################################# + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_ospfv3, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosOspfv3Module(TestJunosModule): + module = junos_ospfv3 + + def setUp(self): + super(TestJunosOspfv3Module, self).setUp() + self.mock_lock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.lock_configuration" + ) + self.lock_configuration = self.mock_lock_configuration.start() + self.mock_unlock_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.unlock_configuration" + ) + self.unlock_configuration = self.mock_unlock_configuration.start() + self.mock_load_config = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospfv3.ospfv3.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_validate_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config" + ) + self.validate_config = self.mock_validate_config.start() + + self.mock_commit_configuration = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.config.ospfv3.ospfv3.commit_configuration" + ) + self.mock_commit_configuration = self.mock_commit_configuration.start() + + self.mock_get_connection = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospfv3.ospfv3." + "Ospfv3Facts.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.conn = self.get_connection() + self.conn.get = MagicMock() + + self.mock_get_xml_dict = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.facts.ospfv3.ospfv3.Ospfv3Facts._get_xml_dict" + ) + self._get_xml_dict = self.mock_get_xml_dict.start() + + def tearDown(self): + super(TestJunosOspfv3Module, self).tearDown() + self.mock_get_connection.stop() + self.mock_load_config.stop() + self.mock_validate_config.stop() + self.mock_lock_configuration.stop() + self.mock_unlock_configuration.stop() + self.mock_commit_configuration.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + self.get_connection.return_value = load_fixture( + "junos_ospfv3_config.cfg" + ) + if changed: + self.load_config.return_value = load_fixture( + "get_configuration_rpc_reply_diff.txt" + ) + else: + self.load_config.return_value = None + + def test_junos_ospfv3_merged(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "35" + "200", + '' + "10.200.16.75", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), sorted(commands)) + + def test_junos_ospfv3_merged_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospfv3_config.cfg" + ) + src = load_fixture("junos_ospfv3.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="30", + areas=[ + dict( + area_id="100", + stub=dict(default_metric=10, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv3_replaced(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="replaced", + ) + ) + result = self.execute_module(changed=True) + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "3" + "5" + "200" + "0.0.0.100" + "so-0/0/0.0" + "35" + "200", + '' + "10.200.16.7510.200.16.75", + ] + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospfv3_replaced_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospfv3_config.cfg" + ) + src = load_fixture("junos_ospfv3.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="30", + areas=[ + dict( + area_id="100", + stub=dict(default_metric=10, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="replaced", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv3_overridden(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "3" + "5" + "200", + '' + "10.200.16.75", + ] + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospfv3_overridden_idempotent(self): + self.get_connection.return_value = load_fixture( + "junos_ospfv3_config.cfg" + ) + src = load_fixture("junos_ospfv3.cfg", content="str") + set_module_args(dict(src=src)) + set_module_args( + dict( + config=[ + dict( + router_id="30", + areas=[ + dict( + area_id="100", + stub=dict(default_metric=10, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="overridden", + ) + ) + + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv3_delete(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[dict(name="so-0/0/0.0")], + ) + ], + ) + ], + state="deleted", + ) + ) + + commands = [ + '' + "0.0.0.100so-0/0/0.0" + "200", + '' + "10.200.16.75", + ] + + result = self.execute_module(changed=True) + self.assertEqual(sorted(result["commands"]), commands) + + def test_junos_ospfv3_delete_idempotent(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.70", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[dict(name="so-0/0/0.0")], + ) + ], + ) + ], + state="deleted", + ) + ) + self.execute_module(changed=False, commands=[]) + + def test_junos_ospfv3_parsed(self): + + set_module_args( + dict( + running_config='\n' + '\n' + '' + "\n\n\n\n0.0.0.100\n\n" + "200\n\n\nso-0/0/0.0" + "\n\n5\n3\n" + "\n\n\n\n\n" + "10.200.16.75\n\n" + "\n", + state="parsed", + ) + ) + result = self.execute_module(changed=False) + self.assertEqual([], result["parsed"]) + + def test_junos_ospfv3_rendered(self): + set_module_args( + dict( + config=[ + dict( + router_id="10.200.16.75", + areas=[ + dict( + area_id="0.0.0.100", + stub=dict(default_metric=200, set=True), + interfaces=[ + dict( + name="so-0/0/0.0", priority=3, metric=5 + ) + ], + ) + ], + ) + ], + state="rendered", + ) + ) + commands = ( + '' + "0.0.0.100so-0/0/0.0" + "35" + "200" + ) + self.execute_module(changed=False, commands=commands) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py new file mode 100644 index 00000000..b1e01e32 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_package.py @@ -0,0 +1,85 @@ +# (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.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule + +jnpr_mock = MagicMock() +modules = { + "jnpr": jnpr_mock, + "jnpr.junos": jnpr_mock.junos, + "jnpr.junos.utils": jnpr_mock.junos.utils, + "jnpr.junos.utils.sw": jnpr_mock.junos.utils.sw, +} +module_patcher = patch.dict("sys.modules", modules) +module_patcher.start() + +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_package, +) + + +class TestJunosPackageModule(TestJunosModule): + + module = junos_package + + def setUp(self): + super(TestJunosPackageModule, self).setUp() + self.mock_get_device = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_package.get_device" + ) + self.get_device = self.mock_get_device.start() + + def tearDown(self): + super(TestJunosPackageModule, self).tearDown() + self.mock_get_device.stop() + + def test_junos_package_src(self): + set_module_args(dict(src="junos-vsrx-12.1X46-D10.2-domestic.tgz")) + self.execute_module(changed=True) + + args, _kwargs = jnpr_mock.junos.utils.sw.SW().install.call_args + self.assertEqual(args, ("junos-vsrx-12.1X46-D10.2-domestic.tgz",)) + + def test_junos_package_src_fail(self): + jnpr_mock.junos.utils.sw.SW().install.return_value = 0 + set_module_args(dict(src="junos-vsrx-12.1X46-D10.2-domestic.tgz")) + result = self.execute_module(changed=True, failed=True) + + self.assertEqual(result["msg"], "Unable to install package on device") + + def test_junos_package_src_no_copy(self): + jnpr_mock.junos.utils.sw.SW().install.return_value = 1 + set_module_args( + dict(src="junos-vsrx-12.1X46-D10.2-domestic.tgz", no_copy=True) + ) + self.execute_module(changed=True) + + args, kwargs = jnpr_mock.junos.utils.sw.SW().install.call_args + self.assertEqual(args, ("junos-vsrx-12.1X46-D10.2-domestic.tgz",)) + self.assertEqual(kwargs["no_copy"], True) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py new file mode 100644 index 00000000..c6fb3f7c --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_ping.py @@ -0,0 +1,144 @@ +# (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.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.plugins.modules import ( + junos_ping, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +class TestJunosPingModule(TestJunosModule): + module = junos_ping + + def setUp(self): + super(TestJunosPingModule, self).setUp() + + self.mock_get_connection = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_ping.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + self.conn = self.get_connection() + self.conn.get = MagicMock() + + def tearDown(self): + super(TestJunosPingModule, self).tearDown() + self.mock_get_connection.stop() + + def test_junos_ping_expected_success(self): + set_module_args(dict(count=2, dest="10.10.10.10")) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.10_count_2", content="str" + ) + ) + result = self.execute_module() + self.assertEqual(result["commands"], "ping 10.10.10.10 count 2") + + def test_junos_ping_expected_failure(self): + set_module_args(dict(count=4, dest="10.10.10.20", state="absent")) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.20_count_4", content="str" + ) + ) + result = self.execute_module() + self.assertEqual(result["commands"], "ping 10.10.10.20 count 4") + + def test_junos_ping_unexpected_success(self): + """ Test for successful pings when destination should not be reachable - FAIL. """ + set_module_args(dict(count=2, dest="10.10.10.10", state="absent")) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.10_count_2", content="str" + ) + ) + self.execute_module(failed=True) + + def test_junos_ping_unexpected_failure(self): + """ Test for unsuccessful pings when destination should be reachable - FAIL. """ + set_module_args(dict(count=4, dest="10.10.10.20")) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.20_count_4", content="str" + ) + ) + self.execute_module(failed=True) + + def test_junos_ping_failure_stats(self): + """Test for asserting stats when ping fails""" + set_module_args(dict(count=4, dest="10.10.10.20")) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.20_count_4", content="str" + ) + ) + result = self.execute_module(failed=True) + self.assertEqual(result["packet_loss"], "100%") + self.assertEqual(result["packets_rx"], 0) + self.assertEqual(result["packets_tx"], 4) + + def test_junos_ping_success_stats(self): + set_module_args(dict(count=2, dest="10.10.10.10")) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.10_count_2", content="str" + ) + ) + result = self.execute_module() + self.assertEqual(result["commands"], "ping 10.10.10.10 count 2") + self.assertEqual(result["packet_loss"], "0%") + self.assertEqual(result["packets_rx"], 2) + self.assertEqual(result["packets_tx"], 2) + self.assertEqual(result["rtt"]["min"], 15.71) + self.assertEqual(result["rtt"]["avg"], 16.87) + self.assertEqual(result["rtt"]["max"], 18.04) + self.assertEqual(result["rtt"]["stddev"], 1.165) + + def test_junos_ping_success_stats_with_options(self): + set_module_args( + dict(count=5, size=512, interval=2, dest="10.10.10.11") + ) + self.conn.get = MagicMock( + return_value=load_fixture( + "junos_ping_ping_10.10.10.11_count_5_size_512_interval_2", + content="str", + ) + ) + result = self.execute_module() + self.assertEqual( + result["commands"], "ping 10.10.10.11 count 5 size 512 interval 2" + ) + self.assertEqual(result["packet_loss"], "0%") + self.assertEqual(result["packets_rx"], 5) + self.assertEqual(result["packets_tx"], 5) + self.assertEqual(result["rtt"]["min"], 18.71) + self.assertEqual(result["rtt"]["avg"], 17.87) + self.assertEqual(result["rtt"]["max"], 20.04) + self.assertEqual(result["rtt"]["stddev"], 2.165) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py new file mode 100644 index 00000000..e76315f2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_rpc.py @@ -0,0 +1,139 @@ +# (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 + +try: + from lxml.etree import fromstring +except ImportError: + from xml.etree.ElementTree import fromstring + +from ansible_collections.junipernetworks.junos.tests.unit.compat.mock import ( + patch, +) +from ansible_collections.junipernetworks.junos.plugins.modules import junos_rpc +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule, load_fixture + + +RPC_CLI_MAP = { + "get-software-information": "show version", + "get-interface-information": "show interfaces details", + "get-system-memory-information": "show system memory", + "get-chassis-inventory": "show chassis hardware", + "get-system-storage": "show system storage", + "load-configuration": "load configuration", +} + + +class TestJunosCommandModule(TestJunosModule): + + module = junos_rpc + + def setUp(self): + super(TestJunosCommandModule, self).setUp() + self.mock_conn = patch("ansible.module_utils.connection.Connection") + self.conn = self.mock_conn.start() + + self.mock_netconf = patch( + "ansible_collections.junipernetworks.junos.plugins.module_utils.network.junos.junos.NetconfConnection" + ) + self.netconf_conn = self.mock_netconf.start() + + self.mock_netconf_rpc = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.netconf.NetconfConnection" + ) + self.netconf_rpc = self.mock_netconf_rpc.start() + + self.mock_exec_rpc = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_rpc.exec_rpc" + ) + self.exec_rpc = self.mock_exec_rpc.start() + + def tearDown(self): + super(TestJunosCommandModule, self).tearDown() + self.mock_conn.stop() + self.mock_netconf.stop() + self.mock_netconf_rpc.stop() + self.mock_exec_rpc.stop() + + def load_fixtures(self, commands=None, format="text", changed=False): + def load_from_file(*args, **kwargs): + element = fromstring(args[1]) + if element.text: + path = str(element.text) + else: + tag = str(element.tag) + if tag.startswith("{"): + tag = tag.split("}", 1)[1] + path = RPC_CLI_MAP[tag] + + filename = path.replace(" ", "_") + filename = "%s_%s.txt" % (filename, format) + + return load_fixture(filename) + + self.exec_rpc.side_effect = load_from_file + + def test_junos_rpc_xml(self): + set_module_args(dict(rpc="get-chassis-inventory")) + result = self.execute_module(format="xml") + self.assertTrue(result["xml"].find("\n")) + + def test_junos_rpc_text(self): + set_module_args(dict(rpc="get-software-information", output="text")) + result = self.execute_module(format="text") + self.assertTrue( + result["output_lines"][0].startswith("Hostname: vsrx01") + ) + + def test_junos_rpc_json(self): + set_module_args(dict(rpc="get-software-information", output="json")) + result = self.execute_module(format="json") + self.assertTrue("software-information" in result["output"]) + + def test_junos_rpc_args(self): + set_module_args( + dict( + rpc="get-software-information", + args={"interface": "em0", "media": True}, + ) + ) + self.execute_module(format="xml") + args, kwargs = self.exec_rpc.call_args + reply = args[1] + self.assertTrue( + reply.find( + "em0" + ) + ) + + def test_junos_rpc_attrs(self): + set_module_args( + dict( + rpc="load-configuration", + output="xml", + attrs={"url": "/var/tmp/config.conf"}, + ) + ) + result = self.execute_module(format="xml") + self.assertTrue(result["xml"].find("")) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py new file mode 100644 index 00000000..630dd070 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/network/junos/test_junos_scp.py @@ -0,0 +1,104 @@ +# (c) 2018 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.junipernetworks.junos.tests.unit.compat.mock import ( + patch, + MagicMock, +) +from ansible_collections.junipernetworks.junos.tests.unit.modules.utils import ( + set_module_args, +) +from .junos_module import TestJunosModule + +jnpr_mock = MagicMock() +modules = { + "jnpr": jnpr_mock, + "jnpr.junos": jnpr_mock.junos, + "jnpr.junos.utils": jnpr_mock.junos.utils, + "jnpr.junos.utils.scp": jnpr_mock.junos.utils.scp, +} +module_patcher = patch.dict("sys.modules", modules) +module_patcher.start() + +from ansible_collections.junipernetworks.junos.plugins.modules import junos_scp + + +class TestJunosScpModule(TestJunosModule): + + module = junos_scp + + def setUp(self): + super(TestJunosScpModule, self).setUp() + self.mock_get_device = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_scp.get_device" + ) + self.get_device = self.mock_get_device.start() + + self.mock_scp = patch( + "ansible_collections.junipernetworks.junos.plugins.modules.junos_scp.SCP" + ) + self.scp = self.mock_scp.start() + + self.scp_mock = MagicMock() + self.scp().__enter__.return_value = self.scp_mock + + def tearDown(self): + super(TestJunosScpModule, self).tearDown() + self.mock_get_device.stop() + self.mock_scp.stop() + + def test_junos_scp_src(self): + set_module_args(dict(src="test.txt")) + self.execute_module(changed=True) + + self.scp_mock.put.assert_called_once_with( + "test.txt", remote_path=".", recursive=False + ) + + def test_junos_scp_src_fail(self): + self.scp_mock.put.side_effect = OSError( + "[Errno 2] No such file or directory: 'text.txt'" + ) + set_module_args(dict(src="test.txt")) + result = self.execute_module(changed=True, failed=True) + + self.assertEqual( + result["msg"], "[Errno 2] No such file or directory: 'text.txt'" + ) + + def test_junos_scp_remote_src(self): + set_module_args(dict(src="test.txt", remote_src=True)) + self.execute_module(changed=True) + + self.scp_mock.get.assert_called_once_with( + "test.txt", local_path=".", recursive=False + ) + + def test_junos_scp_all(self): + set_module_args( + dict(src="test", remote_src=True, dest="tmp", recursive=True) + ) + self.execute_module(changed=True) + + self.scp_mock.get.assert_called_once_with( + "test", local_path="tmp", recursive=True + ) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py new file mode 100644 index 00000000..c93116a7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/modules/utils.py @@ -0,0 +1,55 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import json + +from ansible_collections.junipernetworks.junos.tests.unit.compat import ( + unittest, +) +from ansible_collections.junipernetworks.junos.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/junipernetworks/junos/tests/unit/plugins/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/__init__.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/test_junos.py b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/test_junos.py new file mode 100644 index 00000000..0b8faaed --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/plugins/terminal/test_junos.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2018, Fran Fitzpatrick fxfitz +# 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 mock import call, MagicMock +import pytest + +from ansible.errors import AnsibleConnectionFailure +from ansible_collections.junipernetworks.junos.plugins.terminal import junos + + +@pytest.fixture +def junos_terminal(): + mock_connection = MagicMock() + return junos.TerminalModule(mock_connection) + + +def test_on_open_shell_sets_terminal_parameters(junos_terminal): + expected_calls = [ + call(b"set cli timestamp disable"), + call(b"set cli screen-length 0"), + call(b"set cli screen-width 1024"), + ] + junos_terminal._exec_cli_command = MagicMock() + junos_terminal._get_prompt = MagicMock() + + junos_terminal._get_prompt.return_value = b"user@localhost >" + junos_terminal.on_open_shell() + junos_terminal._exec_cli_command.assert_has_calls(expected_calls) + + +def test_on_open_shell_enters_cli_if_root_prompt(junos_terminal): + expected_calls = [ + call(b"cli"), + call(b"set cli timestamp disable"), + call(b"set cli screen-length 0"), + call(b"set cli screen-width 1024"), + ] + junos_terminal._exec_cli_command = MagicMock() + junos_terminal._get_prompt = MagicMock() + + junos_terminal._connection.get_prompt.return_value = b"root@localhost%" + junos_terminal.on_open_shell() + junos_terminal._exec_cli_command.assert_has_calls(expected_calls) + + +def test_on_open_shell_raises_problem_setting_terminal_config(junos_terminal): + junos_terminal._connection.exec_command.side_effect = ( + AnsibleConnectionFailure + ) + with pytest.raises(AnsibleConnectionFailure) as exc: + junos_terminal.on_open_shell() + + assert "unable to set terminal parameters" in str(exc.value) diff --git a/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/requirements.txt b/collections-debian-merged/ansible_collections/junipernetworks/junos/tests/unit/requirements.txt new file mode 100644 index 00000000..a9772bea --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/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/junipernetworks/junos/tox.ini b/collections-debian-merged/ansible_collections/junipernetworks/junos/tox.ini new file mode 100644 index 00000000..87d80b70 --- /dev/null +++ b/collections-debian-merged/ansible_collections/junipernetworks/junos/tox.ini @@ -0,0 +1,34 @@ +[tox] +minversion = 1.4.2 +envlist = linters +skipsdist = True + +[testenv] +basepython = python3 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = find {toxinidir} -type f -name "*.py[c|o]" -delete + +[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