JUNOS ANNOTATE

A great way to add your own comments to any part of a Junos config.

Let say we have this DHCP config...


services {
        ssh;
        telnet;
        xnm-clear-text;
        web-management {
            http {
                interface vlan.7;
            }
            https {
                system-generated-certificate;
                interface vlan.7;
            }
        }
        dhcp {
            pool 10.1.1.0/24 {
                address-range low 10.1.1.101 high 10.1.1.254;
                default-lease-time 86400;
                domain-name company.com;
                router {
                    10.1.1.1;
                }
            }


And we wish to place some kind of comment on the DHCP pool as there is no description statement associated with DHCP.

1) GO INTO EDIT MODE

2) USE THE ANNOTATE COMMAND


blogger@LEFTY# annotate system ?
Possible completions:
  <string>             String argument
[edit]
blogger@LEFTY#           

Note you cant write the whole path into the command. Doesn't give you the choice.
You have to be at the correct spot in the edit path.


The correct spot is to be just above where you what you wish to annotate is and to understand that the annotated comment sits right above the section you want to annotate.
I.e If you want to annotate the pool you need to be at the DHCP level at the edit prompt.

[edit system services dhcp]
blogger@LEFTY# annotate pool 10.1.1.0/24 "THIS IS THE COMMENT"

[edit system services dhcp]

blogger@LEFTY# commit
commit complete

[edit system services dhcp]


End result...

services {
        ssh;
        telnet;
        xnm-clear-text;
        web-management {
            http {
                interface vlan.7;
            }
            https {
                system-generated-certificate;
                interface vlan.7;
            }
        }
        dhcp {
            /* THIS IS THE COMMENT */
            pool 10.1.1.0/24 {
                address-range low 10.1.1.101 high 10.1.1.254;
                default-lease-time 86400;
                domain-name company.com;
                router {
                    10.1.1.1;
                }
            }


Note: The system places the delimeters in itself and if the comment has spaces enter it in within double quotes as per a lot of other Junos config elements.

 3) REMOVE THE ANNOTATE

You go to the same spot in the hierarchy as where you put it in to take it out. 

[edit system services dhcp]
blogger@LEFTY# annotate pool 10.1.1.0/24 ""                 

[edit system services dhcp]


Use "" to remove it.

Enjoy!
   

1 comment:

  1. Thank you, I was trying to issue the delete annotate only to find out that the command is not there. :)

    ReplyDelete