Hey Lucio,

Hope you are doing good!

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
<https://github.com/ansible-collections/cisco.ios/blob/main/plugins/module_utils/network/ios/facts/l2_interfaces/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
<https://github.com/ansible-collections/cisco.ios/blob/main/plugins/module_utils/network/ios/config/l2_interfaces/l2_interfaces.py>
[ *to use the structured data and deal with want and have on the basis of
states* ]
argspec file - l2_interfaces.py
<https://github.com/ansible-collections/cisco.ios/blob/main/plugins/module_utils/network/ios/argspec/l2_interfaces/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
<https://github.com/ansible-network/cli_rm_builder/blob/main/docs/rm_dev_guide.md>
to get started and understand the collection better, the doc should help
you with getting started, and use cli_rm_builder
<https://github.com/ansible-network/cli_rm_builder> to generate the
boilerplate code to start with the development. You may address the PR with
the issue <https://github.com/ansible-collections/cisco.ios/issues/512>
tagged.

Regards,
Sagar Paul
*E - [email protected] <https://groups.google.com/> GH - KB-perByte*

On Sun, Mar 6, 2022 at 4:04 PM L. Jankok <[email protected]> wrote:

> Hi Sagar,
>
> If I want to change to scope myself, can you tell me which file I need to
> patch?
>
> Regards,
>
> Lucio Jankok
>
> Op ma 7 feb. 2022 om 12:42 schreef Sagar Paul <[email protected]>:
>
>> Hey Lucio,
>>
>> 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 <https://github.com/ansible-collections/cisco.ios/issues>
>> for an update on the scope of the module.
>>
>> Regards,
>> Sagar Paul
>> *E - [email protected] <https://groups.google.com/> GH - KB-perByte*
>>
>>
>>
>> On Friday, February 4, 2022 at 8:14:51 PM UTC+5:30 [email protected]
>> wrote:
>>
>>> Hi Thom,
>>>
>>> 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*
>>>
>>>
>>> testswitch01#*show derived-config interface g1/0/1*
>>>
>>> Building configuration...
>>>
>>>
>>>
>>> Derived configuration : 270 bytes
>>>
>>> !
>>>
>>> interface GigabitEthernet1/0/1
>>>
>>> description ENDUSER-WORKSTATION
>>>
>>> switchport access vlan 990
>>>
>>> switchport mode access
>>>
>>> no logging event link-status
>>>
>>> load-interval 30
>>>
>>> no cdp enable
>>>
>>> no snmp trap link-status
>>>
>>> spanning-tree portfast
>>>
>>> service-policy input PM_IN_MARK
>>>
>>> end
>>>
>>> Op vr 4 feb. 2022 om 13:59 schreef Sagar Paul <[email protected]>:
>>>
>>>> Hey Lucio,
>>>>
>>>> Can you share some details, I am not sure if I am getting it right.
>>>>
>>>> Regards,
>>>> Sagar Paul
>>>> *E - [email protected] <https://groups.google.com/> GH - KB-perByte*
>>>> On Friday, February 4, 2022 at 5:53:53 PM UTC+5:30 [email protected]
>>>> wrote:
>>>>
>>>>> Hi Saga,
>>>>>
>>>>> Actually there is.
>>>>>
>>>>> The configuration is being applied using source templates.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Lucio Jankok
>>>>>
>>>>> Op vr 4 feb. 2022 om 11:01 schreef Sagar Paul <[email protected]>:
>>>>>
>>>>>>
>>>>>> 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 - [email protected] GH - KB-perByte*
>>>>>>
>>>>>> On Tuesday, February 1, 2022 at 9:14:29 PM UTC+5:30 [email protected]
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Sagar,
>>>>>>>
>>>>>>> The following is the case:
>>>>>>>
>>>>>>> *With the following platform I have no issues*
>>>>>>>
>>>>>>> platform: cisco WS-3850-24S
>>>>>>> net_iostype: IOS-XE
>>>>>>> net_version: 16.06.05
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> ---
>>>>>>>
>>>>>>> *With the 9300 I don't get the complete l2_interfaces output*
>>>>>>>
>>>>>>> *platform: 9300-24p*
>>>>>>> *net_iostype: IOS-XE*
>>>>>>> *net_version: 17.03.03*
>>>>>>>
>>>>>>> net_interfaces - show me interface configuration per interface
>>>>>>> net_neighbors - shows me Mac address etc for all connected devices
>>>>>>> l2_interfaces - shows me only interface name. *missing switch port
>>>>>>> mode and access vlan*
>>>>>>>
>>>>>>> ----
>>>>>>>
>>>>>>> *Here is the redacted config for the 9300*
>>>>>>>
>>>>>>> Building configuration...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Current configuration : 30751 bytes
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> version 17.3
>>>>>>>
>>>>>>> service tcp-keepalives-in
>>>>>>>
>>>>>>> service timestamps debug datetime msec localtime show-timezone
>>>>>>>
>>>>>>> service timestamps log datetime msec localtime show-timezone
>>>>>>>
>>>>>>> service password-encryption
>>>>>>>
>>>>>>> service compress-config
>>>>>>>
>>>>>>> service call-home
>>>>>>>
>>>>>>> no platform punt-keepalive disable-kernel-core
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> hostname redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> vrf definition Mgmt-vrf
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> address-family ipv4
>>>>>>>
>>>>>>> exit-address-family
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> address-family ipv6
>>>>>>>
>>>>>>> exit-address-family
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> logging discriminator CFGLOG mnemonics drops CFGLOG_LOGGEDCMD
>>>>>>>
>>>>>>> logging buffered discriminator CFGLOG 16384 informational
>>>>>>>
>>>>>>> no logging console
>>>>>>>
>>>>>>> enable secret 9 redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> aaa new-model
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> aaa group server tacacs+ AUTH
>>>>>>>
>>>>>>> server name redacted
>>>>>>>
>>>>>>> server name redacted
>>>>>>>
>>>>>>> ip tacacs source-interface redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> aaa authentication password-prompt "Local Password: "
>>>>>>>
>>>>>>> aaa authentication username-prompt "Local Username: "
>>>>>>>
>>>>>>> aaa authentication login default group AUTH local
>>>>>>>
>>>>>>> aaa authentication enable default group AUTH enable
>>>>>>>
>>>>>>> aaa authorization console
>>>>>>>
>>>>>>> aaa authorization config-commands
>>>>>>>
>>>>>>> aaa authorization exec default group AUTH local
>>>>>>>
>>>>>>> aaa authorization commands 1 default group AUTH if-authenticated
>>>>>>>
>>>>>>> aaa authorization commands 15 default group AUTH if-authenticated
>>>>>>>
>>>>>>> aaa accounting exec default start-stop group AUTH
>>>>>>>
>>>>>>> aaa accounting commands 15 default stop-only group AUTH
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> aaa session-id common
>>>>>>>
>>>>>>> boot system switch all flash:packages.conf
>>>>>>>
>>>>>>> clock timezone CET 1 0
>>>>>>>
>>>>>>> clock summer-time CEST recurring last Sun Mar 2:00 last Sun Oct 3:00
>>>>>>>
>>>>>>> switch 1 provision c9300-24p
>>>>>>>
>>>>>>> switch 2 provision c9300-24p
>>>>>>>
>>>>>>> software auto-upgrade enable
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> no ip domain lookup
>>>>>>>
>>>>>>> ip domain name redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> ip dhcp snooping vlan redacted
>>>>>>>
>>>>>>> no ip dhcp snooping information option
>>>>>>>
>>>>>>> ip dhcp snooping
>>>>>>>
>>>>>>> login on-success log
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> vtp mode off
>>>>>>>
>>>>>>> udld enable
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> no device-tracking logging theft
>>>>>>>
>>>>>>> password encryption aes
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> source template redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> port-channel load-balance src-dst-ip
>>>>>>>
>>>>>>> license boot level network-advantage addon dna-advantage
>>>>>>>
>>>>>>> license smart url cslu redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> diagnostic bootup level complete
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> spanning-tree mode rapid-pvst
>>>>>>>
>>>>>>> spanning-tree portfast bpduguard default
>>>>>>>
>>>>>>> spanning-tree extend system-id
>>>>>>>
>>>>>>> spanning-tree pathcost method long
>>>>>>>
>>>>>>> archive
>>>>>>>
>>>>>>> log config
>>>>>>>
>>>>>>>   logging enable
>>>>>>>
>>>>>>>   notify syslog contenttype plaintext
>>>>>>>
>>>>>>> path redacted
>>>>>>>
>>>>>>> write-memory
>>>>>>>
>>>>>>> memory free low-watermark processor 133138
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> errdisable recovery cause udld
>>>>>>>
>>>>>>> errdisable recovery cause bpduguard
>>>>>>>
>>>>>>> errdisable recovery cause channel-misconfig
>>>>>>>
>>>>>>> errdisable recovery cause link-flap
>>>>>>>
>>>>>>> errdisable recovery cause gbic-invalid
>>>>>>>
>>>>>>> errdisable recovery cause psecure-violation
>>>>>>>
>>>>>>> errdisable recovery cause loopback
>>>>>>>
>>>>>>> errdisable recovery interval 600
>>>>>>>
>>>>>>> username redacted privilege 15 secret 9 redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> redundancy
>>>>>>>
>>>>>>> mode sso
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> transceiver type all
>>>>>>>
>>>>>>> monitoring
>>>>>>>
>>>>>>> hw-switch switch 1 logging onboard message
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> vlan redacted
>>>>>>>
>>>>>>> name redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> vlan redacted
>>>>>>>
>>>>>>> name redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> template redacted
>>>>>>>
>>>>>>> spanning-tree portfast
>>>>>>>
>>>>>>> switchport access vlan redacted
>>>>>>>
>>>>>>> switchport mode access
>>>>>>>
>>>>>>> load-interval 30
>>>>>>>
>>>>>>> description redacted
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> i
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> line con 0
>>>>>>>
>>>>>>> exec-timeout 30 0
>>>>>>>
>>>>>>> logging synchronous
>>>>>>>
>>>>>>> stopbits 1
>>>>>>>
>>>>>>> line vty 0 4
>>>>>>>
>>>>>>> access-class ACL-VTY in
>>>>>>>
>>>>>>> exec-timeout 30 0
>>>>>>>
>>>>>>> logging synchronous
>>>>>>>
>>>>>>> transport input ssh
>>>>>>>
>>>>>>> line vty 5 31
>>>>>>>
>>>>>>> access-class ACL-VTY in
>>>>>>>
>>>>>>> exec-timeout 30 0
>>>>>>>
>>>>>>> logging synchronous
>>>>>>>
>>>>>>> no exec
>>>>>>>
>>>>>>> transport input ssh
>>>>>>>
>>>>>>> !
>>>>>>>
>>>>>>> end
>>>>>>>
>>>>>>>
>>>>>>> Op ma 31 jan. 2022 om 13:36 schreef Sagar Paul <[email protected]>:
>>>>>>>
>>>>>>>> Hi Lucio,
>>>>>>>>
>>>>>>>> Can you please share the config that is not giving facts data?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Sagar Paul
>>>>>>>>
>>>>>>>> On Friday, January 28, 2022 at 10:25:49 PM UTC+5:30
>>>>>>>> [email protected] wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> 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.
>>>>>>>>>
>>>>>>>>> Is this a known issue?
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Lucio Jankok
>>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Ansible Project" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/ansible-project/674592ac-b9c5-4b76-abba-7b3ebb720819n%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/ansible-project/674592ac-b9c5-4b76-abba-7b3ebb720819n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Ansible Project" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>>
>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/ansible-project/3cc4277a-a976-447d-ba2d-255a7cc9525en%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/ansible-project/3cc4277a-a976-447d-ba2d-255a7cc9525en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Ansible Project" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>>
>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/a4aa1ce9-2642-4e80-bd96-cfade4b307aen%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/a4aa1ce9-2642-4e80-bd96-cfade4b307aen%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/3313a5a1-6ca1-423f-819d-7c48b767e4c7n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/3313a5a1-6ca1-423f-819d-7c48b767e4c7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CADFeZ2v3%3DaUEP5r4JVzyXDq211naZd9EZj8byN82RHHnSro%3DWw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CADFeZ2v3%3DaUEP5r4JVzyXDq211naZd9EZj8byN82RHHnSro%3DWw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEs9WgY9HTyrHhhTYJn8GJiB7yb0ypc-Qg8CHPMW9gdvCY2Hcg%40mail.gmail.com.

Reply via email to