示例#1
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(eos_argument_spec)

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

    ansible_facts = {}
    if module.params.get("available_network_resources"):
        ansible_facts["available_network_resources"] = sorted(
            FACT_RESOURCE_SUBSETS.keys()
        )
    result = Facts(module).get_facts()
    additional_facts, additional_warnings = result
    ansible_facts.update(additional_facts)
    warnings.extend(additional_warnings)

    module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
示例#2
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(eos_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)
 def __init__(self, module):
     super(Logging_global, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="logging_global",
         tmplt=Logging_globalTemplate(),
     )
     self.parsers = [
         "buffered",
         "event",
         "facility",
         "console",
         "format",
         "format.timestamp.traditional",
         "format.timestamp.highresolution",
         "level",
         "monitor",
         "on",
         "persistent",
         "policy",
         "relogging_interval",
         "repeat_messages",
         "src_interface",
         "synchronous",
         "trap",
     ]
示例#4
0
 def __init__(self, module):
     super(Bgp_global, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="bgp_global",
         tmplt=Bgp_globalTemplate(),
     )
     self.parsers = [
         "router",
         "vrf",
         "default_metric",
         "distance",
         "graceful_restart",
         "graceful_restart_helper",
         "acccess_group",
         "maximum_paths",
         "monitoring",
         "route_target",
         "router_id",
         "shutdown",
         "timers",
         "ucmp_fec",
         "ucmp_link_bandwidth",
         "ucmp_mode",
         "update",
         "vlan",
         "vlan_aware_bundle",
     ]
示例#5
0
 def __init__(self, module):
     super(Bgp_af, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="bgp_address_family",
         tmplt=Bgp_afTemplate(),
     )
     self.parsers = [
         "router",
         "address_family",
         "bgp_params_additional_paths",
         "bgp_params.nexthop_address_family",
         "bgp_params.nexthop_unchanged",
         "bgp_params.redistribute_internal",
         "bgp_params.route",
         "graceful_restart",
         "neighbor.activate",
         "neighbor.additional_paths",
         "neighbor.default_originate",
         "neighbor.graceful_restart",
         "neighbor.next_hop_unchanged",
         "neighbor.next_hop_address_family",
         "neighbor.prefix_list",
         "neighbor.route_map",
         "neighbor.weight",
         "neighbor.encapsulation",
         "network",
         "redistribute",
         "route_target",
     ]
 def __init__(self, module):
     super(Hostname, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="hostname",
         tmplt=HostnameTemplate(),
     )
示例#7
0
 def __init__(self, module):
     super(Prefix_lists, self).__init__(
         empty_fact_val=[],
         facts_module=Facts(module),
         module=module,
         resource="prefix_lists",
         tmplt=Prefix_listsTemplate(),
     )
     self.parsers = []
示例#8
0
    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('acl_interfaces')
        if not acl_interfaces_facts:
            return []
        return acl_interfaces_facts
    def get_vlans_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)
        vlans_facts = facts['ansible_network_resources'].get('vlans')
        if not vlans_facts:
            return []
        return vlans_facts
示例#10
0
    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
示例#11
0
    def get_interfaces_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)
        interfaces_facts = facts["ansible_network_resources"].get("interfaces")
        if not interfaces_facts:
            return []
        return interfaces_facts
    def get_lldp_global_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)
        lldp_global_facts = facts["ansible_network_resources"].get(
            "lldp_global")
        if not lldp_global_facts:
            return {}
        return lldp_global_facts
 def __init__(self, module):
     super(Ntp_global, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="ntp_global",
         tmplt=Ntp_globalTemplate(),
     )
     self.parsers = [
         "authenticate",
         "local_interface",
         "qos_dscp",
         "trusted_key",
     ]
示例#14
0
 def __init__(self, module):
     super(Route_maps, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="route_maps",
         tmplt=Route_mapsTemplate(),
     )
     self.parsers = [
         "continue",
         "route_map.copy",
         "route_map.rename",
         "description",
         "sub_route_map",
     ]
示例#15
0
 def __init__(self, module):
     super(Ospfv3, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="ospfv3",
         tmplt=Ospfv3Template(),
     )
     self.parsers = [
         "vrf",
         "address_family",
         "adjacency",
         "auto_cost",
         "area.default_cost",
         "area.authentication",
         "area.encryption",
         "area.nssa",
         "area.ranges",
         "area.stub",
         "bfd",
         "default_information",
         "default_metric",
         "distance",
         "fips_restrictions",
         "graceful_restart",
         "graceful_restart_period",
         "graceful_restart_helper",
         "log_adjacency_changes",
         "max_metric",
         "maximum_paths",
         "passive_interface",
         "redistribute",
         "router_id",
         "shutdown",
         "timers.lsa",
         "timers.out_delay",
         "timers.pacing",
         "timers.throttle.lsa",
         "timers.throttle.spf",
     ]
 def __init__(self, module):
     super(Snmp_server, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="snmp_server",
         tmplt=Snmp_serverTemplate(),
     )
     self.parsers = [
         "chassis_id",
         "contact",
         "traps.bgp",
         "traps.bridge",
         "traps.capacity",
         "traps.entity",
         "traps.external_alarm",
         "traps.isis",
         "traps.lldp",
         "traps.mpls_ldp",
         "traps.msdp",
         "traps.ospf",
         "traps.ospfv3",
         "traps.pim",
         "traps.snmp",
         "traps.snmpConfigManEvent",
         "traps.switchover",
         "traps.test",
         "traps.vrrp",
         "engineid",
         "extension",
         "local_interface",
         "location",
         "notification",
         "objects.mac",
         "objects.route",
         "qos",
         "qosmib",
         "transmit",
         "transport",
     ]
示例#17
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(eos_argument_spec)

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)
    warnings = []
    ansible_facts = {}
    if module.params.get("available_network_resources"):
        ansible_facts["available_network_resources"] = sorted(
            FACT_RESOURCE_SUBSETS.keys())
    result = Facts(module).get_facts()
    additional_facts, additional_warnings = result
    ansible_facts.update(additional_facts)
    warnings.extend(additional_warnings)

    module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
示例#18
0
 def __init__(self, module):
     super(Ospf_interfaces, self).__init__(
         empty_fact_val={},
         facts_module=Facts(module),
         module=module,
         resource="ospf_interfaces",
         tmplt=Ospf_interfacesTemplate(),
     )
     self.parsers = [
         "interfaces",
         "area",
         "authentication_v2",
         "authentication_v3",
         "authentication_key",
         "deadinterval",
         "encryption",
         "hellointerval",
         "bfd",
         "cost",
         "ip_params_area",
         "ip_params_bfd",
         "ip_params_cost",
         "ip_params_dead_interval",
         "ip_params_hello_interval",
         "ip_params_mtu_ignore",
         "ip_params_network",
         "ip_params_priority",
         "ip_params_passive_interface",
         "ip_params_retransmit_interval",
         "ip_params_transmit_delay",
         "mtu_ignore",
         "network",
         "priority",
         "passive_interface",
         "retransmit_interval",
         "transmit_delay",
         "message_digest_key",
     ]