Maintenance is complete- We've moved from the saas.hpe.com domain to softwaregrp.com click to read more
As part of our journey to complete our separation work and our future integration with Micro Focus, we've now updated our domain for the community. This is an interim step, which will be followed by a series of future update / improvements: - Piloting Idea boards - Refreshing the entire UI. (more to come later) - and more
Network Automation Practitioners Forum
cancel

Configuration Policy "Define Text Block" => does it understand REGEX ?

jvanhambelgium
Frequent Visitor.

Configuration Policy "Define Text Block" => does it understand REGEX ?

Hi,

The manual is not 100% clear on this. Can I use full regex-function in the section "define text block" (eg. for interfaces)

Let me explain my usecase :

Suppose worldwide all firewalls have a description-field SITEIDCODE-FW01-MGMT

So only the "-FW01-MGMT" field is fixed, while the first part is site-dependant.

Such interface would have specific settings that I want to chekc, so I was thinking about :

Block Start Pattern
-----------------------

^interface GigabitEthernet.*
description [A-Z]{1,10}-FW01-MGMT

 

Block End Pattern
---------------------
!

I have the impression this simply does not work ?! Or am I hitting a bug ?
Yet you can use something like "interface.*" in the the block-start-pattern so this is Regex too soo....

Anyone has working complex regex in these blocks?

1 REPLY
Huy_V
Super Contributor.

Re: Configuration Policy "Define Text Block" => does it understand REGEX ?

Try:

Block start, yes it can use RegEx:

^interface GigabitEthernet.*   <-- Only need one line

Block end:

!

Condition:

A x     x Reguar Expression

Config Block     must contain

description [A-Z]{1,10}-FW01-MGMT

You can test "Test Policy Compliance" and check on "Test policy against text" and enter the text in the box instead of testing on an actual device.

Hope this helps,