キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 
cancel
909
閲覧回数
5
いいね!
0
コメント
Akira Iwamoto
Cisco Employee
Cisco Employee

 

 

はじめに

NSO 4.7.x 以前のNSOにおいて、ルータ・スイッチなどリモート機器のConfigを、NSOへ取り込むためには、

  • 実機から sync-from を行う
  • NETSIM に実機のConfigを入力し、NSOから sync-from を行う
  • エディタなどで、NSOが読み込めるように prefix を付加する

などの対応が必要でした。NSO 5.1 では、直接実機のConfigを入力出来るようになりました。

load-native-config action

NSO 5.1 では、/devices/device/config 配下に、load-native-config action が追加されています。

この Action は、入力された String を NED を介して解釈し、NSOのCDBに格納出来る様に作成します。

従いまして、使用する NED が load-native-config に対応している必要があります。  

使用例

cisco-ios NED を使用し、以下の config を作成してみます。

hostname test-device-1
interface GigabitEthernet 0
 ip address 192.168.1.0 255.255.255.0
 description test-description

 

NSO へこのConfigを直接入力します。

 

admin@ncs(config)# devices device c0 load-native-config data
Value for 'data' ():
[Multiline mode, exit with ctrl-D.]
> hostname test-device-1
> interface GigabitEthernet 0
>  ip address 192.168.1.0 255.255.255.0
>  description test-description
>
admin@ncs(config)#

 

これで、このセッションのトランザクションに、データが入力されました。

以下のように確認出来ます。

 

admin@ncs(config)# show config
devices device c0
 config
  ios:hostname test-device-1
  ios:interface GigabitEthernet0
   description test-description
   ip address 192.168.1.0 255.255.255.0
  exit
 !
!
admin@ncs(config)# commit dry-run
cli {
    local-node {
        data  devices {
                  device c0 {
                      config {
             +            ios:hostname test-device-1;
                          ios:interface {
                              GigabitEthernet 0 {
             +                    description test-description;
                                  ip {
                                      no-address {
             -                            address false;
                                      }
                                      address {
                                          primary {
             +                                address 192.168.1.0;
             +                                mask 255.255.255.0;
                                          }
                                      }
                                  }
                              }
                          }
             +            ios:xxyyzztop 0;
                      }
                  }
              }
    }
}
admin@ncs(config)#

トランザクション内に値が入りますので、あとは他の方法で入力した場合と同様、commit などを行うことが出来ます。

load-native-config action のパラメータ

load-native-config action には、上記例で使った data 以外に以下のようなパラメータが指定出来ます。

 

admin@ncs(config)# devices device c0 load-native-config ?
Possible completions:
  data      Configuration data in native format.
  file      Name of file with configuration data in native format in the local filesystem.
  mode      Merge or replace the configuration.
  verbose   Use this to show additional parse information if supported by the NED.
  
admin@ncs(config)#

data

上記例で使用しましたように、直接 String データを送ります。CLIからの入力時、またユーザが作成するサービスコードからの使用時などに便利です。

file

Configテキストがファイルに格納されている場合、それを読み込むことが出来ます。

ファイル名を渡します。

 

admin@ncs(config)# devices device c0 load-native-config file ?
Description: Name of file with configuration data in native format
in the local filesystem. If the device is remote
the file must exists in the local filesystem of the
remote node.
Possible completions:
  
admin@ncs(config)#

mode

データ読み込み時のモードを設定します。デフォルトは "merge" です。

他に、replace を選択できます。

 

admin@ncs(config)# devices device c0 load-native-config mode ?
Description: Merge or replace the configuration. The default behaviour
is to merge.
Possible completions:
merge Merge with the existing device configuration.
replace Replace the entire device configuration.
admin@ncs(config)#

使用するには、load-native-config action を呼ぶ際、同時にパラメータを設定します。NCS CLI の場合、data よりも先に指定します。

admin@ncs(config)# devices device c0 load-native-config mode replace data
Value for 'data' ():
[Multiline mode, exit with ctrl-D.]
> hostname test-replace
>
admin@ncs(config)# show config
devices device c0
 config
  ios:hostname test-replace
  no ios:aaa accounting delay-start
  ios:ip gratuitous-arps
  no ios:ip finger
  ios:ip http server
  ios:ip http secure-server
  no ios:interface Loopback0
  no ios:interface Ethernet0/0/0
  no ios:interface FastEthernet0
  no ios:interface FastEthernet0/0
  no ios:interface FastEthernet1/0
  no ios:interface FastEthernet1/1
  no ios:interface GigabitEthernet0
  no ios:interface GigabitEthernet0/0
  no ios:interface GigabitEthernet0/1
 !
!
admin@ncs(config)#

replace の場合には、既存のConfigは削除されるため、"no xxx" が設定されことが確認出来ます。

default value が設定されている場合は、default value へ戻ります。

verbose

debug 用途に使用します。NEDが対応している場合は、ConfigのParseの際、ログを出力することが出来ます。

 

 

Getting Started

検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう

シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします