Smarts NCM: How to use space separator for creating a looping compliance audit for multiple sections of a configuration?
search cancel

Smarts NCM: How to use space separator for creating a looping compliance audit for multiple sections of a configuration?

book

Article ID: 345301

calendar_today

Updated On:

Products

VMware

Issue/Introduction

Symptoms:

How to use "space" in the configuration file to do Stanza selection for the regex test in Automation Library.

The below Nexus configuration has a "space" as section separator.

router ospf 123
  router-id 10.255.192.1
  area 0.0.0.0 authentication message-digest
  log-adjacency-changes
  auto-cost reference-bandwidth 100000
router bgp 12345
  router-id 10.255.192.1
  timers bgp 20 60
  log-neighbor-changes
  address-family ipv4 unicast
    network 10.255.128.12/30
    network 10.255.128.16/30
    network 10.255.192.9/32
    network 10.255.192.13/32
    maximum-paths 4
    maximum-paths ibgp 4

Environment

VMware Smart Assurance - NCM

Resolution

The below regex NCM will end the Stanza selection with a line not starting with space:
^[^-\s][a-zA-Z0-9_\s-]+$

Below regex will allow space between string:
^[-_a-zA-Z0-9]+(\s+[-_a-zA-Z0-9]+)*$




Place this regex test under Scope -> Stanza selection -> Beginning with and Ending with section.
Below is example of the regex test results