Esempio n. 1
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('l2_interfaces')
        if not interfaces_facts:
            return []

        return interfaces_facts
Esempio n. 2
0
    def get_acl_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_facts = facts['ansible_network_resources'].get('acls')
        if not acl_facts:
            return []

        return acl_facts
Esempio n. 3
0
    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
Esempio n. 4
0
def main():
    """ Main entry point for AnsibleModule
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(ios_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']

    result = Facts(module).get_facts()

    ansible_facts, additional_warnings = result
    warnings.extend(additional_warnings)

    module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
Esempio n. 5
0
def main():
    """
    Main entry point for module execution

    :returns: ansible_facts
    """
    argument_spec = FactsArgs.argument_spec
    argument_spec.update(ios_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)
Esempio n. 6
0
 def __init__(self, module):
     super(Interfaces, self).__init__(empty_fact_val={},
                                      facts_module=Facts(module),
                                      module=module,
                                      resource='interfaces',
                                      tmplt=InterfacesTemplate())