Skip to content

api_facts: Include information from /interface/ethernet #355

Open
@chaeynz

Description

@chaeynz
SUMMARY

In RouterOS at /interface ethernet print detail we can get data about the transmission standard in the advertise= field.
For example: advertise=10M-baseT-half,10M-baseT-full,100M-baseT-half,100M-baseT-full,1G-baseT-half,1G-baseT-full,1G-baseX,2.5G-baseT,2.5G-baseX,5G-baseT,10G-baseT,10G-baseSR-LR,10G-baseCR

This information is not available in the api_facts module.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

api_facts

ADDITIONAL INFORMATION

It would be useful to backfill a source of truth with facts from the device. Netbox for example requires the type of interface to be specified and while I can think of a solution to do that for SFP interfaces, RJ45 interfaces in MikroTik are always called etherX, so determining the exact speed is not possible.
Would be useful to get this info without additional scripting :)

  tasks:
    - name: Collect facts
      community.routeros.api_facts:
        <<: *credentials
        gather_subset: all

    - name: Netbox | Create interfaces
      loop: "{{ ansible_net_interfaces | dict2items }}"
      netbox.netbox.netbox_device_interface:
        <<: *netbox_credentials
        data:
          name: "{{ item.key }}"
          mac_address: "{{ item.value['mac-address'] }}"
          device: "{{ inventory_hostname }}"
          mtu: "{{ item.value.mtu }}"
          type: "{{ item.value.advertise | # some extra filtering required, but doable }}" # note this line

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions