go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/ifplugin/vppcalls/vpp2101/dump_interface_vppcalls_test.go (about) 1 // Copyright (c) 2019 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 vpp2101_test 16 17 import ( 18 "net" 19 "testing" 20 21 . "github.com/onsi/gomega" 22 govppapi "go.fd.io/govpp/api" 23 24 vpp_dhcp "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/dhcp" 25 vpp_gtpu "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/gtpu" 26 vpp_interfaces "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/interface" 27 "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/interface_types" 28 vpp_ip "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/ip" 29 "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/ip_types" 30 vpp_ipip "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/ipip" 31 vpp_memif "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/memif" 32 vpp_tapv2 "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/tapv2" 33 vpp_vpe "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/vpe" 34 vpp_vxlan "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/vxlan" 35 vpp_vxlangpe "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/vxlan_gpe" 36 vpp2101 "go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin/vppcalls/vpp2101" 37 "go.ligato.io/vpp-agent/v3/plugins/vpp/vppmock" 38 ifs "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/interfaces" 39 ) 40 41 // Test dump of interfaces with vxlan type 42 func TestDumpInterfacesVxLan(t *testing.T) { 43 ctx, ifHandler := ifTestSetup(t) 44 defer ctx.TeardownTestCtx() 45 46 ipv61Parse := net.ParseIP("dead:beef:feed:face:cafe:babe:baad:c0de").To16() 47 ipv62Parse := net.ParseIP("d3ad:beef:feed:face:cafe:babe:baad:c0de").To16() 48 49 ctx.MockReplies([]*vppmock.HandleReplies{ 50 { 51 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 52 Ping: true, 53 Message: &vpp_interfaces.SwInterfaceDetails{ 54 InterfaceName: "vxlan1", 55 }, 56 }, 57 { 58 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 59 Ping: false, 60 Message: &vpp_interfaces.SwInterfaceGetTableReply{}, 61 }, 62 { 63 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 64 Ping: true, 65 Message: &vpp_ip.IPAddressDetails{}, 66 }, 67 { 68 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 69 Ping: true, 70 }, 71 { 72 Name: (&vpp_memif.MemifDump{}).GetMessageName(), 73 Ping: true, 74 }, 75 { 76 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 77 Ping: true, 78 }, 79 { 80 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 81 Ping: true, 82 Message: &vpp_vxlan.VxlanTunnelDetails{ 83 SwIfIndex: 0, 84 SrcAddress: ipToAddr(ipv61Parse.String()), 85 DstAddress: ipToAddr(ipv62Parse.String()), 86 }, 87 }, 88 { 89 Name: (&vpp_vxlangpe.VxlanGpeTunnelDump{}).GetMessageName(), 90 Ping: true, 91 }, 92 { 93 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 94 Ping: true, 95 }, 96 { 97 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 98 Ping: true, 99 }, 100 { 101 Name: (&vpp_ip.IPUnnumberedDump{}).GetMessageName(), 102 Ping: true, 103 }, 104 { 105 Name: (&vpp_dhcp.DHCPClientDump{}).GetMessageName(), 106 Ping: true, 107 }, 108 }) 109 110 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 111 Expect(err).To(BeNil()) 112 Expect(intfs).To(HaveLen(1)) 113 intface := intfs[0].Interface 114 115 // Check vxlan 116 Expect(intface.GetVxlan().SrcAddress).To(Equal("dead:beef:feed:face:cafe:babe:baad:c0de")) 117 Expect(intface.GetVxlan().DstAddress).To(Equal("d3ad:beef:feed:face:cafe:babe:baad:c0de")) 118 } 119 120 // Test dump of interfaces with host type 121 func TestDumpInterfacesHost(t *testing.T) { 122 ctx, ifHandler := ifTestSetup(t) 123 defer ctx.TeardownTestCtx() 124 125 ctx.MockReplies([]*vppmock.HandleReplies{ 126 { 127 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 128 Ping: true, 129 Message: &vpp_interfaces.SwInterfaceDetails{ 130 InterfaceName: "host-localhost", 131 }, 132 }, 133 { 134 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 135 Ping: false, 136 Message: &vpp_interfaces.SwInterfaceGetTableReply{}, 137 }, 138 { 139 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 140 Ping: true, 141 Message: &vpp_ip.IPAddressDetails{}, 142 }, 143 { 144 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 145 Ping: true, 146 }, 147 { 148 Name: (&vpp_memif.MemifDump{}).GetMessageName(), 149 Ping: true, 150 }, 151 { 152 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 153 Ping: true, 154 }, 155 { 156 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 157 Ping: true, 158 }, 159 { 160 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 161 Ping: true, 162 }, 163 { 164 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 165 Ping: true, 166 }, 167 { 168 Name: (&vpp_dhcp.DHCPClientDump{}).GetMessageName(), 169 Ping: true, 170 }, 171 { 172 Name: (&vpp_ip.IPUnnumberedDump{}).GetMessageName(), 173 Ping: true, 174 }, 175 { 176 Name: (&vpp_vxlangpe.VxlanGpeTunnelDump{}).GetMessageName(), 177 Ping: true, 178 }, 179 }) 180 181 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 182 Expect(err).To(BeNil()) 183 Expect(intfs).To(HaveLen(1)) 184 intface := intfs[0].Interface 185 186 // Check interface data 187 Expect(intface.GetAfpacket().HostIfName).To(Equal("localhost")) 188 } 189 190 // Test dump of interfaces with memif type 191 func TestDumpInterfacesMemif(t *testing.T) { 192 ctx, ifHandler := ifTestSetup(t) 193 defer ctx.TeardownTestCtx() 194 195 ctx.MockReplies([]*vppmock.HandleReplies{ 196 { 197 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 198 Ping: true, 199 Message: &vpp_interfaces.SwInterfaceDetails{ 200 InterfaceName: "memif1", 201 }, 202 }, 203 { 204 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 205 Ping: false, 206 Message: &vpp_interfaces.SwInterfaceGetTableReply{}, 207 }, 208 { 209 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 210 Ping: true, 211 Message: &vpp_ip.IPAddressDetails{}, 212 }, 213 { 214 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 215 Ping: true, 216 Message: &vpp_memif.MemifSocketFilenameDetails{ 217 SocketID: 1, 218 SocketFilename: "test", 219 }, 220 }, 221 { 222 Name: (&vpp_memif.MemifDump{}).GetMessageName(), 223 Ping: true, 224 Message: &vpp_memif.MemifDetails{ 225 ID: 2, 226 SwIfIndex: 0, 227 Role: 1, // Slave 228 Mode: 1, // IP 229 SocketID: 1, 230 RingSize: 0, 231 BufferSize: 0, 232 }, 233 }, 234 { 235 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 236 Ping: true, 237 }, 238 { 239 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 240 Ping: true, 241 }, 242 { 243 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 244 Ping: true, 245 }, 246 { 247 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 248 Ping: true, 249 }, 250 }) 251 252 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 253 Expect(err).To(BeNil()) 254 Expect(intfs).To(HaveLen(1)) 255 intface := intfs[0].Interface 256 257 // Check memif 258 Expect(intface.GetMemif().SocketFilename).To(Equal("test")) 259 Expect(intface.GetMemif().Id).To(Equal(uint32(2))) 260 Expect(intface.GetMemif().Mode).To(Equal(ifs.MemifLink_IP)) 261 Expect(intface.GetMemif().Master).To(BeFalse()) 262 } 263 264 func TestDumpInterfacesTap2(t *testing.T) { 265 ctx, ifHandler := ifTestSetup(t) 266 defer ctx.TeardownTestCtx() 267 268 hwAddr1Parse, err := vpp2101.ParseMAC("01:23:45:67:89:ab") 269 Expect(err).To(BeNil()) 270 271 ctx.MockReplies([]*vppmock.HandleReplies{ 272 { 273 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 274 Ping: true, 275 Message: &vpp_interfaces.SwInterfaceDetails{ 276 SwIfIndex: 0, 277 InterfaceName: "tap2", 278 Tag: "mytap2", 279 Flags: interface_types.IF_STATUS_API_FLAG_ADMIN_UP, 280 LinkMtu: 9216, 281 L2Address: hwAddr1Parse, 282 }, 283 }, 284 { 285 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 286 Ping: false, 287 Message: &vpp_interfaces.SwInterfaceGetTableReply{ 288 Retval: 0, 289 VrfID: 42, 290 }, 291 }, 292 { 293 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 294 Ping: true, 295 Message: &vpp_ip.IPAddressDetails{}, 296 }, 297 { 298 Name: (&vpp_dhcp.DHCPClientDump{}).GetMessageName(), 299 Ping: true, 300 Message: &vpp_dhcp.DHCPClientDetails{ 301 Client: vpp_dhcp.DHCPClient{ 302 SwIfIndex: 0, 303 }, 304 }, 305 }, 306 { 307 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 308 Ping: true, 309 Message: &vpp_tapv2.SwInterfaceTapV2Details{ 310 SwIfIndex: 0, 311 HostIfName: "taptap2", 312 }, 313 }, 314 { 315 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 316 Ping: true, 317 }, 318 { 319 Name: (&vpp_vxlangpe.VxlanGpeTunnelDump{}).GetMessageName(), 320 Ping: true, 321 }, 322 { 323 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 324 Ping: true, 325 }, 326 { 327 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 328 Ping: true, 329 }, 330 { 331 Name: (&vpp_ip.IPUnnumberedDump{}).GetMessageName(), 332 Ping: true, 333 }, 334 { 335 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 336 Ping: true, 337 }, 338 }) 339 340 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 341 Expect(err).To(BeNil()) 342 Expect(intfs).To(HaveLen(1)) 343 344 intface := intfs[0].Interface 345 intMeta := intfs[0].Meta 346 347 // This is last checked type, so it will be equal to that 348 Expect(intface.Type).To(Equal(ifs.Interface_TAP)) 349 Expect(intface.PhysAddress).To(Equal("01:23:45:67:89:ab")) 350 Expect(intface.Name).To(Equal("mytap2")) 351 Expect(intface.Mtu).To(Equal(uint32(0))) // default mtu 352 Expect(intface.Enabled).To(BeTrue()) 353 Expect(intface.Vrf).To(Equal(uint32(42))) 354 Expect(intface.SetDhcpClient).To(BeTrue()) 355 Expect(intface.GetTap().HostIfName).To(Equal("taptap2")) 356 Expect(intface.GetTap().Version).To(Equal(uint32(2))) 357 Expect(intMeta.VrfIPv4).To(Equal(uint32(42))) 358 Expect(intMeta.VrfIPv6).To(Equal(uint32(42))) 359 } 360 361 // Test dump of memif socket details using standard reply mocking 362 func TestDumpMemifSocketDetails(t *testing.T) { 363 ctx, ifHandler := ifTestSetup(t) 364 defer ctx.TeardownTestCtx() 365 366 ctx.MockVpp.MockReply(&vpp_memif.MemifSocketFilenameDetails{ 367 SocketID: 1, 368 SocketFilename: "test", 369 }) 370 371 ctx.MockVpp.MockReply(&vpp_vpe.ControlPingReply{}) 372 373 result, err := ifHandler.DumpMemifSocketDetails(ctx.Context) 374 Expect(err).To(BeNil()) 375 Expect(result).To(Not(BeEmpty())) 376 377 socketID, ok := result["test"] 378 Expect(ok).To(BeTrue()) 379 Expect(socketID).To(Equal(uint32(1))) 380 } 381 382 func TestDumpInterfacesRxPlacement(t *testing.T) { 383 ctx, ifHandler := ifTestSetup(t) 384 defer ctx.TeardownTestCtx() 385 386 ctx.MockReplies([]*vppmock.HandleReplies{ 387 { 388 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 389 Ping: true, 390 Message: &vpp_interfaces.SwInterfaceDetails{ 391 InterfaceName: "memif1", 392 }, 393 }, 394 { 395 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 396 Ping: false, 397 Message: &vpp_interfaces.SwInterfaceGetTableReply{}, 398 }, 399 { 400 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 401 Ping: true, 402 Message: &vpp_ip.IPAddressDetails{}, 403 }, 404 { 405 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 406 Ping: true, 407 Message: &vpp_memif.MemifSocketFilenameDetails{ 408 SocketID: 1, 409 SocketFilename: "test", 410 }, 411 }, 412 { 413 Name: (&vpp_memif.MemifDump{}).GetMessageName(), 414 Ping: true, 415 Message: &vpp_memif.MemifDetails{ 416 ID: 2, 417 SwIfIndex: 0, 418 Role: 1, // Slave 419 Mode: 1, // IP 420 SocketID: 1, 421 RingSize: 0, 422 BufferSize: 0, 423 }, 424 }, 425 { 426 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 427 Ping: true, 428 }, 429 { 430 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 431 Ping: true, 432 }, 433 { 434 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 435 Ping: true, 436 }, 437 { 438 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 439 Ping: true, 440 }, 441 { 442 Name: (&vpp_interfaces.SwInterfaceRxPlacementDump{}).GetMessageName(), 443 Ping: true, 444 Messages: []govppapi.Message{ 445 &vpp_interfaces.SwInterfaceRxPlacementDetails{ 446 SwIfIndex: 0, 447 QueueID: 0, 448 WorkerID: 0, // main thread 449 Mode: 3, // adaptive 450 }, 451 &vpp_interfaces.SwInterfaceRxPlacementDetails{ 452 SwIfIndex: 0, 453 QueueID: 1, 454 WorkerID: 1, // worker 0 455 Mode: 2, // interrupt 456 }, 457 &vpp_interfaces.SwInterfaceRxPlacementDetails{ 458 SwIfIndex: 0, 459 QueueID: 2, 460 WorkerID: 2, // worker 1 461 Mode: 1, // polling 462 }, 463 }, 464 }, 465 { 466 Name: (&vpp_ip.IPUnnumberedDump{}).GetMessageName(), 467 Ping: true, 468 }, 469 { 470 Name: (&vpp_dhcp.DHCPClientDump{}).GetMessageName(), 471 Ping: true, 472 }, 473 { 474 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 475 Ping: true, 476 }, 477 }) 478 479 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 480 Expect(err).To(BeNil()) 481 Expect(intfs).To(HaveLen(1)) 482 intface := intfs[0].Interface 483 484 // Check memif 485 Expect(intface.GetMemif().SocketFilename).To(Equal("test")) 486 Expect(intface.GetMemif().Id).To(Equal(uint32(2))) 487 Expect(intface.GetMemif().Mode).To(Equal(ifs.MemifLink_IP)) 488 Expect(intface.GetMemif().Master).To(BeFalse()) 489 490 rxMode := intface.GetRxModes() 491 Expect(rxMode).To(HaveLen(3)) 492 Expect(rxMode[0].Queue).To(BeEquivalentTo(0)) 493 Expect(rxMode[0].Mode).To(BeEquivalentTo(ifs.Interface_RxMode_ADAPTIVE)) 494 Expect(rxMode[1].Queue).To(BeEquivalentTo(1)) 495 Expect(rxMode[1].Mode).To(BeEquivalentTo(ifs.Interface_RxMode_INTERRUPT)) 496 Expect(rxMode[2].Queue).To(BeEquivalentTo(2)) 497 Expect(rxMode[2].Mode).To(BeEquivalentTo(ifs.Interface_RxMode_POLLING)) 498 499 rxPlacement := intface.GetRxPlacements() 500 Expect(rxPlacement).To(HaveLen(3)) 501 Expect(rxPlacement[0].Queue).To(BeEquivalentTo(0)) 502 Expect(rxPlacement[0].MainThread).To(BeTrue()) 503 Expect(rxPlacement[0].Worker).To(BeEquivalentTo(0)) 504 Expect(rxPlacement[1].Queue).To(BeEquivalentTo(1)) 505 Expect(rxPlacement[1].MainThread).To(BeFalse()) 506 Expect(rxPlacement[1].Worker).To(BeEquivalentTo(0)) 507 Expect(rxPlacement[2].Queue).To(BeEquivalentTo(2)) 508 Expect(rxPlacement[2].MainThread).To(BeFalse()) 509 Expect(rxPlacement[2].Worker).To(BeEquivalentTo(1)) 510 } 511 512 // Test dump of interfaces with gtpu type 513 func TestDumpInterfacesGtpu(t *testing.T) { 514 ctx, ifHandler := ifTestSetup(t) 515 defer ctx.TeardownTestCtx() 516 517 ipv61Parse := ip_types.Address{ 518 Af: ip_types.ADDRESS_IP6, 519 Un: ip_types.AddressUnionIP6(ip_types.IP6Address{ 520 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xca, 0xfe, 0xba, 0xbe, 0xba, 0xad, 0xc0, 0xde, 521 }), 522 } 523 ipv62Parse := ip_types.Address{ 524 Af: ip_types.ADDRESS_IP6, 525 Un: ip_types.AddressUnionIP6(ip_types.IP6Address{ 526 0xd3, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xca, 0xfe, 0xba, 0xbe, 0xba, 0xad, 0xc0, 0xde, 527 }), 528 } 529 530 ctx.MockReplies([]*vppmock.HandleReplies{ 531 { 532 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 533 Ping: true, 534 Message: &vpp_interfaces.SwInterfaceDetails{ 535 InterfaceName: "gtpu1", 536 }, 537 }, 538 { 539 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 540 Ping: false, 541 Message: &vpp_interfaces.SwInterfaceGetTableReply{}, 542 }, 543 { 544 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 545 Ping: true, 546 Message: &vpp_ip.IPAddressDetails{}, 547 }, 548 { 549 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 550 Ping: true, 551 }, 552 { 553 Name: (&vpp_memif.MemifDump{}).GetMessageName(), 554 Ping: true, 555 }, 556 { 557 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 558 Ping: true, 559 }, 560 { 561 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 562 Ping: true, 563 }, 564 { 565 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 566 Ping: true, 567 Message: &vpp_gtpu.GtpuTunnelDetails{ 568 SwIfIndex: 0, 569 SrcAddress: ipv61Parse, 570 DstAddress: ipv62Parse, 571 EncapVrfID: 16, 572 Teid: 100, 573 }, 574 }, 575 { 576 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 577 Ping: true, 578 }, 579 }) 580 581 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 582 Expect(err).To(BeNil()) 583 Expect(intfs).To(HaveLen(1)) 584 intface := intfs[0].Interface 585 586 // Check gtpu 587 Expect(intface.Type).To(Equal(ifs.Interface_GTPU_TUNNEL)) 588 Expect(intface.GetGtpu().SrcAddr).To(Equal("dead:beef:feed:face:cafe:babe:baad:c0de")) 589 Expect(intface.GetGtpu().DstAddr).To(Equal("d3ad:beef:feed:face:cafe:babe:baad:c0de")) 590 Expect(intface.GetGtpu().EncapVrfId).To(Equal(uint32(16))) 591 Expect(intface.GetGtpu().Teid).To(Equal(uint32(100))) 592 } 593 594 // Test dump of interfaces with IPIP type 595 func TestDumpInterfacesIPIP(t *testing.T) { 596 ctx, ifHandler := ifTestSetup(t) 597 defer ctx.TeardownTestCtx() 598 599 ctx.MockReplies([]*vppmock.HandleReplies{ 600 { 601 Name: (&vpp_interfaces.SwInterfaceDump{}).GetMessageName(), 602 Ping: true, 603 Message: &vpp_interfaces.SwInterfaceDetails{ 604 InterfaceName: "vxlan1", 605 }, 606 }, 607 { 608 Name: (&vpp_interfaces.SwInterfaceGetTable{}).GetMessageName(), 609 Ping: false, 610 Message: &vpp_interfaces.SwInterfaceGetTableReply{}, 611 }, 612 { 613 Name: (&vpp_ip.IPAddressDump{}).GetMessageName(), 614 Ping: true, 615 Message: &vpp_ip.IPAddressDetails{}, 616 }, 617 { 618 Name: (&vpp_memif.MemifSocketFilenameDump{}).GetMessageName(), 619 Ping: true, 620 }, 621 { 622 Name: (&vpp_memif.MemifDump{}).GetMessageName(), 623 Ping: true, 624 }, 625 { 626 Name: (&vpp_tapv2.SwInterfaceTapV2Dump{}).GetMessageName(), 627 Ping: true, 628 }, 629 { 630 Name: (&vpp_vxlan.VxlanTunnelDump{}).GetMessageName(), 631 Ping: true, 632 }, 633 { 634 Name: (&vpp_gtpu.GtpuTunnelDump{}).GetMessageName(), 635 Ping: true, 636 }, 637 { 638 Name: (&vpp_ipip.IpipTunnelDump{}).GetMessageName(), 639 Ping: true, 640 Message: &vpp_ipip.IpipTunnelDetails{ 641 Tunnel: vpp_ipip.IpipTunnel{ 642 Dst: ip_types.Address{ 643 Af: ip_types.ADDRESS_IP6, 644 Un: ip_types.AddressUnionIP6(ip_types.IP6Address{ 645 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xca, 0xfe, 0xba, 0xbe, 0xba, 0xad, 0xc0, 0xde, 646 })}, 647 Src: ip_types.Address{ 648 Af: ip_types.ADDRESS_IP6, 649 Un: ip_types.AddressUnionIP6(ip_types.IP6Address{ 650 0xd3, 0xad, 0xbe, 0xef, 0xfe, 0xed, 0xfa, 0xce, 0xca, 0xfe, 0xba, 0xbe, 0xba, 0xad, 0xc0, 0xde, 651 })}, 652 }, 653 }, 654 }, 655 }) 656 657 intfs, err := ifHandler.DumpInterfaces(ctx.Context) 658 Expect(err).To(BeNil()) 659 Expect(intfs).To(HaveLen(1)) 660 intface := intfs[0].Interface 661 662 // Check IPIP 663 Expect(intface.GetIpip()).ToNot(BeNil()) 664 Expect(intface.GetIpip().DstAddr).To(Equal("dead:beef:feed:face:cafe:babe:baad:c0de")) 665 Expect(intface.GetIpip().SrcAddr).To(Equal("d3ad:beef:feed:face:cafe:babe:baad:c0de")) 666 }