Skip to main content
Question

NQE for confirming configuration within Cisco switch interfaces

  • November 29, 2023
  • 4 replies
  • 187 views

Forum|alt.badge.img

Hi!  Looking for help with an NQE to scan/identify configuration for all Cisco switches within a workspace that contain one of two QOS policy maps within at least one of the device interfaces.

 

For example 

interface gigabitethernet1/1

 service-policy output 1P7Q3T 

or

service-policy output 1P7Q1T

 

Thanks        

4 replies

Forum|alt.badge.img+1
  • Employee
  • 55 replies
  • November 29, 2023

@rrogers33 You can leverage blockMatches Try the following test.

test =

"""
interface TenGigabitEthernet1/0/2
 description foo
 switchport access vlan 17
 switchport mode access
 no logging event link-status
 no cdp enable
 udld port disable
 no snmp trap link-status
 storm-control broadcast level bps 50m
 storm-control multicast level bps 50m
 spanning-tree bpduguard enable
 service-policy output 1P7Q3T 


interface TenGigabitEthernet1/0/3
 description foo
 switchport access vlan 17
 switchport mode access
 no logging event link-status
 no cdp enable
 udld port disable
 no snmp trap link-status
 storm-control broadcast level bps 50m
 storm-control multicast level bps 50m
 spanning-tree bpduguard enable
 service-policy output 1P7Q1T 
""";


pattern = ```
interface {intf: string}
 service-policy output {policy: string} 
```;


foreach x in [0]
let config = parseConfigBlocks(OS.UNKNOWN, test)
let matches = blockMatches(config, pattern)
foreach match in matches
let violation = match.data.policy not in ["1P7Q3T", "1P7Q1T"]
select {violation, intf: match.data.intf, policy: match.data.policy}

 


Andreas
Employee
  • Employee
  • 23 replies
  • November 29, 2023

Another option (available since 23.11), in case you are looking to run some ad-hoc searches (as opposed to having a saved query that you can use as a Verification or in Inventory+), is to use our “Config Search” parameterized query in the Forward Library. You can just open this query, set the config pattern you are looking for, and then run the query.  

The query is “Forward Library/Devices/Config Search” (you can also search for it). Open the query, click the “Parameters” button, and then enter the config pattern you like. You can also specify OSes and device name globs in case you want to narrow down the search. See the screenshot below for the example with a pattern that is close to what you are looking for:

 

 


Forum|alt.badge.img
  • Author
  • Ramping Up
  • 1 reply
  • November 30, 2023

Thank you very much for the responses.  @GaryB, I will play around with that query.  @Andreas Unfortunately for the “Config Search” I am not finding that as an option in our NQE Library.  Perhaps we are at an older code.


Forum|alt.badge.img+1
  • Employee
  • 55 replies
  • November 30, 2023

@rrogers33 Yes you will need 23.11 for the new “Edit Parameterized Query” feature in NQE


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings