Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
network: Remove unused CNI code
Browse files Browse the repository at this point in the history
We dont really call CNI from Kata, this is done by the CRI layer.
All of the CNI code is unused.

Fixes kata-containers#567

Signed-off-by: Archana Shinde <[email protected]>
  • Loading branch information
amshinde authored and lifupan committed Sep 17, 2018
1 parent 3c99aee commit 2847116
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 868 deletions.
111 changes: 0 additions & 111 deletions virtcontainers/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,49 +119,6 @@ func newTestSandboxConfigHyperstartAgent() SandboxConfig {
return sandboxConfig
}

func newTestSandboxConfigHyperstartAgentCNINetwork() SandboxConfig {
// Define the container command and bundle.
container := ContainerConfig{
ID: containerID,
RootFs: filepath.Join(testDir, testBundle),
Cmd: newBasicTestCmd(),
Annotations: containerAnnotations,
}

// Sets the hypervisor configuration.
hypervisorConfig := HypervisorConfig{
KernelPath: filepath.Join(testDir, testKernel),
ImagePath: filepath.Join(testDir, testImage),
HypervisorPath: filepath.Join(testDir, testHypervisor),
}

agentConfig := HyperConfig{
SockCtlName: testHyperstartCtlSocket,
SockTtyName: testHyperstartTtySocket,
}

netConfig := NetworkConfig{
NumInterfaces: 1,
}

sandboxConfig := SandboxConfig{
ID: testSandboxID,
HypervisorType: MockHypervisor,
HypervisorConfig: hypervisorConfig,

AgentType: HyperstartAgent,
AgentConfig: agentConfig,

NetworkModel: CNINetworkModel,
NetworkConfig: netConfig,

Containers: []ContainerConfig{container},
Annotations: sandboxAnnotations,
}

return sandboxConfig
}

func newTestSandboxConfigHyperstartAgentCNMNetwork() SandboxConfig {
// Define the container command and bundle.
container := ContainerConfig{
Expand Down Expand Up @@ -1396,46 +1353,6 @@ func TestStartStopContainerHyperstartAgentSuccessful(t *testing.T) {
bindUnmountAllRootfs(defaultSharedDir, pImpl)
}

func TestStartStopSandboxHyperstartAgentSuccessfulWithCNINetwork(t *testing.T) {
if os.Geteuid() != 0 {
t.Skip(testDisabledAsNonRoot)
}

cleanUp()

config := newTestSandboxConfigHyperstartAgentCNINetwork()

sockDir, err := testGenerateCCProxySockDir()
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(sockDir)

testCCProxySockPath := fmt.Sprintf(testCCProxySockPathTempl, sockDir)
noopProxyURL = testCCProxyURLUnixScheme + testCCProxySockPath
proxy := mock.NewCCProxyMock(t, testCCProxySockPath)
proxy.Start()
defer proxy.Stop()

hyperConfig := config.AgentConfig.(HyperConfig)
config.AgentConfig = hyperConfig

p, _, err := createAndStartSandbox(config)
if p == nil || err != nil {
t.Fatal(err)
}

p, err = StopSandbox(p.ID())
if p == nil || err != nil {
t.Fatal(err)
}

p, err = DeleteSandbox(p.ID())
if p == nil || err != nil {
t.Fatal(err)
}
}

func TestStartStopSandboxHyperstartAgentSuccessfulWithCNMNetwork(t *testing.T) {
if os.Geteuid() != 0 {
t.Skip(testDisabledAsNonRoot)
Expand Down Expand Up @@ -2216,34 +2133,6 @@ func createStartStopDeleteContainers(b *testing.B, sandboxConfig SandboxConfig,
}
}

func BenchmarkCreateStartStopDeleteSandboxQemuHypervisorHyperstartAgentNetworkCNI(b *testing.B) {
for i := 0; i < b.N; i++ {
sandboxConfig := createNewSandboxConfig(QemuHypervisor, HyperstartAgent, HyperConfig{}, CNINetworkModel)

sockDir, err := testGenerateCCProxySockDir()
if err != nil {
b.Fatal(err)
}
defer os.RemoveAll(sockDir)

var t testing.T
testCCProxySockPath := fmt.Sprintf(testCCProxySockPathTempl, sockDir)
noopProxyURL = testCCProxyURLUnixScheme + testCCProxySockPath
proxy := mock.NewCCProxyMock(&t, testCCProxySockPath)
proxy.Start()
defer proxy.Stop()

createStartStopDeleteSandbox(b, sandboxConfig)
}
}

func BenchmarkCreateStartStopDeleteSandboxQemuHypervisorNoopAgentNetworkCNI(b *testing.B) {
for i := 0; i < b.N; i++ {
sandboxConfig := createNewSandboxConfig(QemuHypervisor, NoopAgentType, nil, CNINetworkModel)
createStartStopDeleteSandbox(b, sandboxConfig)
}
}

func BenchmarkCreateStartStopDeleteSandboxQemuHypervisorHyperstartAgentNetworkNoop(b *testing.B) {
for i := 0; i < b.N; i++ {
sandboxConfig := createNewSandboxConfig(QemuHypervisor, HyperstartAgent, HyperConfig{}, NoopNetworkModel)
Expand Down
172 changes: 0 additions & 172 deletions virtcontainers/cni.go

This file was deleted.

3 changes: 0 additions & 3 deletions virtcontainers/documentation/api/1.0/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@ const (
// NoopNetworkModel is the No-Op network.
NoopNetworkModel NetworkModel = "noop"

// CNINetworkModel is the CNI network.
CNINetworkModel NetworkModel = "CNI"

// CNMNetworkModel is the CNM network.
CNMNetworkModel NetworkModel = "CNM"
)
Expand Down
10 changes: 0 additions & 10 deletions virtcontainers/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,6 @@ const (
// NoopNetworkModel is the No-Op network.
NoopNetworkModel NetworkModel = "noop"

// CNINetworkModel is the CNI network.
CNINetworkModel NetworkModel = "CNI"

// CNMNetworkModel is the CNM network.
CNMNetworkModel NetworkModel = "CNM"
)
Expand All @@ -553,9 +550,6 @@ func (networkType *NetworkModel) Set(value string) error {
case "noop":
*networkType = NoopNetworkModel
return nil
case "CNI":
*networkType = CNINetworkModel
return nil
case "CNM":
*networkType = CNMNetworkModel
return nil
Expand All @@ -569,8 +563,6 @@ func (networkType *NetworkModel) String() string {
switch *networkType {
case NoopNetworkModel:
return string(NoopNetworkModel)
case CNINetworkModel:
return string(CNINetworkModel)
case CNMNetworkModel:
return string(CNMNetworkModel)
default:
Expand All @@ -583,8 +575,6 @@ func newNetwork(networkType NetworkModel) network {
switch networkType {
case NoopNetworkModel:
return &noopNetwork{}
case CNINetworkModel:
return &cni{}
case CNMNetworkModel:
return &cnm{}
default:
Expand Down
13 changes: 0 additions & 13 deletions virtcontainers/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ func TestNoopNetworkModelSet(t *testing.T) {
testNetworkModelSet(t, "noop", NoopNetworkModel)
}

func TestCNINetworkModelSet(t *testing.T) {
testNetworkModelSet(t, "CNI", CNINetworkModel)
}

func TestCNMNetworkModelSet(t *testing.T) {
testNetworkModelSet(t, "CNM", CNMNetworkModel)
}
Expand All @@ -68,11 +64,6 @@ func TestNoopNetworkModelString(t *testing.T) {
testNetworkModelString(t, &netModel, string(NoopNetworkModel))
}

func TestCNINetworkModelString(t *testing.T) {
netModel := CNINetworkModel
testNetworkModelString(t, &netModel, string(CNINetworkModel))
}

func TestCNMNetworkModelString(t *testing.T) {
netModel := CNMNetworkModel
testNetworkModelString(t, &netModel, string(CNMNetworkModel))
Expand All @@ -95,10 +86,6 @@ func TestNewNoopNetworkFromNetworkModel(t *testing.T) {
testNewNetworkFromNetworkModel(t, NoopNetworkModel, &noopNetwork{})
}

func TestNewCNINetworkFromNetworkModel(t *testing.T) {
testNewNetworkFromNetworkModel(t, CNINetworkModel, &cni{})
}

func TestNewCNMNetworkFromNetworkModel(t *testing.T) {
testNewNetworkFromNetworkModel(t, CNMNetworkModel, &cnm{})
}
Expand Down
6 changes: 0 additions & 6 deletions virtcontainers/pkg/cni/OWNERS

This file was deleted.

Loading

0 comments on commit 2847116

Please sign in to comment.