Skip to content

annotation で Batfish が処理出来なかった部分を把握する

Configuration file annotation によると Batfish は読み込んだコンフィグのうち、理解出来ないものは以下の 3 種類に分類するそうです。

  1. Batfish does not understand the content of the line (unrecognized syntax)
  2. Batfish does not support the feature mentioned in the line
  3. Batfish deems that the line is irrelevant to its network model

「実際に Batfish がコンフィグをどのように処理したか?」は annotation を使うことで確認することが出来ます。 確認結果は以下の 3 パターンに分類されるそうです。

  1. UNRECOGNIZED SYNTAX
  2. PARTIALLY UNSUPPORTED
  3. SILENTLY IGNORED

今回は実際に annotation の動作を試してみます。

annotate には Batfish のソースコードが必要

Batfish は DockerHub で公開されている Docker コンテナイメージを使う方法が一般的だと思います。 しかし、公式ページに以下の記載がある通り、Docker コンテナイメージ版では annotation 機能が利用出来ない為、ソースコードを用意する必要があります。

Using this tool requires building Batfish from source (i.e., not pre-built Docker images).

Batfish のソースコードを用意し、ビルドする方法は Bazelisk で Batfish をソースコードからビルドする に記載してありますので、こちらを参考にソースコードを用意します。

annotation の実行例

annotation を実行する構文は以下の通りです。 Batfish のソースコードが保存されているディレクトリで実行します。 annotation 機能により注釈を付けられたコンフィグは <output dir> ディレクトリに保存されます。 このディレクトリを予め作成しておく必要は無く、自動的に作成されます。

1
bazel run //tools:annotate <input dir> <output dir>

Catalyst 8000V デフォルトコンフィグへの実行

今回は CML 上の Catalyst 8000V デフォルトコンフィグに対して annotation を実行してみました。 CML 上の Catalyst 8000V から取得した show running-config の結果は ~/test/configs/c8kv.txt に保存してあります。 Batfish のソースコードを保存したディレクトリで以下のように実行します。

1
bazel run //tools:annotate ~/test ~/test-out

実行結果は以下の通りです。 ! SILENTLY IGNORED などの注釈が付けられており、「どの部分が Batfish で処理されなかったのか?」が分かります。

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
$ cat ~/test-out/configs/c8kv.txt
!
! Last configuration change at 00:34:33 UTC Tue Dec 13 2022
!
! SILENTLY IGNORED: version 17.9
version 17.9
service timestamps debug datetime msec
service timestamps log datetime msec
! Call-home is enabled by Smart-Licensing.
service call-home
! SILENTLY IGNORED: platform qfp utilization monitor load 80
platform qfp utilization monitor load 80
! SILENTLY IGNORED: platform punt-keepalive disable-kernel-core
platform punt-keepalive disable-kernel-core
! SILENTLY IGNORED: platform console serial
platform console serial
!
hostname inserthostname_here
!
! SILENTLY IGNORED: boot-start-marker
boot-start-marker
! SILENTLY IGNORED: boot-end-marker
boot-end-marker
!
!
no aaa new-model
!
!
!
!
!
!
!
!
!
!
! SILENTLY IGNORED: login on-success log
login on-success log
!
!
!
!
!
!
!
! SILENTLY IGNORED: subscriber templating
subscriber templating
!
! SILENTLY IGNORED: multilink bundle-name authenticated
multilink bundle-name authenticated
!
!
!
crypto pki trustpoint SLA-TrustPoint
! SILENTLY IGNORED: enrollment pkcs12
 enrollment pkcs12
! SILENTLY IGNORED: revocation-check crl
 revocation-check crl
!
!
crypto pki certificate chain SLA-TrustPoint
 certificate ca 01
  30820321 30820209 A0030201 02020101 300D0609 2A864886 F70D0101 0B050030
  32310E30 0C060355 040A1305 43697363 6F312030 1E060355 04031317 43697363
  6F204C69 63656E73 696E6720 526F6F74 20434130 1E170D31 33303533 30313934
  3834375A 170D3338 30353330 31393438 34375A30 32310E30 0C060355 040A1305
  43697363 6F312030 1E060355 04031317 43697363 6F204C69 63656E73 696E6720
  526F6F74 20434130 82012230 0D06092A 864886F7 0D010101 05000382 010F0030
  82010A02 82010100 A6BCBD96 131E05F7 145EA72C 2CD686E6 17222EA1 F1EFF64D
  CBB4C798 212AA147 C655D8D7 9471380D 8711441E 1AAF071A 9CAE6388 8A38E520
  1C394D78 462EF239 C659F715 B98C0A59 5BBB5CBD 0CFEBEA3 700A8BF7 D8F256EE
  4AA4E80D DB6FD1C9 60B1FD18 FFC69C96 6FA68957 A2617DE7 104FDC5F EA2956AC
  7390A3EB 2B5436AD C847A2C5 DAB553EB 69A9A535 58E9F3E3 C0BD23CF 58BD7188
  68E69491 20F320E7 948E71D7 AE3BCC84 F10684C7 4BC8E00F 539BA42B 42C68BB7
  C7479096 B4CB2D62 EA2F505D C7B062A4 6811D95B E8250FC4 5D5D5FB8 8F27D191
  C55F0D76 61F9A4CD 3D992327 A8BB03BD 4E6D7069 7CBADF8B DF5F4368 95135E44
  DFC7C6CF 04DD7FD1 02030100 01A34230 40300E06 03551D0F 0101FF04 04030201
  06300F06 03551D13 0101FF04 05300301 01FF301D 0603551D 0E041604 1449DC85
  4B3D31E5 1B3E6A17 606AF333 3D3B4C73 E8300D06 092A8648 86F70D01 010B0500
  03820101 00507F24 D3932A66 86025D9F E838AE5C 6D4DF6B0 49631C78 240DA905
  604EDCDE FF4FED2B 77FC460E CD636FDB DD44681E 3A5673AB 9093D3B1 6C9E3D8B
  D98987BF E40CBD9E 1AECA0C2 2189BB5C 8FA85686 CD98B646 5575B146 8DFC66A8
  467A3DF4 4D565700 6ADF0F0D CF835015 3C04FF7C 21E878AC 11BA9CD2 55A9232C
  7CA7B7E6 C1AF74F6 152E99B7 B1FCF9BB E973DE7F 5BDDEB86 C71E3B49 1765308B
  5FB0DA06 B92AFE7F 494E8A9E 07B85737 F3A58BE1 1A48A229 C37C1E69 39F08678
  80DDCD16 D6BACECA EEBC7CF9 8428787B 35202CDC 60E4616A B623CDBD 230E3AFB
  418616A9 4093E049 4D10AB75 27E86F73 932E35B5 8862FDAE 0275156F 719BB2F0
  D697DF7F 28
   quit
!
license udi pid C8000V sn 9LK2TN414JV
! SILENTLY IGNORED: diagnostic bootup level minimal
diagnostic bootup level minimal
! SILENTLY IGNORED: memory free low-watermark processor 63718
memory free low-watermark processor 63718
!
!
!
!
!
redundancy
!
!
!
!
!
!
!
!
interface GigabitEthernet1
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet2
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet3
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet4
 no ip address
 shutdown
 negotiation auto
!
! SILENTLY IGNORED: ip forward-protocol nd
ip forward-protocol nd
! SILENTLY IGNORED: no ip http server
no ip http server
! SILENTLY IGNORED: ip http secure-server
ip http secure-server
!
!
!
!
!
!
control-plane
!
!
line con 0
! SILENTLY IGNORED: stopbits 1
 stopbits 1
line aux 0
line vty 0
! SILENTLY IGNORED: login
 length 0
 transport input ssh
 login
 length 0
! UNRECOGNIZED SYNTAX: transport input ssh
 transport input ssh
line vty 1
! SILENTLY IGNORED: login
 transport input ssh
 login
! UNRECOGNIZED SYNTAX: transport input ssh
 transport input ssh
line vty 2
! SILENTLY IGNORED: login
 length 0
 transport input ssh
 login
 length 0
! UNRECOGNIZED SYNTAX: transport input ssh
 transport input ssh
line vty 3 4
! SILENTLY IGNORED: login
 transport input ssh
 login
! UNRECOGNIZED SYNTAX: transport input ssh
 transport input ssh
!
call-home
 ! If contact email address in call-home is configured as sch-smart-licensing@cisco.com
 ! the email address configured in Cisco Smart License Portal will be used as contact email address to send SCH notifications.
! SILENTLY IGNORED: contact-email-addr sch-smart-licensing@cisco.com
 contact-email-addr sch-smart-licensing@cisco.com
 profile "CiscoTAC-1"
! SILENTLY IGNORED: active
  active
! SILENTLY IGNORED: destination transport-method http
  destination transport-method http
!
!
!
!
!
!
! SILENTLY IGNORED: end
end

参考

CML 上の Catalyst 8000V デフォルトコンフィグ

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
!
! Last configuration change at 00:34:33 UTC Tue Dec 13 2022
!
version 17.9
service timestamps debug datetime msec
service timestamps log datetime msec
! Call-home is enabled by Smart-Licensing.
service call-home
platform qfp utilization monitor load 80
platform punt-keepalive disable-kernel-core
platform console serial
!
hostname inserthostname_here
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
!
!
!
!
!
!
!
!
!
login on-success log
!
!
!
!
!
!
!
subscriber templating
!
multilink bundle-name authenticated
!
!
!
crypto pki trustpoint SLA-TrustPoint
 enrollment pkcs12
 revocation-check crl
!
!
crypto pki certificate chain SLA-TrustPoint
 certificate ca 01
  30820321 30820209 A0030201 02020101 300D0609 2A864886 F70D0101 0B050030
  32310E30 0C060355 040A1305 43697363 6F312030 1E060355 04031317 43697363
  6F204C69 63656E73 696E6720 526F6F74 20434130 1E170D31 33303533 30313934
  3834375A 170D3338 30353330 31393438 34375A30 32310E30 0C060355 040A1305
  43697363 6F312030 1E060355 04031317 43697363 6F204C69 63656E73 696E6720
  526F6F74 20434130 82012230 0D06092A 864886F7 0D010101 05000382 010F0030
  82010A02 82010100 A6BCBD96 131E05F7 145EA72C 2CD686E6 17222EA1 F1EFF64D
  CBB4C798 212AA147 C655D8D7 9471380D 8711441E 1AAF071A 9CAE6388 8A38E520
  1C394D78 462EF239 C659F715 B98C0A59 5BBB5CBD 0CFEBEA3 700A8BF7 D8F256EE
  4AA4E80D DB6FD1C9 60B1FD18 FFC69C96 6FA68957 A2617DE7 104FDC5F EA2956AC
  7390A3EB 2B5436AD C847A2C5 DAB553EB 69A9A535 58E9F3E3 C0BD23CF 58BD7188
  68E69491 20F320E7 948E71D7 AE3BCC84 F10684C7 4BC8E00F 539BA42B 42C68BB7
  C7479096 B4CB2D62 EA2F505D C7B062A4 6811D95B E8250FC4 5D5D5FB8 8F27D191
  C55F0D76 61F9A4CD 3D992327 A8BB03BD 4E6D7069 7CBADF8B DF5F4368 95135E44
  DFC7C6CF 04DD7FD1 02030100 01A34230 40300E06 03551D0F 0101FF04 04030201
  06300F06 03551D13 0101FF04 05300301 01FF301D 0603551D 0E041604 1449DC85
  4B3D31E5 1B3E6A17 606AF333 3D3B4C73 E8300D06 092A8648 86F70D01 010B0500
  03820101 00507F24 D3932A66 86025D9F E838AE5C 6D4DF6B0 49631C78 240DA905
  604EDCDE FF4FED2B 77FC460E CD636FDB DD44681E 3A5673AB 9093D3B1 6C9E3D8B
  D98987BF E40CBD9E 1AECA0C2 2189BB5C 8FA85686 CD98B646 5575B146 8DFC66A8
  467A3DF4 4D565700 6ADF0F0D CF835015 3C04FF7C 21E878AC 11BA9CD2 55A9232C
  7CA7B7E6 C1AF74F6 152E99B7 B1FCF9BB E973DE7F 5BDDEB86 C71E3B49 1765308B
  5FB0DA06 B92AFE7F 494E8A9E 07B85737 F3A58BE1 1A48A229 C37C1E69 39F08678
  80DDCD16 D6BACECA EEBC7CF9 8428787B 35202CDC 60E4616A B623CDBD 230E3AFB
  418616A9 4093E049 4D10AB75 27E86F73 932E35B5 8862FDAE 0275156F 719BB2F0
  D697DF7F 28
   quit
!
license udi pid C8000V sn 9LK2TN414JV
diagnostic bootup level minimal
memory free low-watermark processor 63718
!
!
!
!
!
redundancy
!
!
!
!
!
!
!
!
interface GigabitEthernet1
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet2
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet3
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet4
 no ip address
 shutdown
 negotiation auto
!
ip forward-protocol nd
no ip http server
ip http secure-server
!
!
!
!
!
!
control-plane
!
!
line con 0
 stopbits 1
line aux 0
line vty 0
 login
 length 0
 transport input ssh
line vty 1
 login
 transport input ssh
line vty 2
 login
 length 0
 transport input ssh
line vty 3 4
 login
 transport input ssh
!
call-home
 ! If contact email address in call-home is configured as sch-smart-licensing@cisco.com
 ! the email address configured in Cisco Smart License Portal will be used as contact email address to send SCH notifications.
 contact-email-addr sch-smart-licensing@cisco.com
 profile "CiscoTAC-1"
  active
  destination transport-method http
!
!
!
!
!
!
end