Skip to content

Commit

Permalink
remove unused function (#4877)
Browse files Browse the repository at this point in the history
Signed-off-by: zhaocongqi <[email protected]>
  • Loading branch information
zhaocongqi authored Dec 27, 2024
1 parent 9b00723 commit c2bc182
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 51 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ func (c *Controller) InitIPAM() error {
}
subnetProviderMaps := make(map[string]string, len(subnets))
for _, subnet := range subnets {
subnetProviderMaps[subnet.Name] = subnet.Spec.Provider

klog.Infof("Init subnet %s", subnet.Name)

subnetProviderMaps[subnet.Name] = subnet.Spec.Provider

if err := c.ipam.AddOrUpdateSubnet(subnet.Name, subnet.Spec.CIDRBlock, subnet.Spec.Gateway, subnet.Spec.ExcludeIps); err != nil {
klog.Errorf("failed to init subnet %s: %v", subnet.Name, err)
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/ovs/ovn-nb-dhcp_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,6 @@ func (c *OVNNbClient) ListDHCPOptions(needVendorFilter bool, externalIDs map[str
return dhcpOptList, nil
}

func (c *OVNNbClient) DHCPOptionsExists(lsName, protocol string) (bool, error) {
dhcpOpt, err := c.GetDHCPOptions(lsName, protocol, true)
return dhcpOpt != nil, err
}

// newDHCPOptions return dhcp options with basic information
func newDHCPOptions(lsName, cidr, options string) (*ovnnb.DHCPOptions, error) {
if len(cidr) == 0 || len(lsName) == 0 {
Expand Down
40 changes: 0 additions & 40 deletions pkg/ovs/ovn-nb-dhcp_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,43 +640,3 @@ func (suite *OvnClientTestSuite) testCreateDHCPOptions() {
require.Error(t, err)
})
}

func (suite *OvnClientTestSuite) testDHCPOptionsExists() {
t := suite.T()
t.Parallel()

nbClient := suite.ovnNBClient
lsName := "test-dhcp-opt-exists-ls"

t.Run("DHCP options exist", func(t *testing.T) {
cidr := "192.168.80.0/24"
err := nbClient.CreateDHCPOptions(lsName, cidr, "")
require.NoError(t, err)

exists, err := nbClient.DHCPOptionsExists(lsName, "IPv4")
require.NoError(t, err)
require.True(t, exists)
})

t.Run("DHCP options do not exist", func(t *testing.T) {
exists, err := nbClient.DHCPOptionsExists(lsName+"-1", "IPv4")
require.NoError(t, err)
require.False(t, exists)
})

t.Run("DHCP options exist for IPv6", func(t *testing.T) {
cidr := "fd00::c0a8:8001/120"
err := nbClient.CreateDHCPOptions(lsName, cidr, "")
require.NoError(t, err)

exists, err := nbClient.DHCPOptionsExists(lsName, "IPv6")
require.NoError(t, err)
require.True(t, exists)
})

t.Run("DHCP options do not exist for IPv6", func(t *testing.T) {
exists, err := nbClient.DHCPOptionsExists(lsName+"-1", "IPv6")
require.NoError(t, err)
require.False(t, exists)
})
}
4 changes: 0 additions & 4 deletions pkg/ovs/ovn-nb-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,6 @@ func (suite *OvnClientTestSuite) Test_CreateDHCPOptions() {
suite.testCreateDHCPOptions()
}

func (suite *OvnClientTestSuite) Test_DHCPOptionsExists() {
suite.testDHCPOptionsExists()
}

/* mixed operations unit test */
func (suite *OvnClientTestSuite) Test_CreateGatewayLogicalSwitch() {
suite.testCreateGatewayLogicalSwitch()
Expand Down

0 comments on commit c2bc182

Please sign in to comment.