cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
598
Views
0
Helpful
5
Replies

find devices that don't include a pattern

previousqna
Level 5
Level 5

Hi,

 

 

With the command below I am able to find the devices that include the pub-1AS-gral community-set.

 

Is there a way to identify the devices that DO NOT include that community-set?

 

 

admin@ncs> show configuration devices device * config cisco-ios-xr:community-set | display set | match pub-1AS-gral

 

set devices device GRAFRAAC3 config cisco-ios-xr:community-set pub-1AS-gral set "ios-regex '12956:1001'"

 

set devices device GRAFRAAC3 config cisco-ios-xr:community-set pub-1AS-gral set "ios-regex '12956:2001'"

 

set devices device GRTLONTLW1 config cisco-ios-xr:community-set pub-1AS-gral set 12956:1001

 

set devices device GRTLONTLW1 config cisco-ios-xr:community-set pub-1AS-gral set 12956:2001

 

set devices device GRTLUREM6 config cisco-ios-xr:community-set pub-1AS-gral set "ios-regex '12956:1001'"

 

set devices device GRTLUREM6 config cisco-ios-xr:community-set pub-1AS-gral set "ios-regex '12956:3201'"

 

set devices device GRTMIANA4 config cisco-ios-xr:community-set pub-1AS-gral set 12956:1001

 

set devices device GRTMIANA4 config cisco-ios-xr:community-set pub-1AS-gral set 12956:3001

 

[ok][2017-02-13 18:07:59]

 

admin@ncs>

5 Replies 5

previousqna
Level 5
Level 5

Hi, 

 

Try “show config devices device config cisco-ios-xr:community-set | except pub-1AS-gral”

That command is showing me all the community-set configs except pub-1AS-gral…. But I am trying to identify the list of devices that are missing the pub-1AS-gral in the config.

 

I was trying to use filters using regexp, but I didn’t find the way to do it.

Apologies, accidentally hit send before completing the email..

 

 

That command below will return the community set for all devices where it is set, and it is not “pub-1AS-gral”.

Oh, you are right. The command I sent will return the devices that have a community-set that does not equal pub-1AS-gral. Devices that do not have a community set configured will not be returned.

 

 

To get a list of devices that are missing a particular config, you can create and run a compliance report. Overall steps are as follows:

 

 

  1. Create a device template with the desired config, i.e.:

  set devices template test-fex config nx:fex 101 pinning max-links 1 

  1. Create a compliance report, i.e.:

  set compliance reports report report1 compare-template test-fex 

  1. Add your devices to a device group:

  set devices device-group group1 device-name [ nx0 nx1 nx2 nx3 ] 

  1. Create a report to run with your template on your device group:

  set compliance reports report report1 compare-template test-fex group1 

  1. Commit your changes
  2. Run your report:

   request compliance reports report report1 run outformat text 

  1. NSO will return a URL to a report with the list of devices that do not comply with the template

Thanks


I will try this tomorrow