Skip to content

Commit

Permalink
remove l2bridge checker and l2tunnel mode
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyufan2 committed Nov 7, 2024
1 parent 73a22fc commit 319714e
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 27 deletions.
1 change: 0 additions & 1 deletion cni/azure-windows-swift-overlay-dualstack.conflist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"plugins": [
{
"type": "azure-vnet",
"mode": "bridge",
"bridge": "azure0",
"capabilities": {
"portMappings": true,
Expand Down
1 change: 0 additions & 1 deletion cni/azure-windows-swift-overlay.conflist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"plugins": [
{
"type": "azure-vnet",
"mode": "bridge",
"bridge": "azure0",
"capabilities": {
"portMappings": true,
Expand Down
1 change: 0 additions & 1 deletion cni/azure-windows-swift.conflist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"plugins": [
{
"type": "azure-vnet",
"mode": "bridge",
"bridge": "azure0",
"executionMode": "v4swift",
"capabilities": {
Expand Down
3 changes: 1 addition & 2 deletions cns/hnsclient/hnsclient_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const (

// HNS network types
hnsL2Bridge = "l2bridge"
hnsL2Tunnel = "l2tunnel"

// hcnSchemaVersionMajor indicates major version number for hcn schema
hcnSchemaVersionMajor = 2
Expand Down Expand Up @@ -145,7 +144,7 @@ func CreateDefaultExtNetwork(networkType string) error {
return nil
}

if networkType != hnsL2Bridge && networkType != hnsL2Tunnel {
if networkType != hnsL2Bridge {
return fmt.Errorf("Invalid hns network type %s", networkType)
}

Expand Down
2 changes: 1 addition & 1 deletion cns/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ var args = acn.ArgumentList{
{
Name: acn.OptCreateDefaultExtNetworkType,
Shorthand: acn.OptCreateDefaultExtNetworkTypeAlias,
Description: "Create default external network for windows platform with the specified type (l2bridge or l2tunnel)",
Description: "Create default external network for windows platform with the specified type (l2bridge)",
Type: "string",
DefaultValue: "",
},
Expand Down
23 changes: 2 additions & 21 deletions network/network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
const (
// HNS network types.
hnsL2bridge = "l2bridge"
hnsL2tunnel = "l2tunnel"
CnetAddressSpace = "cnetAddressSpace"
vEthernetAdapterPrefix = "vEthernet"
baseDecimal = 10
Expand Down Expand Up @@ -113,6 +112,7 @@ func (nm *networkManager) newNetworkImplHnsV1(nwInfo *EndpointInfo, extIf *exter
// Initialize HNS network.
hnsNetwork := &hcsshim.HNSNetwork{
Name: nwInfo.NetworkID,
Type: hnsL2bridge,
NetworkAdapterName: networkAdapterName,
Policies: policy.SerializePolicies(policy.NetworkPolicy, nwInfo.NetworkPolicies, nil, false, false),
}
Expand All @@ -132,16 +132,6 @@ func (nm *networkManager) newNetworkImplHnsV1(nwInfo *EndpointInfo, extIf *exter
vlanid = (int)(vlanPolicy.VLAN)
}

// Set network mode.
switch nwInfo.Mode {
case opModeBridge:
hnsNetwork.Type = hnsL2bridge
case opModeTunnel:
hnsNetwork.Type = hnsL2tunnel
default:
return nil, errNetworkModeInvalid
}

// Populate subnets.
for _, subnet := range nwInfo.Subnets {
hnsSubnet := hcsshim.Subnet{
Expand Down Expand Up @@ -233,6 +223,7 @@ func (nm *networkManager) configureHcnNetwork(nwInfo *EndpointInfo, extIf *exter
// Initialize HNS network.
hcnNetwork := &hcn.HostComputeNetwork{
Name: nwInfo.NetworkID,
Type: hcn.L2Bridge

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal

Check failure on line 226 in network/network_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, ubuntu-latest)

missing ',' before newline in composite literal
Ipams: []hcn.Ipam{
{
Type: hcnIpamTypeStatic,
Expand Down Expand Up @@ -287,16 +278,6 @@ func (nm *networkManager) configureHcnNetwork(nwInfo *EndpointInfo, extIf *exter
vlanid = (int)(vlanID)
}

// Set network mode.
switch nwInfo.Mode {
case opModeBridge:
hcnNetwork.Type = hcn.L2Bridge
case opModeTunnel:
hcnNetwork.Type = hcn.L2Tunnel
default:
return nil, errNetworkModeInvalid
}

// AccelnetNIC flag: hcn.EnableIov(9216) - treat Delegated/FrontendNIC also the same as Accelnet
// For L1VH with accelnet, hcn.DisableHostPort and hcn.EnableIov must be configured
if nwInfo.NICType == cns.NodeNetworkInterfaceFrontendNIC {
Expand Down

0 comments on commit 319714e

Please sign in to comment.