go.ligato.io/vpp-agent/v3@v3.5.0/tests/integration/vpp/032_ip6nd_test.go (about) 1 // Copyright (c) 2021 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 vpp 16 17 import ( 18 "testing" 19 20 . "github.com/onsi/gomega" 21 22 "go.ligato.io/cn-infra/v2/logging/logrus" 23 24 "go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin/ifaceidx" 25 ifplugin_vppcalls "go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin/vppcalls" 26 "go.ligato.io/vpp-agent/v3/plugins/vpp/l3plugin/vrfidx" 27 vpp_l3 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l3" 28 29 _ "go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin" 30 ) 31 32 func TestIP6ND(t *testing.T) { 33 test := setupVPP(t) 34 defer test.teardownVPP() 35 36 ih := ifplugin_vppcalls.CompatibleInterfaceVppHandler(test.vppClient, logrus.NewLogger("test")) 37 const ifName = "loop1" 38 ifIdx, err := ih.AddLoopbackInterface(ifName) 39 if err != nil { 40 t.Fatalf("creating interface failed: %v", err) 41 } 42 if err = ih.InterfaceAdminUp(test.Ctx, ifIdx); err != nil { 43 t.Fatalf("setting interface up failed: %v", err) 44 } 45 t.Logf("interface created %v", ifIdx) 46 47 ifIndexes := ifaceidx.NewIfaceIndex(logrus.NewLogger("test-if"), "test-if") 48 ifIndexes.Put(ifName, &ifaceidx.IfaceMetadata{SwIfIndex: ifIdx}) 49 vrfIndexes := vrfidx.NewVRFIndex(logrus.NewLogger("test-vrf"), "test-vrf") 50 vrfIndexes.Put("vrf1-ipv4", &vrfidx.VRFMetadata{Index: 0, Protocol: vpp_l3.VrfTable_IPV4}) 51 vrfIndexes.Put("vrf1-ipv6", &vrfidx.VRFMetadata{Index: 0, Protocol: vpp_l3.VrfTable_IPV6}) 52 53 err = ih.SetIP6ndAutoconfig(test.Ctx, ifIdx, true, true) 54 Expect(err).To(Succeed()) 55 56 out, err := test.vpp.RunCli(test.Ctx, "show ip6 fib") 57 Expect(err).To(Succeed()) 58 Expect(out).To(ContainSubstring("default-route:1")) 59 // TODO: fix test assert 60 61 t.Logf("CLI output: %s", out) 62 }