Document toolboxDocument toolbox

Configuration Block Check Nesting

Configuration block checks support nesting. The ConfigBlockCheck has children statements, which include the possibility of other ConfigBlockCheck elements. Looking at the previous example of configuration text for the indent boundary method (see Boundary Type: Indent method), you can extend the example to process the "address-family" blocks within each VRF:

<ConfigBlockCheck boundary-method="indent" block-start="^vrf definition">

 <!-- Figure out which RD this is -->

 <Expr op="matches"><Expr variable="_block"/><Expr value="^\s*rd (.*)"/></Expr>

 <Assign variable="rd"><Expr variable="_match_1"/></Assign>

 <!--Here is the nested block check --!>

  <ConfigBlockCheck boundary-method="regexp" block-start="^\s*address-family

  (ipv[46])" block-end="^\s*exit-address-family">

  <!-- statements that may do something (say, a list lookup), based on RD and address

  family IP version -->

  </ConfigBlockCheck>

 <!-- note that the _block variable is scoped - so at this point it is back to the "vrf

 definition" block, even though within the ConfigBlockCheck statement above, _block

 referred to the address-family block -->

</ConfigBlockCheck>