7. 今回の例で利⽤するコマンド結果
7
csr1000v#show ip interface brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet1 10.10.20.48 YES NVRAM up up
GigabitEthernet2 unassigned YES NVRAM administratively down down
GigabitEthernet3 unassigned YES NVRAM administratively down down
Loopback0 unassigned YES unset up up
Loopback1 unassigned YES unset up up
Loopback2 unassigned YES unset up up
l Cisco IOS-XE の show ip interface brief 結果
環境: Cisco DevNet Sandbox CSRV1000V IOS-XE (16.11.01a)
これをパースします
9. TextFSM とは
9
l Python製のパーサー
◦ https://github.com/google/textfsm
l ntc-templates のテンプレートを利⽤可
◦ プラットフォーム数 23
◦ コマンド数 290
◦ https://github.com/networktocode/ntc-templates
l テンプレートは追加、カスタマイズ可能
l pip install textfsm でインストール
(2019/09/03現在)
10. TextFSM で利⽤するテンプレート例
10
Value INTF (¥S+)
Value IPADDR (¥S+)
Value STATUS (up|down|administratively down)
Value PROTO (up|down)
Start
^${INTF}¥s+${IPADDR}¥s+¥w+¥s+¥w+¥s+${STATUS}¥s+${PROTO} -> Record
Cisco IOS の show ip interface brief コマンドのパーステンプレート
https://github.com/networktocode/ntc-templates/blob/master/templates/cisco_ios_show_ip_interface_brief.template
正規表現