Exemplo n.º 1
0
def get_switch_running_config(module):
    '''
    Gets the switch running-config
    '''
    config_url = '/rest/v1/fullconfigs/running-config'
    running_config = get(module, config_url)
    return running_config
Exemplo n.º 2
0
 def populate_facts(self, connection, ansible_facts, data=None):
     '''
     Obtain and return VRFs Facts
     '''
     vrfs_url = '/rest/v10.04/system/vrfs?depth=2'
     data = get(self._module, vrfs_url)
     facts = {'vrfs': data}
     ansible_facts['ansible_network_resources'].update(facts)
     return ansible_facts
Exemplo n.º 3
0
    def populate(self):
        '''
        Obtain and populate the facts
        '''
        self.data = get(self._module, self._url)

        if self._fact_name == 'config':
            self.facts['config'] = self.data
            return

        if self._fact_name in self.data.keys():
            self.facts[self._fact_name] = self.data[self._fact_name]
Exemplo n.º 4
0
    def populate(self):
        '''
        Obtain and populate the facts
        '''
        self._url = '/rest/v10.04/system/subsystems?depth=4'
        self.data = get(self._module, self._url)
        output_data = {}

        for sub_system in self.data.keys():
            sub_system_details = self.data[sub_system]

            if self._fact_name in sub_system_details.keys():

                output_data[sub_system] = sub_system_details[self._fact_name]

        self.facts[self._fact_name] = output_data
Exemplo n.º 5
0
    def populate_facts(self, connection, ansible_facts, data=None):
        '''
        Obtain and return VLAN facts
        '''
        vlans_url = '/rest/v10.04/system/vlans?depth=2'
        data = get(self._module, vlans_url)

        internal_vlan_list = []
        for vlan in data.keys():
            if 'type' in data[vlan].keys():
                if data[vlan]['type'] == 'internal':
                    internal_vlan_list.append(vlan)

        for vlan in internal_vlan_list:
            data.pop(vlan)

        facts = {'vlans': data}
        ansible_facts['ansible_network_resources'].update(facts)
        return ansible_facts