6.3.3 テンプレートの編集
(1) テンプレートのコマンド再登録(上書き)
テンプレートに登録済みのコマンドとパラメータまで同じコンフィグレーションコマンドを入力した場合,登録済みのコマンドを上書きします。該当するコマンドの既存の登録順が変更になることもありません。
登録済みのコマンドとパラメータの一部が異なるコンフィグレーションコマンドを入力した場合は,別のコマンドとして登録されます。
入力したコマンドがモード遷移するコマンドの場合は,該当するモードに遷移します。また,モード遷移後に入力したコマンドは,そのモード内の最後に新規コマンドとして登録されます。
モードの遷移を伴うコマンドの再登録例を次の図に示します。
(config-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown speed 1000 no shutdown end-template ! (config-TPL)# (config-TPL)# interface gigabitethernet $PORT <-1 (config-if-TPL)# speed auto <-2 (config-if-TPL)# exit (config-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown speed 1000 no shutdown speed auto <-3 end-template ! (config-TPL)# |
-
テンプレートに登録済みのギガビットイーサネットのインタフェース$PORTにモードを遷移します。
-
テンプレートに登録済みのコマンド(speedコマンド)とパラメータが異なるコンフィグレーションコマンドを入力します。
-
ギガビットイーサネットのインタフェース$PORTの最後に,新規コマンドとして登録されます(登録済みの「speed 1000」に上書きされません)。
(2) テンプレートのコマンド削除
テンプレートに登録済みのコンフィグレーションコマンドを削除する場合はdeleteコマンドを使用します。deleteコマンドの使用例を次の図に示します。
(config-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown speed 1000 no shutdown end-template ! (config-TPL)# (config-TPL)# interface gigabitethernet $PORT <-1 (config-if-TPL)# delete speed 1000 <-2 (config-if-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT <-3 shutdown no shutdown end-template ! (config-if-TPL)# |
-
削除するコマンドのモードに移行します。
-
deleteコマンドを使用して,削除するコマンドを入力します。
-
「speed 1000」が削除されました。
(3) テンプレートのコマンド挿入
テンプレートの任意の位置にコンフィグレーションコマンドを挿入する場合はinsertコマンドを使用します。insertコマンドの使用例を次の図に示します。
(config-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown no shutdown <-1 end-template ! (config-TPL)# (config-TPL)# interface gigabitethernet $PORT <-2 (config-if-TPL)# insert speed 1000 <-3 (config-if-TPL-INS)# no shutdown <-4 (config-if-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown speed 1000 <-5 no shutdown end-template ! (config-if-TPL)# |
-
この位置にコマンドを挿入します。
-
コマンドを挿入するモードに移行します。
-
insertコマンドを使用して,挿入するコマンドを入力します。
-
プロンプトの後ろに「-INS」が付きます。ここで,挿入する位置にある「no shutdown」を入力します。
-
「no shutdown」の前に「speed 1000」が挿入されました。
(4) テンプレートのコマンド修正
テンプレートに登録済みのコンフィグレーションコマンドやパラメータを修正する場合はreplaceコマンドを使用します。replaceコマンドの使用例を次の図に示します。
(config-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown speed 1000 <-1 no shutdown end-template ! (config-TPL)# (config-TPL)# interface gigabitethernet $PORT <-2 (config-if-TPL)# replace speed auto <-3 (config-if-TPL-REP)# speed 1000 <-4 (config-if-TPL)# show template EtherDEF $PORT interface gigabitethernet $PORT shutdown speed auto <-5 no shutdown end-template ! (config-if-TPL)# |
-
speedコマンドのパラメータを1000からautoに変更します。
-
変更するコマンドのモードに移行します。
-
replaceコマンドを使用して,変更後のコマンドを入力します。
-
プロンプトの後ろに「-REP」が付きます。ここで,変更前のコマンドを入力します。
-
パラメータが変更されました。