コード例 #1
0
    def get_bfd_interfaces_facts(self):
        """ Get the 'facts' (the current configuration)

        :returns: A list of interface configs and a platform string
        """
        facts, _warnings = Facts(self._module).get_facts(
            self.gather_subset, self.gather_network_resources)
        bfd_interfaces_facts = facts['ansible_network_resources'].get(
            'bfd_interfaces', [])
        platform = facts.get('ansible_net_platform', '')
        return bfd_interfaces_facts, platform
コード例 #2
0
    def get_interfaces_facts(self, get_default_interfaces=False):
        """ Get the 'facts' (the current configuration)

        :get_default_interfaces: boolean - when True include a list of existing-but-default interface names in the facts dict.
          - The defaults list is primarily used to detect non-existent virtual interfaces.
        :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')
        interfaces_facts = remove_rsvd_interfaces(interfaces_facts)
        if get_default_interfaces:
            default_interfaces = facts['ansible_network_resources'].get(
                'default_interfaces', [])
            interfaces_facts.append(default_interfaces)

        self.intf_defs = facts.get('intf_defs', {})
        return interfaces_facts
コード例 #3
0
 def get_platform_type(self):
     default, _warnings = Facts(self._module).get_facts(legacy_facts_type=['default'])
     return default.get('ansible_net_platform', '')