go.ligato.io/vpp-agent/v3@v3.5.0/plugins/vpp/l3plugin/vppcalls/vpp2101/ipneigh_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
    16  
    17  /*
    18  import (
    19  	"testing"
    20  
    21  	. "github.com/onsi/gomega"
    22  
    23  	vpp_vpe "go.ligato.io/vpp-agent/v3/plugins/vpp/binapi/vpp2101/vpe"
    24  	"go.ligato.io/vpp-agent/v3/plugins/vpp/vppmock"
    25  	l3 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l3"
    26  )
    27  
    28  
    29  func TestGetIPScanNeighbor(t *testing.T) {
    30  	tests := []struct {
    31  		name     string
    32  		cliReply string
    33  		expected l3.IPScanNeighbor
    34  	}{
    35  		{
    36  			name: "default",
    37  			cliReply: `ip4:
    38    limit:50000, age:0, recycle:0
    39  ip6:
    40    limit:50000, age:0, recycle:0
    41  `,
    42  			expected: l3.IPScanNeighbor{
    43  				Mode:      l3.IPScanNeighbor_DISABLED,
    44  				MaxUpdate: 50000,
    45  			},
    46  		},
    47  	}
    48  	for _, test := range tests {
    49  		t.Run(test.name, func(t *testing.T) {
    50  			ctx := vppmock.SetupTestCtx(t)
    51  			defer ctx.TeardownTestCtx()
    52  
    53  			ctx.MockVpp.MockReply(&vpp_vpe.CliInbandReply{
    54  				Reply: test.cliReply,
    55  			})
    56  
    57  			handler := NewIPNeighVppHandler(ctx.MockChannel, nil)
    58  
    59  			ipNeigh, err := handler.GetIPScanNeighbor()
    60  			Expect(err).ShouldNot(HaveOccurred())
    61  			Expect(ipNeigh.Mode).To(Equal(test.expected.Mode))
    62  			Expect(ipNeigh.ScanInterval).To(Equal(test.expected.ScanInterval))
    63  			Expect(ipNeigh.ScanIntDelay).To(Equal(test.expected.ScanIntDelay))
    64  			Expect(ipNeigh.StaleThreshold).To(Equal(test.expected.StaleThreshold))
    65  			Expect(ipNeigh.MaxUpdate).To(Equal(test.expected.MaxUpdate))
    66  			Expect(ipNeigh.MaxProcTime).To(Equal(test.expected.MaxProcTime))
    67  		})
    68  	}
    69  }
    70  */