Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[Junos] "replace pattern" command can create an invalid configuration without displaying any warning or error

0

0

Article ID: KB30332 KB Last Updated: 06 May 2015Version: 1.0
Summary:

This article explains the issue of the addition of an invalid configuration when configuring using the replace pattern command.

Symptoms:

The following example shows where an invalid configuration (1G speed on 10G interface) was committed and no error was observed using the replace pattern command. Initially, the gigabit interface was configured with 1G speed.

lab@R1# show interfaces ge-1/0/8
speed 1g;
unit 0 {
    family inet {
        address 1.1.1.1/30;
    }
}

There is no configuration on the 10G interface:

[edit]
lab@R1# show interfaces xe-0/0/0 

[edit]lab@R1#

Do a replace pattern for ge-1/0/8 to xe-0/0/0:

[edit]
lab@R1# replace pattern ge-1/0/8 with xe-0/0/0 

[edit]
lab@R1# 

[edit]
lab@R1# show interfaces xe-0/0/0 
speed 1g;
unit 0 {
    family inet {
        address 1.1.1.1/30;
    }
}
[edit]
lab@R1# show interfaces ge-1/0/8 

[edit]
lab@R1# show | compare 
[edit interfaces]
+    xe-0/0/0 {
+             speed 1g;
+              unit 0 {
+                      family inet {
+                              address 1.1.1.1/30;
+                      }
+               }
+    }
-     ge-1/0/8 {
-             speed 1g;
-             unit 0 {
-                    family inet {
-                            address 1.1.1.1/30;
-                      }
-               }
-     }

Commit is happening without error:

[edit]
lab@R1# commit 
commit complete

[edit]
lab@R1# show interfaces xe-0/0/0 
speed 1g;
unit 0 {
    family inet {
        address 1.1.1.1/30;
    }
}

The same configuration using the CLI shows a "syntax error," as seen below:

lab@R1# set interfaces xe-0/0/0 speed  
                                     
syntax error.
Cause:

The replace command replaces a particular pattern or string with another pattern in the configuration database. As per the current design, any object value in the database matching the pattern is replaced with user-provided text, similar to text replace. The current design of the replace pattern command does  not validate or substantiate the replaced text against the  "action acceptable" or "match." However, if the same is tried from the CLI, it will fail.

Solution:

User should be cautious when using the replace pattern command due to lack of validation for the changed entries. Users should understand the consequence of change in the text  using replace pattern before using it.
Engineering will enhance this behavior in future releases; as of now, there is no ETA available.

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search