go.ligato.io/vpp-agent/v3@v3.5.0/plugins/telemetry/vppcalls/vpp2202/telemetry_vppcalls_test.go (about) 1 // Copyright (c) 2022 Cisco and/or its affiliates. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at: 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package vpp2202_test 16 17 import ( 18 "context" 19 "testing" 20 21 . "github.com/onsi/gomega" 22 23 "go.ligato.io/vpp-agent/v3/plugins/telemetry/vppcalls" 24 "go.ligato.io/vpp-agent/v3/plugins/telemetry/vppcalls/vpp2202" 25 "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2202/vlib" 26 "go.ligato.io/vpp-agent/v3/plugins/vpp/vppmock" 27 ) 28 29 func TestGetBuffers(t *testing.T) { 30 ctx, handler := testSetup(t) 31 defer ctx.TeardownTestCtx() 32 33 const reply = `Pool Name Index NUMA Size Data Size Total Avail Cached Used 34 default-numa-0 0 0 2304 2048 17290 17290 0 0 ` 35 ctx.MockVpp.MockReply(&vlib.CliInbandReply{ 36 Reply: reply, 37 }) 38 39 info, err := handler.GetBuffersInfo(context.TODO()) 40 41 Expect(err).ShouldNot(HaveOccurred()) 42 Expect(info.Items).To(HaveLen(1)) 43 Expect(info.Items[0]).To(Equal(vppcalls.BuffersItem{ 44 //ThreadID: 0, 45 Name: "default-numa-0", 46 Index: 0, 47 Size: 2304, 48 Alloc: 0, 49 Free: 17290, 50 //NumAlloc: 256, 51 //NumFree: 19, 52 })) 53 /*Expect(info.Items[1]).To(Equal(vppcalls.BuffersItem{ 54 ThreadID: 0, 55 Name: "lacp-ethernet", 56 Index: 1, 57 Size: 256, 58 Alloc: 1130000, 59 Free: 27000, 60 NumAlloc: 512, 61 NumFree: 12, 62 })) 63 Expect(info.Items[2]).To(Equal(vppcalls.BuffersItem{ 64 ThreadID: 0, 65 Name: "marker-ethernet", 66 Index: 2, 67 Size: 256, 68 Alloc: 1110000000, 69 Free: 0, 70 NumAlloc: 0, 71 NumFree: 0, 72 }))*/ 73 } 74 75 func TestGetRuntime(t *testing.T) { 76 tests := []struct { 77 name string 78 reply string 79 threadCount int 80 itemCount int 81 itemIdx int 82 item vppcalls.RuntimeItem 83 }{ 84 { 85 name: "19.08", 86 reply: `Time 84714.7, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 87 vector rates in 0.0000e0, out 0.0000e0, drop 0.0000e0, punt 0.0000e0 88 Name State Calls Vectors Suspends Clocks Vectors/Call 89 acl-plugin-fa-cleaner-process event wait 6 5 1 1.10e4 0.00 90 api-rx-from-ring active 0 0 7870 8.63e5 0.00 91 avf-process event wait 0 0 1 4.53e3 0.00 92 bfd-process event wait 0 0 1 7.01e3 0.00 93 bond-process event wait 0 0 1 2.95e3 0.00 94 cdp-process any wait 0 0 1 5.46e3 0.00 95 dhcp-client-process any wait 0 0 847 6.63e3 0.00 96 dhcp6-client-cp-process any wait 0 0 1 1.52e3 0.00 97 dhcp6-pd-client-cp-process any wait 0 0 1 1.71e3 0.00 98 dhcp6-pd-reply-publisher-proce event wait 0 0 1 9.73e2 0.00 99 dhcp6-reply-publisher-process event wait 0 0 1 9.12e2 0.00 100 dns-resolver-process any wait 0 0 85 8.98e3 0.00 101 fib-walk any wait 0 0 42247 1.08e4 0.00 102 flow-report-process any wait 0 0 1 1.33e3 0.00 103 flowprobe-timer-process any wait 0 0 1 5.18e3 0.00 104 gbp-scanner event wait 0 0 1 5.17e3 0.00 105 igmp-timer-process event wait 0 0 1 6.53e3 0.00 106 ikev2-manager-process any wait 0 0 84353 7.84e3 0.00 107 ioam-export-process any wait 0 0 1 1.64e3 0.00 108 ip-neighbor-scan-process any wait 0 0 1412 9.65e3 0.00 109 ip-route-resolver-process any wait 0 0 847 6.12e3 0.00 110 ip4-reassembly-expire-walk any wait 0 0 8464 6.92e3 0.00 111 ip6-icmp-neighbor-discovery-ev any wait 0 0 84353 8.58e3 0.00 112 ip6-reassembly-expire-walk any wait 0 0 8464 6.67e3 0.00 113 l2fib-mac-age-scanner-process event wait 0 0 1 1.98e3 0.00 114 lacp-process event wait 0 0 1 1.58e5 0.00 115 lisp-retry-service any wait 0 0 42247 1.08e4 0.00 116 lldp-process event wait 0 0 1 8.76e4 0.00 117 memif-process event wait 0 0 1 9.34e3 0.00 118 nat-det-expire-walk done 1 0 0 2.92e3 0.00 119 nat-ha-process event wait 0 0 1 4.12e3 0.00 120 nat64-expire-walk event wait 0 0 1 2.41e3 0.00 121 nsh-md2-ioam-export-process any wait 0 0 1 1.10e4 0.00 122 perfmon-periodic-process event wait 0 0 1 3.61e7 0.00 123 rd-cp-process any wait 0 0 1 1.55e3 0.00 124 send-dhcp6-client-message-proc any wait 0 0 1 2.22e3 0.00 125 send-dhcp6-pd-client-message-p any wait 0 0 1 1.43e3 0.00 126 send-rs-process any wait 0 0 1 1.49e3 0.00 127 startup-config-process done 1 0 1 5.68e3 0.00 128 statseg-collector-process time wait 0 0 8464 2.79e5 0.00 129 udp-ping-process any wait 0 0 1 6.96e3 0.00 130 unix-cli-127.0.0.1:mdns done 2 0 4 2.14e9 0.00 131 unix-epoll-input polling 20325059 0 0 1.13e7 0.00 132 vhost-user-process any wait 0 0 1 3.73e3 0.00 133 vhost-user-send-interrupt-proc any wait 0 0 1 1.28e3 0.00 134 vpe-link-state-process event wait 0 0 1 9.63e2 0.00 135 vpe-oam-process any wait 0 0 41419 9.59e3 0.00 136 vxlan-gpe-ioam-export-process any wait 0 0 1 1.60e3 0.00 137 wildcard-ip4-arp-publisher-pro event wait 0 0 1 1.44e3 0.00 138 `, 139 threadCount: 1, 140 itemCount: 49, 141 item: vppcalls.RuntimeItem{ 142 Name: "acl-plugin-fa-cleaner-process", 143 State: "event wait", 144 Calls: 6, 145 Vectors: 5, 146 Suspends: 1, 147 Clocks: 1.10e4, 148 VectorsPerCall: 0, 149 }, 150 }, 151 { 152 name: "one thread", 153 reply: `Time 3151.2, average vectors/node 1.00, last 128 main loops 0.00 per node 0.00 154 vector rates in 2.8561e-3, out 0.0000e0, drop 4.4428e-3, punt 0.0000e0 155 Name State Calls Vectors Suspends Clocks Vectors/Call Perf Ticks 156 acl-plugin-fa-cleaner-process event wait 0 0 1 5.14e3 0.00 157 af-packet-input interrupt wa 9 9 0 1.55e5 1.00 158 api-rx-from-ring any wait 0 0 4735 4.72e6 0.00 159 avf-process event wait 0 0 1 4.52e3 0.00 160 bfd-process event wait 0 0 1 6.59e3 0.00 161 bond-process event wait 0 0 1 2.07e3 0.00 162 cdp-process any wait 0 0 1 4.43e3 0.00 163 dhcp-client-process any wait 0 0 32 8.73e3 0.00 164 dhcp6-client-cp-process any wait 0 0 1 1.94e3 0.00 165 dhcp6-pd-client-cp-process any wait 0 0 1 1.73e3 0.00 166 dhcp6-pd-reply-publisher-proce event wait 0 0 1 1.01e3 0.00 167 dhcp6-reply-publisher-process event wait 0 0 1 8.75e2 0.00 168 dns-resolver-process any wait 0 0 4 2.11e4 0.00 169 error-drop active 14 14 0 1.29e5 1.00 170 ethernet-input active 9 9 0 6.41e5 1.00 171 fib-walk any wait 0 0 1571 2.12e4 0.00 172 flow-report-process any wait 0 0 1 1.13e3 0.00 173 flowprobe-timer-process any wait 0 0 1 5.27e3 0.00 174 gbp-scanner event wait 0 0 1 5.36e3 0.00 175 igmp-timer-process event wait 0 0 1 5.24e4 0.00 176 ikev2-manager-process any wait 0 0 3132 1.32e4 0.00 177 ioam-export-process any wait 0 0 1 1.18e3 0.00 178 ip-neighbor-scan-process any wait 0 0 53 1.49e4 0.00 179 ip-route-resolver-process any wait 0 0 32 5.80e3 0.00 180 ip4-drop active 5 5 0 3.13e3 1.00 181 ip4-local active 5 5 0 1.00e4 1.00 182 ip4-lookup active 5 5 0 1.08e6 1.00 183 ip4-reassembly-expire-walk any wait 0 0 315 1.27e4 0.00 184 ip6-icmp-neighbor-discovery-ev any wait 0 0 3132 1.12e4 0.00 185 ip6-input active 9 9 0 3.41e3 1.00 186 ip6-not-enabled active 9 9 0 1.47e3 1.00 187 ip6-reassembly-expire-walk any wait 0 0 315 8.52e3 0.00 188 l2fib-mac-age-scanner-process event wait 0 0 1 1.18e3 0.00 189 lacp-process event wait 0 0 1 1.84e5 0.00 190 lisp-retry-service any wait 0 0 1571 1.49e4 0.00 191 lldp-process event wait 0 0 1 5.81e5 0.00 192 memif-process any wait 0 0 1168 1.11e5 0.00 193 nat-det-expire-walk done 1 0 0 2.50e3 0.00 194 nat64-expire-walk event wait 0 0 1 1.34e4 0.00 195 nsh-md2-ioam-export-process any wait 0 0 1 7.89e3 0.00 196 perfmon-periodic-process event wait 0 0 1 1.18e8 0.00 197 rd-cp-process any wait 0 0 1 1.52e3 0.00 198 send-dhcp6-client-message-proc any wait 0 0 1 1.56e3 0.00 199 send-dhcp6-pd-client-message-p any wait 0 0 1 1.53e3 0.00 200 send-rs-process any wait 0 0 1 1.69e3 0.00 201 startup-config-process done 1 0 1 6.13e3 0.00 202 statseg-collector-process time wait 0 0 315 3.77e5 0.00 203 udp-ping-process any wait 0 0 1 1.62e4 0.00 204 unix-cli-127.0.0.1:39670 event wait 0 0 103 2.26e7 0.00 205 unix-cli-127.0.0.1:40652 active 1 0 3 4.64e9 0.00 206 unix-epoll-input polling 1698354 0 0 5.00e6 0.00 207 vhost-user-process any wait 0 0 1 5.29e3 0.00 208 vhost-user-send-interrupt-proc any wait 0 0 1 1.88e3 0.00 209 vpe-link-state-process event wait 0 0 15 2.33e4 0.00 210 vpe-oam-process any wait 0 0 1540 1.21e4 0.00 211 vxlan-gpe-ioam-export-process any wait 0 0 1 1.38e3 0.00 212 wildcard-ip4-arp-publisher-pro event wait 0 0 1 2.24e3 0.00 213 `, 214 threadCount: 1, 215 itemCount: 57, 216 itemIdx: 1, 217 item: vppcalls.RuntimeItem{ 218 Name: "af-packet-input", 219 State: "interrupt wa", 220 Calls: 9, 221 Vectors: 9, 222 Suspends: 0, 223 Clocks: 1.55e5, 224 VectorsPerCall: 1, 225 }, 226 }, 227 { 228 name: "three threads", 229 reply: `Thread 0 vpp_main (lcore 0) 230 Time 21.5, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 231 vector rates in 0.0000e0, out 5.0000e-2, drop 0.0000e0, punt 0.0000e0 232 Name State Calls Vectors Suspends Clocks Vectors/Call 233 acl-plugin-fa-cleaner-process event wait 6 5 1 3.12e4 0.00 234 api-rx-from-ring any wait 0 0 31 8.61e6 0.00 235 avf-process event wait 0 0 1 7.79e3 0.00 236 bfd-process event wait 0 0 1 6.80e3 0.00 237 cdp-process any wait 0 0 1 1.78e8 0.00 238 dhcp-client-process any wait 0 0 1 2.59e3 0.00 239 dns-resolver-process any wait 0 0 1 3.35e3 0.00 240 fib-walk any wait 0 0 11 1.08e4 0.00 241 flow-report-process any wait 0 0 1 1.64e3 0.00 242 flowprobe-timer-process any wait 0 0 1 1.16e4 0.00 243 igmp-timer-process event wait 0 0 1 1.81e4 0.00 244 ikev2-manager-process any wait 0 0 22 5.47e3 0.00 245 ioam-export-process any wait 0 0 1 3.26e3 0.00 246 ip-route-resolver-process any wait 0 0 1 1.69e3 0.00 247 ip4-reassembly-expire-walk any wait 0 0 3 4.27e3 0.00 248 ip6-icmp-neighbor-discovery-ev any wait 0 0 22 4.48e3 0.00 249 ip6-reassembly-expire-walk any wait 0 0 3 6.88e3 0.00 250 l2fib-mac-age-scanner-process event wait 0 0 1 3.94e3 0.00 251 lacp-process event wait 0 0 1 1.35e8 0.00 252 lisp-retry-service any wait 0 0 11 9.68e3 0.00 253 lldp-process event wait 0 0 1 1.49e8 0.00 254 memif-process event wait 0 0 1 2.67e4 0.00 255 nat-det-expire-walk done 1 0 0 5.42e3 0.00 256 nat64-expire-walk event wait 0 0 1 5.87e4 0.00 257 rd-cp-process any wait 0 0 614363 3.93e2 0.00 258 send-rs-process any wait 0 0 1 3.22e3 0.00 259 startup-config-process done 1 0 1 1.33e4 0.00 260 udp-ping-process any wait 0 0 1 3.69e4 0.00 261 unix-cli-127.0.0.1:38448 active 0 0 23 6.72e7 0.00 262 unix-epoll-input polling 8550283 0 0 3.77e3 0.00 263 vhost-user-process any wait 0 0 1 2.48e3 0.00 264 vhost-user-send-interrupt-proc any wait 0 0 1 1.43e3 0.00 265 vpe-link-state-process event wait 0 0 1 1.58e3 0.00 266 vpe-oam-process any wait 0 0 11 9.20e3 0.00 267 vxlan-gpe-ioam-export-process any wait 0 0 1 1.59e4 0.00 268 wildcard-ip4-arp-publisher-pro event wait 0 0 1 1.03e4 0.00 269 --------------- 270 Thread 1 vpp_wk_0 (lcore 1) 271 Time 21.5, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 272 vector rates in 0.0000e0, out 0.0000e0, drop 0.0000e0, punt 0.0000e0 273 Name State Calls Vectors Suspends Clocks Vectors/Call 274 unix-epoll-input polling 15251181 0 0 3.67e3 0.00 275 --------------- 276 Thread 2 vpp_wk_1 (lcore 2) 277 Time 21.5, average vectors/node 0.00, last 128 main loops 0.00 per node 0.00 278 vector rates in 0.0000e0, out 0.0000e0, drop 0.0000e0, punt 0.0000e0 279 Name State Calls Vectors Suspends Clocks Vectors/Call 280 unix-epoll-input polling 20563870 0 0 3.56e3 0.00 281 `, 282 threadCount: 3, 283 itemCount: 36, 284 item: vppcalls.RuntimeItem{ 285 Name: "acl-plugin-fa-cleaner-process", 286 State: "event wait", 287 Calls: 6, 288 Vectors: 5, 289 Suspends: 1, 290 Clocks: 3.12e4, 291 VectorsPerCall: 0, 292 }, 293 }, 294 } 295 for _, test := range tests { 296 t.Run(test.name, func(t *testing.T) { 297 ctx, handler := testSetup(t) 298 defer ctx.TeardownTestCtx() 299 300 ctx.MockVpp.MockReply(&vlib.CliInbandReply{Reply: test.reply}) 301 302 info, err := handler.GetRuntimeInfo(context.TODO()) 303 304 Expect(err).ShouldNot(HaveOccurred()) 305 Expect(len(info.Threads)).To(Equal(test.threadCount)) 306 Expect(info.Threads[0].Items).To(HaveLen(test.itemCount)) 307 Expect(info.Threads[0].Items[test.itemIdx]).To(Equal(test.item)) 308 }) 309 } 310 } 311 312 func TestGetMemory(t *testing.T) { 313 tests := []struct { 314 name string 315 reply string 316 threadCount int 317 threadIdx int 318 thread vppcalls.MemoryThread 319 }{ 320 { 321 name: "single", 322 reply: `Thread 0 vpp_main 323 base 0x7f74752f2000, size 1g, locked, unmap-on-destroy, name 'main heap' 324 page stats: page-size 4K, total 262144, mapped 14970, not-mapped 247174 325 numa 0: 14970 pages, 58.48m bytes 326 total: 1023.99M, used: 55.46M, free: 968.54M, trimmable: 968.53M 327 free chunks 310 free fastbin blks 0 328 max total allocated 1023.99M 329 `, 330 threadCount: 1, 331 threadIdx: 0, 332 thread: vppcalls.MemoryThread{ 333 ID: 0, 334 Name: "vpp_main", 335 Size: 1e9, 336 Pages: 262144, 337 PageSize: 4000, 338 Used: 55.46e6, 339 Total: 1023.99e6, 340 Free: 968.54e6, 341 Trimmable: 968.53e6, 342 FreeChunks: 310, 343 FreeFastbinBlks: 0, 344 MaxTotalAlloc: 1023.99e6, 345 }, 346 }, 347 { 348 name: "unknown", 349 reply: `Thread 0 vpp_main 350 base 0x7ff4bf55f000, size 1g, locked, unmap-on-destroy, name 'main heap' 351 page stats: page-size 4K, total 262144, mapped 14945, not-mapped 247174, unknown 25 352 numa 0: 14945 pages, 58.38m bytes 353 total: 1023.99M, used: 55.46M, free: 968.54M, trimmable: 968.53M 354 free chunks 303 free fastbin blks 0 355 max total allocated 1023.99M 356 `, 357 threadCount: 1, 358 threadIdx: 0, 359 thread: vppcalls.MemoryThread{ 360 ID: 0, 361 Name: "vpp_main", 362 Size: 1e9, 363 Pages: 262144, 364 PageSize: 4000, 365 Used: 55.46e6, 366 Total: 1023.99e6, 367 Free: 968.54e6, 368 Trimmable: 968.53e6, 369 FreeChunks: 303, 370 FreeFastbinBlks: 0, 371 MaxTotalAlloc: 1023.99e6, 372 }, 373 }, 374 { 375 name: "3 workers", 376 reply: `Thread 0 vpp_main 377 base 0x7f0f14823000, size 1g, locked, unmap-on-destroy, name 'main heap' 378 page stats: page-size 4K, total 262144, mapped 19483, not-mapped 242661 379 numa 0: 19483 pages, 76.11m bytes 380 total: 1023.99M, used: 72.26M, free: 951.74M, trimmable: 950.90M 381 free chunks 298 free fastbin blks 0 382 max total allocated 1023.99M 383 384 Thread 1 vpp_wk_0 385 base 0x7f0f14823000, size 1g, locked, unmap-on-destroy, name 'main heap' 386 page stats: page-size 4K, total 262144, mapped 19483, not-mapped 242661 387 numa 0: 19483 pages, 76.11m bytes 388 total: 1023.99M, used: 72.26M, free: 951.74M, trimmable: 950.90M 389 free chunks 299 free fastbin blks 0 390 max total allocated 1023.99M 391 392 Thread 2 vpp_wk_1 393 base 0x7f0f14823000, size 1g, locked, unmap-on-destroy, name 'main heap' 394 page stats: page-size 4K, total 262144, mapped 19483, not-mapped 242661 395 numa 0: 19483 pages, 76.11m bytes 396 total: 1023.99M, used: 72.26M, free: 951.74M, trimmable: 950.90M 397 free chunks 299 free fastbin blks 0 398 max total allocated 1023.99M 399 400 Thread 3 vpp_wk_2 401 base 0x7f0f14823000, size 1g, locked, unmap-on-destroy, name 'main heap' 402 page stats: page-size 4K, total 262144, mapped 19483, not-mapped 242661 403 numa 0: 19483 pages, 76.11m bytes 404 total: 1023.99M, used: 72.26M, free: 951.74M, trimmable: 950.90M 405 free chunks 299 free fastbin blks 0 406 max total allocated 1023.99M 407 `, 408 threadCount: 4, 409 threadIdx: 1, 410 thread: vppcalls.MemoryThread{ 411 ID: 1, 412 Name: "vpp_wk_0", 413 Size: 1.e9, 414 Pages: 262144, 415 PageSize: 4000, 416 Used: 72.26e6, 417 Total: 1023.99e6, 418 Free: 951.74e6, 419 Trimmable: 950.90e6, 420 FreeChunks: 299, 421 FreeFastbinBlks: 0, 422 MaxTotalAlloc: 1023.99e6, 423 }, 424 }, 425 // "19.08 update" test case tests for "page information not available" error. 426 // It contains reply from VPP version 20.09. The format of replies changed 427 // since VPP version 21.01, so the test case should be updated accordingly. 428 // 429 // { 430 // name: "19.08 update", 431 // // reply: `Thread 0 vpp_main 432 // // virtual memory start 0x7fc363c20000, size 1048640k, 262160 pages, page size 4k 433 // // page information not available (errno 1) 434 // // total: 1.00G, used: 56.78M, free: 967.29M, trimmable: 966.64M 435 // // free chunks 337 free fastbin blks 0 436 // // max total allocated 1.00G 437 // //`, 438 // threadCount: 1, 439 // threadIdx: 0, 440 // thread: vppcalls.MemoryThread{ 441 // ID: 0, 442 // Name: "vpp_main", 443 // Size: 1048.64e6, 444 // Pages: 262160, 445 // PageSize: 4000, 446 // Used: 56.78e6, 447 // Total: 1e9, 448 // Free: 967.29e6, 449 // Trimmable: 966.64e6, 450 // FreeChunks: 337, 451 // FreeFastbinBlks: 0, 452 // MaxTotalAlloc: 1e9, 453 // }, 454 // }, 455 } 456 for _, test := range tests { 457 t.Run(test.name, func(t *testing.T) { 458 ctx, handler := testSetup(t) 459 defer ctx.TeardownTestCtx() 460 461 ctx.MockVpp.MockReply(&vlib.CliInbandReply{Reply: test.reply}) 462 463 info, err := handler.GetMemory(context.TODO()) 464 465 Expect(err).ShouldNot(HaveOccurred()) 466 Expect(info.Threads).To(HaveLen(test.threadCount)) 467 Expect(info.Threads[test.threadIdx]).To(Equal(test.thread)) 468 }) 469 } 470 } 471 472 func TestGetNodeCounters(t *testing.T) { 473 ctx, handler := testSetup(t) 474 defer ctx.TeardownTestCtx() 475 476 const reply = ` Count Node Reason 477 32 ipsec-output-ip4 IPSec policy protect 478 32 esp-encrypt ESP pkts received 479 64 ipsec-input-ip4 IPSEC pkts received 480 32 ip4-icmp-input unknown type 481 32 ip4-icmp-input echo replies sent 482 14 ethernet-input l3 mac mismatch 483 1 arp-input ARP replies sent 484 4 ip4-input ip4 spoofed local-address packet drops 485 2 memif1/1-output interface is down 486 1 cdp-input good cdp packets (processed) 487 ` 488 ctx.MockVpp.MockReply(&vlib.CliInbandReply{ 489 Reply: reply, 490 }) 491 492 info, err := handler.GetNodeCounters(context.TODO()) 493 494 Expect(err).ShouldNot(HaveOccurred()) 495 Expect(info.Counters).To(HaveLen(10)) 496 Expect(info.Counters[0]).To(Equal(vppcalls.NodeCounter{ 497 Value: 32, 498 Node: "ipsec-output-ip4", 499 Name: "IPSec policy protect", 500 })) 501 Expect(info.Counters[6]).To(Equal(vppcalls.NodeCounter{ 502 Value: 1, 503 Node: "arp-input", 504 Name: "ARP replies sent", 505 })) 506 Expect(info.Counters[7]).To(Equal(vppcalls.NodeCounter{ 507 Value: 4, 508 Node: "ip4-input", 509 Name: "ip4 spoofed local-address packet drops", 510 })) 511 Expect(info.Counters[8]).To(Equal(vppcalls.NodeCounter{ 512 Value: 2, 513 Node: "memif1/1-output", 514 Name: "interface is down", 515 })) 516 Expect(info.Counters[9]).To(Equal(vppcalls.NodeCounter{ 517 Value: 1, 518 Node: "cdp-input", 519 Name: "good cdp packets (processed)", 520 })) 521 } 522 523 func testSetup(t *testing.T) (*vppmock.TestCtx, vppcalls.TelemetryVppAPI) { 524 ctx := vppmock.SetupTestCtx(t) 525 handler := vpp2202.NewTelemetryVppHandler(ctx.MockVPPClient) 526 return ctx, handler 527 }