CiscoTestAutomation / genieparser

sub-component of Genie that parse the device output into structured datastructure
Apache License 2.0
252 stars 387 forks source link

[IOS-XE] Support of SSID with space #832

Open FlavienJP opened 7 months ago

FlavienJP commented 7 months ago

Hello,

We are using Genie in conjonction with PyATS for testing, but we saw that Genie was unable to work with SSID that is using space within it.

We have made some changes to our local library that has corrected the genie behaviour to support this configuration.

class ShowWlanSummary(ShowWlanSummarySchema):

https://github.com/CiscoTestAutomation/genieparser/blob/89d5b1cab1a0bd6cdedef9b3ab6352b9d1006655/src/genie/libs/parser/iosxe/show_wlan.py#L63

Before : ^(?P<wlan_id>\d+)\s+(?P<profile_name>\S+)\s+(?P<ssid>\S+)\s+(?P<wlan_status>\S+)\s+(?P<status_security>.*$)

After : ^(?P<wlan_id>\d+)\s+(?P<profile_name>\S+)\s+(?P<ssid>.*?)(?:\s{2,})\s+(?P<wlan_status>\S+)\s+(?P<status_security>.*$)

This enhance the SSID support with maxmium 2 following spaces in the title (in my opinion, 1 is enough).

class ShowWlanAllSchema(MetaParser):

https://github.com/CiscoTestAutomation/genieparser/blob/89d5b1cab1a0bd6cdedef9b3ab6352b9d1006655/src/genie/libs/parser/iosxe/show_wlan.py#L140

Before : "radio_policy": str,

After : Optional("radio_policy"): str,

Base on our testings, the radio policy is not visible in the CLI extract when using DNAC, it's preferable to mark it as optional.

class ShowWlanAll(ShowWlanAllSchema):

https://github.com/CiscoTestAutomation/genieparser/blob/89d5b1cab1a0bd6cdedef9b3ab6352b9d1006655/src/genie/libs/parser/iosxe/show_wlan.py#L396

Before : p_name_ssid = re.compile(r"^Network\s+Name\s+\(SSID\)\s+:\s+(?P<value>\S+)$")

After : p_name_ssid = re.compile(r"^Network\s+Name\s+\(SSID\)\s+:\s+(?P<value>.*)$")

Then end of the line is containing the SSID (no more information) so we can add .* to catch everything.

ParimiNeeraja commented 7 months ago

Hello ,

Can you please share me the outputs of two command show wlan summary and show wlan all.

FlavienJP commented 7 months ago

Hello @ParimiNeeraja,

I can first provide you the summary.

raw = device.execute("show wlan summary")
2024-03-26 17:38:20,677: %UNICON-INFO: +++ demowlc with via 'cli': executing command 'show wlan summary' +++
show wlan summary
Number of WLANs: 2
ID   Profile Name                     SSID                             Status Security                                                                                             
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
17   CUST_Global_NF_6f7f68b3     CUST Administrative                     UP     [WPA2][PSK][AES],MAC Filtering                                                                       
18   CUSTC_Global_NF_24c59b82    CUST Factory                 UP     [WPA2][802.1x][AES]                                                                                  
demowlc#

Regards,

Neeraja1bala commented 7 months ago

Thanks for providing output. Can you please provide the output for show wlan all

Neeraja1bala commented 7 months ago

Hello @FlavienJP ,

The above PR got approve from reviewers. Kindly merge the PR.

Neeraja1bala commented 7 months ago

Hello @FlavienJP ,

One reviewer was commented in PR. Please follow up the PR.

Neeraja1bala commented 7 months ago

Hello @FlavienJP ,

PR got merged. Changes will reflected in next version.