istio.io/istio@v0.0.0-20240520182934-d79c90f27776/cni/pkg/ipset/nldeps_mock.go (about)

     1  // Copyright Istio Authors
     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 ipset
    16  
    17  import (
    18  	"net/netip"
    19  
    20  	"github.com/stretchr/testify/mock"
    21  )
    22  
    23  type MockedIpsetDeps struct {
    24  	mock.Mock
    25  }
    26  
    27  func FakeNLDeps() *MockedIpsetDeps {
    28  	return &MockedIpsetDeps{}
    29  }
    30  
    31  func (m *MockedIpsetDeps) ipsetIPHashCreate(name string, v6 bool) error {
    32  	args := m.Called(name, v6)
    33  	return args.Error(0)
    34  }
    35  
    36  func (m *MockedIpsetDeps) destroySet(name string) error {
    37  	args := m.Called(name)
    38  	return args.Error(0)
    39  }
    40  
    41  func (m *MockedIpsetDeps) addIP(name string, ip netip.Addr, ipProto uint8, comment string, replace bool) error {
    42  	args := m.Called(name, ip, ipProto, comment, replace)
    43  	return args.Error(0)
    44  }
    45  
    46  func (m *MockedIpsetDeps) deleteIP(name string, ip netip.Addr, ipProto uint8) error {
    47  	args := m.Called(name, ip, ipProto)
    48  	return args.Error(0)
    49  }
    50  
    51  func (m *MockedIpsetDeps) flush(name string) error {
    52  	args := m.Called(name)
    53  	return args.Error(0)
    54  }
    55  
    56  func (m *MockedIpsetDeps) clearEntriesWithComment(name, comment string) error {
    57  	args := m.Called(name, comment)
    58  	return args.Error(0)
    59  }
    60  
    61  func (m *MockedIpsetDeps) clearEntriesWithIP(name string, ip netip.Addr) error {
    62  	args := m.Called(name, ip)
    63  	return args.Error(0)
    64  }
    65  
    66  func (m *MockedIpsetDeps) listEntriesByIP(name string) ([]netip.Addr, error) {
    67  	args := m.Called(name)
    68  	return args.Get(0).([]netip.Addr), args.Error(1)
    69  }