-
Notifications
You must be signed in to change notification settings - Fork 364
/
interfaces.go
45 lines (40 loc) · 2.4 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2022 Antrea Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cniserver
import (
cnitypes "github.com/containernetworking/cni/pkg/types"
current "github.com/containernetworking/cni/pkg/types/100"
)
type postInterfaceCreateHook func() error
// podInterfaceConfigurator is for testing.
type podInterfaceConfigurator interface {
configureContainerLink(podName string, podNamespace string, containerID string, containerNetNS string, containerIfaceName string, mtu int, brSriovVFDeviceID string, podSriovVFDeviceID string, result *current.Result, containerAccess *containerAccessArbitrator) error
removeContainerLink(containerID, hostInterfaceName string) error
advertiseContainerAddr(containerNetNS string, containerIfaceName string, result *current.Result) error
validateVFRepInterface(sriovVFDeviceID string) (string, error)
validateContainerPeerInterface(interfaces []*current.Interface, containerVeth *vethPair) (*vethPair, error)
getInterceptedInterfaces(sandbox string, containerNetNS string, containerIFDev string) (*current.Interface, *current.Interface, error)
checkContainerInterface(containerNetns, containerID string, containerIface *current.Interface, containerIPs []*current.IPConfig, containerRoutes []*cnitypes.Route, sriovVFDeviceID string) (interface{}, error)
addPostInterfaceCreateHook(containerID, endpointName string, containerAccess *containerAccessArbitrator, hook postInterfaceCreateHook) error
changeContainerMTU(containerNetNS string, containerIFDev string, mtuDeduction int) error
}
type SriovNet interface {
GetNetDevicesFromPci(pciAddress string) ([]string, error)
GetUplinkRepresentor(pciAddress string) (string, error)
GetVfIndexByPciAddress(vfPciAddress string) (int, error)
GetVfRepresentor(uplink string, vfIndex int) (string, error)
GetPfName(vf string) (string, error)
GetVfid(addr string, pfName string) (int, error)
GetVFLinkNames(pciAddr string) (string, error)
}