When I use the gather fact module and choose to get the l2_interfaces, it doesn’t return the l2_interfaces properties.
When I use the same playbook on catalyst 3650 (also ios-xe) I get the l2_interfaces properties.
output:
net_interfaces - show me interface configuration per interface
net_neighbors - shows me Mac address etc for all connected devices
l2_interfaces - shows me interface name, switchport mode and access vlan
Hey Lucio,
as I see in the config that you have shared, there is no switchport or vlan data to parse as per the current scope of the module.
Note -
the interface data as shared in the above config is
interface GigabitEthernet0/0
vrf forwarding Mgmt-vrf
no ip address
shutdown
negotiation auto
!
interface GigabitEthernet1/0/1
no logging event link-status
no cdp enable
no snmp trap link-status
source template redacted
service-policy input redacted
!
interface GigabitEthernet1/0/2
no logging event link-status
shutdown
no cdp enable
no snmp trap link-status
source template redacted
service-policy input redacted
!
!
interface GigabitEthernet1/0/24
shutdown
!
interface GigabitEthernet1/1/1
!
interface GigabitEthernet1/1/2
!
interface GigabitEthernet1/1/3
!
interface GigabitEthernet1/1/4 ``` the module is supposed to generate blank facts for the device. Regards, Sagar Paul
*E - sagpaul@redhat.com GH - KB-perByte*
Thank you for your time and your interest, truly appreciated.
With interface templates you will not see the vlans or other port configurations on the interface when running show run int interface-name.
To see the applied configuration on the interface the command “show derived-config” is needed.
An example:
With a normal show run you will not see all the configs applied to the switchport
testswitch01#show run interface g1/0/1
interface GigabitEthernet1/0/1
no logging event link-status
no cdp enable
no snmp trap link-status
source template ENDUSER
service-policy input PM_IN_MARK
end
To see all the configs applied to the switchport, do the following
The scope of the l2_interfaces module depends on the command show running-config | section ^interface the facts are generated with the config op from the specific command. You may want to raise a feature request here for an update on the scope of the module.
Given our earlier conversation, the number of changes, in this case, would be significant.
As the module is an older resource module that had all the resource module states but lacks a parser file to break config data to structured data and the flexibilities of newer resource modules using RMTemplateEngine.
The changes would go in - facts file - l2_interfaces.py [ to handle the facts generation i.e breaking config data that is pulled from a specific command to structured data ] config file - l2_interfaces.py [ to use the structured data and deal with want and have on the basis of states ]
argspec file - l2_interfaces.py [ to support the attributes present or added in the module’s model ]
these are the primary files that need change.
I would rather suggest it would be much easier as a re-write keeping the present scope of the module intact and adding new ones that you suggested and the change in command that pulls in the config data. If you are willing to re-write the module and contribute, you can use NetworkResourceModuleDevGuide to get started and understand the collection better, the doc should help you with getting started, and use cli_rm_builder to generate the boilerplate code to start with the development. You may address the PR with the issue tagged.