virtcontainers: Alias for pkg/types

Since we're going to have both external and internal types packages, we
alias the external one as vcTypes. And the internal one will be usable
through the types namespace.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2018-12-21 14:38:52 +01:00
parent 36c267a1d2
commit 3ab7d077d1
20 changed files with 146 additions and 146 deletions

View File

@ -12,7 +12,7 @@ import (
"os"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@ -152,7 +152,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
}
switch opType {
case interfaceType:
var inf, resultingInf *types.Interface
var inf, resultingInf *vcTypes.Interface
if err = json.NewDecoder(f).Decode(&inf); err != nil {
return err
}
@ -171,7 +171,7 @@ func networkModifyCommand(ctx context.Context, containerID, input string, opType
}
json.NewEncoder(output).Encode(resultingInf)
case routeType:
var routes, resultingRoutes []*types.Route
var routes, resultingRoutes []*vcTypes.Route
if err = json.NewDecoder(f).Decode(&routes); err != nil {
return err
}
@ -209,7 +209,7 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT
switch opType {
case interfaceType:
var interfaces []*types.Interface
var interfaces []*vcTypes.Interface
interfaces, err = vci.ListInterfaces(ctx, sandboxID)
if err != nil {
kataLog.WithField("existing-interfaces", fmt.Sprintf("%+v", interfaces)).
@ -217,7 +217,7 @@ func networkListCommand(ctx context.Context, containerID string, opType networkT
}
json.NewEncoder(file).Encode(interfaces)
case routeType:
var routes []*types.Route
var routes []*vcTypes.Route
routes, err = vci.ListRoutes(ctx, sandboxID)
if err != nil {
kataLog.WithField("resulting-routes", fmt.Sprintf("%+v", routes)).

View File

@ -13,24 +13,24 @@ import (
"testing"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/stretchr/testify/assert"
)
var (
testAddInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
testAddInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
testRemoveInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
testRemoveInterfaceFuncReturnNil = func(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
testListInterfacesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
testListInterfacesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error) {
return nil, nil
}
testUpdateRoutsFuncReturnNil = func(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
testUpdateRoutsFuncReturnNil = func(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return nil, nil
}
testListRoutesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*types.Route, error) {
testListRoutesFuncReturnNil = func(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error) {
return nil, nil
}
)

View File

@ -22,7 +22,7 @@ import (
"time"
"github.com/kata-containers/runtime/pkg/signals"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/sirupsen/logrus"
lSyslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/vishvananda/netlink"
@ -70,7 +70,7 @@ type netmon struct {
storagePath string
sharedFile string
netIfaces map[int]types.Interface
netIfaces map[int]vcTypes.Interface
linkUpdateCh chan netlink.LinkUpdate
linkDoneCh chan struct{}
@ -151,7 +151,7 @@ func newNetmon(params netmonParams) (*netmon, error) {
netmonParams: params,
storagePath: filepath.Join(storageParentPath, params.sandboxID),
sharedFile: filepath.Join(storageParentPath, params.sandboxID, sharedFile),
netIfaces: make(map[int]types.Interface),
netIfaces: make(map[int]vcTypes.Interface),
linkUpdateCh: make(chan netlink.LinkUpdate),
linkDoneCh: make(chan struct{}),
rtUpdateCh: make(chan netlink.RouteUpdate),
@ -259,13 +259,13 @@ func (n *netmon) listenNetlinkEvents() error {
// convertInterface converts a link and its IP addresses as defined by netlink
// package, into the Interface structure format expected by kata-runtime to
// describe an interface and its associated IP addresses.
func convertInterface(linkAttrs *netlink.LinkAttrs, linkType string, addrs []netlink.Addr) types.Interface {
func convertInterface(linkAttrs *netlink.LinkAttrs, linkType string, addrs []netlink.Addr) vcTypes.Interface {
if linkAttrs == nil {
netmonLog.Warn("Link attributes are nil")
return types.Interface{}
return vcTypes.Interface{}
}
var ipAddrs []*types.IPAddress
var ipAddrs []*vcTypes.IPAddress
for _, addr := range addrs {
if addr.IPNet == nil {
@ -274,7 +274,7 @@ func convertInterface(linkAttrs *netlink.LinkAttrs, linkType string, addrs []net
netMask, _ := addr.Mask.Size()
ipAddr := &types.IPAddress{
ipAddr := &vcTypes.IPAddress{
Family: netlinkFamily,
Address: addr.IP.String(),
Mask: fmt.Sprintf("%d", netMask),
@ -283,7 +283,7 @@ func convertInterface(linkAttrs *netlink.LinkAttrs, linkType string, addrs []net
ipAddrs = append(ipAddrs, ipAddr)
}
iface := types.Interface{
iface := vcTypes.Interface{
Device: linkAttrs.Name,
Name: linkAttrs.Name,
IPAddresses: ipAddrs,
@ -300,8 +300,8 @@ func convertInterface(linkAttrs *netlink.LinkAttrs, linkType string, addrs []net
// convertRoutes converts a list of routes as defined by netlink package,
// into a list of Route structure format expected by kata-runtime to
// describe a set of routes.
func convertRoutes(netRoutes []netlink.Route) []types.Route {
var routes []types.Route
func convertRoutes(netRoutes []netlink.Route) []vcTypes.Route {
var routes []vcTypes.Route
// Ignore routes with IPv6 addresses as this is not supported
// by Kata yet.
@ -335,7 +335,7 @@ func convertRoutes(netRoutes []netlink.Route) []types.Route {
dev = iface.Name
}
route := types.Route{
route := vcTypes.Route{
Dest: dst,
Gateway: gw,
Device: dev,
@ -407,7 +407,7 @@ func (n *netmon) execKataCmd(subCmd string) error {
return os.Remove(n.sharedFile)
}
func (n *netmon) addInterfaceCLI(iface types.Interface) error {
func (n *netmon) addInterfaceCLI(iface vcTypes.Interface) error {
if err := n.storeDataToSend(iface); err != nil {
return err
}
@ -415,7 +415,7 @@ func (n *netmon) addInterfaceCLI(iface types.Interface) error {
return n.execKataCmd(kataCLIAddIfaceCmd)
}
func (n *netmon) delInterfaceCLI(iface types.Interface) error {
func (n *netmon) delInterfaceCLI(iface vcTypes.Interface) error {
if err := n.storeDataToSend(iface); err != nil {
return err
}
@ -423,7 +423,7 @@ func (n *netmon) delInterfaceCLI(iface types.Interface) error {
return n.execKataCmd(kataCLIDelIfaceCmd)
}
func (n *netmon) updateRoutesCLI(routes []types.Route) error {
func (n *netmon) updateRoutesCLI(routes []vcTypes.Route) error {
if err := n.storeDataToSend(routes); err != nil {
return err
}

View File

@ -16,7 +16,7 @@ import (
"runtime"
"testing"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/vishvananda/netlink"
@ -176,12 +176,12 @@ func TestConvertInterface(t *testing.T) {
linkType := "link_type_test"
expected := types.Interface{
expected := vcTypes.Interface{
Device: testIfaceName,
Name: testIfaceName,
Mtu: uint64(testMTU),
HwAddr: testHwAddr,
IPAddresses: []*types.IPAddress{
IPAddresses: []*vcTypes.IPAddress{
{
Family: netlinkFamily,
Address: testIPAddress,
@ -211,7 +211,7 @@ func TestConvertRoutes(t *testing.T) {
},
}
expected := []types.Route{
expected := []vcTypes.Route{
{
Dest: testIPAddress,
Gateway: testIPAddress,
@ -245,7 +245,7 @@ func testSetupNetwork(t *testing.T) testTeardownNetwork {
}
}
func testCreateDummyNetwork(t *testing.T, handler *netlink.Handle) (int, types.Interface) {
func testCreateDummyNetwork(t *testing.T, handler *netlink.Handle) (int, vcTypes.Interface) {
hwAddr, err := net.ParseMAC(testHwAddr)
assert.Nil(t, err)
@ -266,7 +266,7 @@ func testCreateDummyNetwork(t *testing.T, handler *netlink.Handle) (int, types.I
attrs := link.Attrs()
assert.NotNil(t, attrs)
iface := types.Interface{
iface := vcTypes.Interface{
Device: testIfaceName,
Name: testIfaceName,
Mtu: uint64(testMTU),
@ -289,7 +289,7 @@ func TestScanNetwork(t *testing.T) {
idx, expected := testCreateDummyNetwork(t, handler)
n := &netmon{
netIfaces: make(map[int]types.Interface),
netIfaces: make(map[int]vcTypes.Interface),
netHandler: handler,
}
@ -300,9 +300,9 @@ func TestScanNetwork(t *testing.T) {
}
func TestStoreDataToSend(t *testing.T) {
var got types.Interface
var got vcTypes.Interface
expected := types.Interface{
expected := vcTypes.Interface{
Device: testIfaceName,
Name: testIfaceName,
Mtu: uint64(testMTU),
@ -399,15 +399,15 @@ func TestActionsCLI(t *testing.T) {
defer os.RemoveAll(testStorageParentPath)
// Test addInterfaceCLI
err = n.addInterfaceCLI(types.Interface{})
err = n.addInterfaceCLI(vcTypes.Interface{})
assert.Nil(t, err)
// Test delInterfaceCLI
err = n.delInterfaceCLI(types.Interface{})
err = n.delInterfaceCLI(vcTypes.Interface{})
assert.Nil(t, err)
// Test updateRoutesCLI
err = n.updateRoutesCLI([]types.Route{})
err = n.updateRoutesCLI([]vcTypes.Route{})
assert.Nil(t, err)
tearDownNetworkCb := testSetupNetwork(t)
@ -465,8 +465,8 @@ func TestHandleRTMNewLink(t *testing.T) {
assert.Nil(t, err)
// Interface already exist in list
n.netIfaces = make(map[int]types.Interface)
n.netIfaces[testIfaceIndex] = types.Interface{}
n.netIfaces = make(map[int]vcTypes.Interface)
n.netIfaces[testIfaceIndex] = vcTypes.Interface{}
ev = netlink.LinkUpdate{
Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{
@ -479,7 +479,7 @@ func TestHandleRTMNewLink(t *testing.T) {
assert.Nil(t, err)
// Flags are not up and running
n.netIfaces = make(map[int]types.Interface)
n.netIfaces = make(map[int]vcTypes.Interface)
ev = netlink.LinkUpdate{
Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{
@ -492,7 +492,7 @@ func TestHandleRTMNewLink(t *testing.T) {
assert.Nil(t, err)
// Invalid link
n.netIfaces = make(map[int]types.Interface)
n.netIfaces = make(map[int]vcTypes.Interface)
ev = netlink.LinkUpdate{
Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{
@ -533,7 +533,7 @@ func TestHandleRTMDelLink(t *testing.T) {
assert.Nil(t, err)
// Interface does not exist in list
n.netIfaces = make(map[int]types.Interface)
n.netIfaces = make(map[int]vcTypes.Interface)
ev = netlink.LinkUpdate{
Link: &netlink.Dummy{
LinkAttrs: netlink.LinkAttrs{
@ -548,7 +548,7 @@ func TestHandleRTMDelLink(t *testing.T) {
func TestHandleRTMNewRouteIfaceNotFound(t *testing.T) {
n := &netmon{
netIfaces: make(map[int]types.Interface),
netIfaces: make(map[int]vcTypes.Interface),
}
err := n.handleRTMNewRoute(netlink.RouteUpdate{})

View File

@ -11,7 +11,7 @@ import (
"time"
"github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/mitchellh/mapstructure"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context"
@ -234,16 +234,16 @@ type agent interface {
reseedRNG(data []byte) error
// updateInterface will tell the agent to update a nic for an existed Sandbox.
updateInterface(inf *types.Interface) (*types.Interface, error)
updateInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error)
// listInterfaces will tell the agent to list interfaces of an existed Sandbox
listInterfaces() ([]*types.Interface, error)
listInterfaces() ([]*vcTypes.Interface, error)
// updateRoutes will tell the agent to update route table for an existed Sandbox.
updateRoutes(routes []*types.Route) ([]*types.Route, error)
updateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error)
// listRoutes will tell the agent to list routes of an existed Sandbox
listRoutes() ([]*types.Route, error)
listRoutes() ([]*vcTypes.Route, error)
// getGuestDetails will tell the agent to get some information of guest
getGuestDetails(*grpc.GuestDetailsRequest) (*grpc.GuestDetailsResponse, error)

View File

@ -13,7 +13,7 @@ import (
deviceApi "github.com/kata-containers/runtime/virtcontainers/device/api"
deviceConfig "github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
opentracing "github.com/opentracing/opentracing-go"
"github.com/sirupsen/logrus"
@ -804,7 +804,7 @@ func AddDevice(ctx context.Context, sandboxID string, info deviceConfig.DeviceIn
return s.AddDevice(info)
}
func toggleInterface(ctx context.Context, sandboxID string, inf *types.Interface, add bool) (*types.Interface, error) {
func toggleInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface, add bool) (*vcTypes.Interface, error) {
if sandboxID == "" {
return nil, errNeedSandboxID
}
@ -829,7 +829,7 @@ func toggleInterface(ctx context.Context, sandboxID string, inf *types.Interface
}
// AddInterface is the virtcontainers add interface entry point.
func AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
func AddInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
span, ctx := trace(ctx, "AddInterface")
defer span.Finish()
@ -837,7 +837,7 @@ func AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (
}
// RemoveInterface is the virtcontainers remove interface entry point.
func RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
func RemoveInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
span, ctx := trace(ctx, "RemoveInterface")
defer span.Finish()
@ -845,7 +845,7 @@ func RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface
}
// ListInterfaces is the virtcontainers list interfaces entry point.
func ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
func ListInterfaces(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error) {
span, ctx := trace(ctx, "ListInterfaces")
defer span.Finish()
@ -869,7 +869,7 @@ func ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface,
}
// UpdateRoutes is the virtcontainers update routes entry point.
func UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
func UpdateRoutes(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
span, ctx := trace(ctx, "UpdateRoutes")
defer span.Finish()
@ -893,7 +893,7 @@ func UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route)
}
// ListRoutes is the virtcontainers list routes entry point.
func ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error) {
func ListRoutes(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error) {
span, ctx := trace(ctx, "ListRoutes")
defer span.Finish()

View File

@ -19,7 +19,7 @@ import (
"github.com/containernetworking/plugins/pkg/ns"
"github.com/kata-containers/runtime/virtcontainers/pkg/mock"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/stretchr/testify/assert"
)
@ -2422,12 +2422,12 @@ func TestNetworkOperation(t *testing.T) {
cleanUp()
assert := assert.New(t)
inf := &types.Interface{
inf := &vcTypes.Interface{
Name: "eno1",
Mtu: 1500,
HwAddr: "02:00:ca:fe:00:48",
}
ip := types.IPAddress{
ip := vcTypes.IPAddress{
Family: 0,
Address: "192.168.0.101",
Mask: "24",

View File

@ -22,7 +22,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/hyperstart"
ns "github.com/kata-containers/runtime/virtcontainers/pkg/nsenter"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context"
@ -890,22 +890,22 @@ func (h *hyper) onlineCPUMem(cpus uint32, cpuOnly bool) error {
return nil
}
func (h *hyper) updateInterface(inf *types.Interface) (*types.Interface, error) {
func (h *hyper) updateInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
// hyperstart-agent does not support update interface
return nil, nil
}
func (h *hyper) listInterfaces() ([]*types.Interface, error) {
func (h *hyper) listInterfaces() ([]*vcTypes.Interface, error) {
// hyperstart-agent does not support list interfaces
return nil, nil
}
func (h *hyper) updateRoutes(routes []*types.Route) ([]*types.Route, error) {
func (h *hyper) updateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
// hyperstart-agent does not support update routes
return nil, nil
}
func (h *hyper) listRoutes() ([]*types.Route, error) {
func (h *hyper) listRoutes() ([]*vcTypes.Route, error) {
// hyperstart-agent does not support list routes
return nil, nil
}

View File

@ -15,7 +15,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
)
@ -152,26 +152,26 @@ func (impl *VCImpl) AddDevice(ctx context.Context, sandboxID string, info config
}
// AddInterface implements the VC function of the same name.
func (impl *VCImpl) AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
func (impl *VCImpl) AddInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return AddInterface(ctx, sandboxID, inf)
}
// RemoveInterface implements the VC function of the same name.
func (impl *VCImpl) RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
func (impl *VCImpl) RemoveInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return RemoveInterface(ctx, sandboxID, inf)
}
// ListInterfaces implements the VC function of the same name.
func (impl *VCImpl) ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
func (impl *VCImpl) ListInterfaces(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error) {
return ListInterfaces(ctx, sandboxID)
}
// UpdateRoutes implements the VC function of the same name.
func (impl *VCImpl) UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
func (impl *VCImpl) UpdateRoutes(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return UpdateRoutes(ctx, sandboxID, routes)
}
// ListRoutes implements the VC function of the same name.
func (impl *VCImpl) ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error) {
func (impl *VCImpl) ListRoutes(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error) {
return ListRoutes(ctx, sandboxID)
}

View File

@ -12,7 +12,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
)
@ -48,11 +48,11 @@ type VC interface {
AddDevice(ctx context.Context, sandboxID string, info config.DeviceInfo) (api.Device, error)
AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error)
UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error)
ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error)
AddInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error)
RemoveInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error)
ListInterfaces(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error)
UpdateRoutes(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error)
ListRoutes(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error)
}
// VCSandbox is the Sandbox interface
@ -93,11 +93,11 @@ type VCSandbox interface {
AddDevice(info config.DeviceInfo) (api.Device, error)
AddInterface(inf *types.Interface) (*types.Interface, error)
RemoveInterface(inf *types.Interface) (*types.Interface, error)
ListInterfaces() ([]*types.Interface, error)
UpdateRoutes(routes []*types.Route) ([]*types.Route, error)
ListRoutes() ([]*types.Route, error)
AddInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error)
RemoveInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error)
ListInterfaces() ([]*vcTypes.Interface, error)
UpdateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error)
ListRoutes() ([]*vcTypes.Route, error)
}
// VCContainer is the Container interface

View File

@ -25,7 +25,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/config"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
ns "github.com/kata-containers/runtime/virtcontainers/pkg/nsenter"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/utils"
opentracing "github.com/opentracing/opentracing-go"
@ -398,7 +398,7 @@ func (k *kataAgent) exec(sandbox *Sandbox, c Container, cmd Cmd) (*Process, erro
k.state.URL, cmd, []ns.NSType{}, enterNSList)
}
func (k *kataAgent) updateInterface(ifc *types.Interface) (*types.Interface, error) {
func (k *kataAgent) updateInterface(ifc *vcTypes.Interface) (*vcTypes.Interface, error) {
// send update interface request
ifcReq := &grpc.UpdateInterfaceRequest{
Interface: k.convertToKataAgentInterface(ifc),
@ -410,13 +410,13 @@ func (k *kataAgent) updateInterface(ifc *types.Interface) (*types.Interface, err
"resulting-interface": fmt.Sprintf("%+v", resultingInterface),
}).WithError(err).Error("update interface request failed")
}
if resultInterface, ok := resultingInterface.(*types.Interface); ok {
if resultInterface, ok := resultingInterface.(*vcTypes.Interface); ok {
return resultInterface, err
}
return nil, err
}
func (k *kataAgent) updateInterfaces(interfaces []*types.Interface) error {
func (k *kataAgent) updateInterfaces(interfaces []*vcTypes.Interface) error {
for _, ifc := range interfaces {
if _, err := k.updateInterface(ifc); err != nil {
return err
@ -425,7 +425,7 @@ func (k *kataAgent) updateInterfaces(interfaces []*types.Interface) error {
return nil
}
func (k *kataAgent) updateRoutes(routes []*types.Route) ([]*types.Route, error) {
func (k *kataAgent) updateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
if routes != nil {
routesReq := &grpc.UpdateRoutesRequest{
Routes: &grpc.Routes{
@ -448,7 +448,7 @@ func (k *kataAgent) updateRoutes(routes []*types.Route) ([]*types.Route, error)
return nil, nil
}
func (k *kataAgent) listInterfaces() ([]*types.Interface, error) {
func (k *kataAgent) listInterfaces() ([]*vcTypes.Interface, error) {
req := &grpc.ListInterfacesRequest{}
resultingInterfaces, err := k.sendReq(req)
if err != nil {
@ -461,7 +461,7 @@ func (k *kataAgent) listInterfaces() ([]*types.Interface, error) {
return nil, err
}
func (k *kataAgent) listRoutes() ([]*types.Route, error) {
func (k *kataAgent) listRoutes() ([]*vcTypes.Route, error) {
req := &grpc.ListRoutesRequest{}
resultingRoutes, err := k.sendReq(req)
if err != nil {
@ -1664,7 +1664,7 @@ func (k *kataAgent) convertToIPFamily(ipFamily aTypes.IPFamily) int {
return netlink.FAMILY_V4
}
func (k *kataAgent) convertToKataAgentIPAddresses(ipAddrs []*types.IPAddress) (aIPAddrs []*aTypes.IPAddress) {
func (k *kataAgent) convertToKataAgentIPAddresses(ipAddrs []*vcTypes.IPAddress) (aIPAddrs []*aTypes.IPAddress) {
for _, ipAddr := range ipAddrs {
if ipAddr == nil {
continue
@ -1682,13 +1682,13 @@ func (k *kataAgent) convertToKataAgentIPAddresses(ipAddrs []*types.IPAddress) (a
return aIPAddrs
}
func (k *kataAgent) convertToIPAddresses(aIPAddrs []*aTypes.IPAddress) (ipAddrs []*types.IPAddress) {
func (k *kataAgent) convertToIPAddresses(aIPAddrs []*aTypes.IPAddress) (ipAddrs []*vcTypes.IPAddress) {
for _, aIPAddr := range aIPAddrs {
if aIPAddr == nil {
continue
}
ipAddr := &types.IPAddress{
ipAddr := &vcTypes.IPAddress{
Family: k.convertToIPFamily(aIPAddr.Family),
Address: aIPAddr.Address,
Mask: aIPAddr.Mask,
@ -1700,7 +1700,7 @@ func (k *kataAgent) convertToIPAddresses(aIPAddrs []*aTypes.IPAddress) (ipAddrs
return ipAddrs
}
func (k *kataAgent) convertToKataAgentInterface(iface *types.Interface) *aTypes.Interface {
func (k *kataAgent) convertToKataAgentInterface(iface *vcTypes.Interface) *aTypes.Interface {
if iface == nil {
return nil
}
@ -1715,13 +1715,13 @@ func (k *kataAgent) convertToKataAgentInterface(iface *types.Interface) *aTypes.
}
}
func (k *kataAgent) convertToInterfaces(aIfaces []*aTypes.Interface) (ifaces []*types.Interface) {
func (k *kataAgent) convertToInterfaces(aIfaces []*aTypes.Interface) (ifaces []*vcTypes.Interface) {
for _, aIface := range aIfaces {
if aIface == nil {
continue
}
iface := &types.Interface{
iface := &vcTypes.Interface{
Device: aIface.Device,
Name: aIface.Name,
IPAddresses: k.convertToIPAddresses(aIface.IPAddresses),
@ -1736,7 +1736,7 @@ func (k *kataAgent) convertToInterfaces(aIfaces []*aTypes.Interface) (ifaces []*
return ifaces
}
func (k *kataAgent) convertToKataAgentRoutes(routes []*types.Route) (aRoutes []*aTypes.Route) {
func (k *kataAgent) convertToKataAgentRoutes(routes []*vcTypes.Route) (aRoutes []*aTypes.Route) {
for _, route := range routes {
if route == nil {
continue
@ -1756,13 +1756,13 @@ func (k *kataAgent) convertToKataAgentRoutes(routes []*types.Route) (aRoutes []*
return aRoutes
}
func (k *kataAgent) convertToRoutes(aRoutes []*aTypes.Route) (routes []*types.Route) {
func (k *kataAgent) convertToRoutes(aRoutes []*aTypes.Route) (routes []*vcTypes.Route) {
for _, aRoute := range aRoutes {
if aRoute == nil {
continue
}
route := &types.Route{
route := &vcTypes.Route{
Dest: aRoute.Dest,
Gateway: aRoute.Gateway,
Device: aRoute.Device,

View File

@ -31,7 +31,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/manager"
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/runtime/virtcontainers/pkg/mock"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
)
var (
@ -817,7 +817,7 @@ func TestAgentNetworkOperation(t *testing.T) {
_, err = k.listInterfaces()
assert.Nil(err)
_, err = k.updateRoutes([]*types.Route{})
_, err = k.updateRoutes([]*vcTypes.Route{})
assert.Nil(err)
_, err = k.listRoutes()

View File

@ -22,7 +22,7 @@ import (
"github.com/vishvananda/netns"
"golang.org/x/sys/unix"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/pkg/uuid"
"github.com/kata-containers/runtime/virtcontainers/utils"
)
@ -1196,18 +1196,18 @@ func deleteNetNS(netNSPath string) error {
return nil
}
func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*types.Interface, []*types.Route, error) {
func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*vcTypes.Interface, []*vcTypes.Route, error) {
if networkNS.NetNsPath == "" {
return nil, nil, nil
}
var routes []*types.Route
var ifaces []*types.Interface
var routes []*vcTypes.Route
var ifaces []*vcTypes.Interface
for _, endpoint := range networkNS.Endpoints {
var ipAddresses []*types.IPAddress
var ipAddresses []*vcTypes.IPAddress
for _, addr := range endpoint.Properties().Addrs {
// Skip IPv6 because not supported
if addr.IP.To4() == nil {
@ -1223,14 +1223,14 @@ func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*types.Interface
continue
}
netMask, _ := addr.Mask.Size()
ipAddress := types.IPAddress{
ipAddress := vcTypes.IPAddress{
Family: netlink.FAMILY_V4,
Address: addr.IP.String(),
Mask: fmt.Sprintf("%d", netMask),
}
ipAddresses = append(ipAddresses, &ipAddress)
}
ifc := types.Interface{
ifc := vcTypes.Interface{
IPAddresses: ipAddresses,
Device: endpoint.Name(),
Name: endpoint.Name(),
@ -1242,7 +1242,7 @@ func generateInterfacesAndRoutes(networkNS NetworkNamespace) ([]*types.Interface
ifaces = append(ifaces, &ifc)
for _, route := range endpoint.Properties().Routes {
var r types.Route
var r vcTypes.Route
if route.Dst != nil {
r.Dest = route.Dst.String()

View File

@ -11,7 +11,7 @@ import (
"reflect"
"testing"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/stretchr/testify/assert"
"github.com/vishvananda/netlink"
)
@ -161,16 +161,16 @@ func TestGenerateInterfacesAndRoutes(t *testing.T) {
//
// Build expected results:
//
expectedAddresses := []*types.IPAddress{
expectedAddresses := []*vcTypes.IPAddress{
{Family: netlink.FAMILY_V4, Address: "172.17.0.2", Mask: "16"},
{Family: netlink.FAMILY_V4, Address: "182.17.0.2", Mask: "16"},
}
expectedInterfaces := []*types.Interface{
expectedInterfaces := []*vcTypes.Interface{
{Device: "eth0", Name: "eth0", IPAddresses: expectedAddresses, Mtu: 1500, HwAddr: "02:00:ca:fe:00:04"},
}
expectedRoutes := []*types.Route{
expectedRoutes := []*vcTypes.Route{
{Dest: "", Gateway: "172.17.0.1", Device: "eth0", Source: "", Scope: uint32(254)},
{Dest: "172.17.0.0/16", Gateway: "172.17.0.1", Device: "eth0", Source: "172.17.0.2"},
}

View File

@ -10,7 +10,7 @@ import (
"time"
"github.com/kata-containers/agent/protocols/grpc"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/net/context"
)
@ -96,22 +96,22 @@ func (n *noopAgent) onlineCPUMem(cpus uint32, cpuOnly bool) error {
}
// updateInterface is the Noop agent Interface update implementation. It does nothing.
func (n *noopAgent) updateInterface(inf *types.Interface) (*types.Interface, error) {
func (n *noopAgent) updateInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
// listInterfaces is the Noop agent Interfaces list implementation. It does nothing.
func (n *noopAgent) listInterfaces() ([]*types.Interface, error) {
func (n *noopAgent) listInterfaces() ([]*vcTypes.Interface, error) {
return nil, nil
}
// updateRoutes is the Noop agent Routes update implementation. It does nothing.
func (n *noopAgent) updateRoutes(routes []*types.Route) ([]*types.Route, error) {
func (n *noopAgent) updateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return nil, nil
}
// listRoutes is the Noop agent Routes list implementation. It does nothing.
func (n *noopAgent) listRoutes() ([]*types.Route, error) {
func (n *noopAgent) listRoutes() ([]*vcTypes.Route, error) {
return nil, nil
}

View File

@ -23,7 +23,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
)
@ -254,7 +254,7 @@ func (m *VCMock) AddDevice(ctx context.Context, sandboxID string, info config.De
}
// AddInterface implements the VC function of the same name.
func (m *VCMock) AddInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
func (m *VCMock) AddInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
if m.AddInterfaceFunc != nil {
return m.AddInterfaceFunc(ctx, sandboxID, inf)
}
@ -263,7 +263,7 @@ func (m *VCMock) AddInterface(ctx context.Context, sandboxID string, inf *types.
}
// RemoveInterface implements the VC function of the same name.
func (m *VCMock) RemoveInterface(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error) {
func (m *VCMock) RemoveInterface(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
if m.RemoveInterfaceFunc != nil {
return m.RemoveInterfaceFunc(ctx, sandboxID, inf)
}
@ -272,7 +272,7 @@ func (m *VCMock) RemoveInterface(ctx context.Context, sandboxID string, inf *typ
}
// ListInterfaces implements the VC function of the same name.
func (m *VCMock) ListInterfaces(ctx context.Context, sandboxID string) ([]*types.Interface, error) {
func (m *VCMock) ListInterfaces(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error) {
if m.ListInterfacesFunc != nil {
return m.ListInterfacesFunc(ctx, sandboxID)
}
@ -281,7 +281,7 @@ func (m *VCMock) ListInterfaces(ctx context.Context, sandboxID string) ([]*types
}
// UpdateRoutes implements the VC function of the same name.
func (m *VCMock) UpdateRoutes(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error) {
func (m *VCMock) UpdateRoutes(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
if m.UpdateRoutesFunc != nil {
return m.UpdateRoutesFunc(ctx, sandboxID, routes)
}
@ -290,7 +290,7 @@ func (m *VCMock) UpdateRoutes(ctx context.Context, sandboxID string, routes []*t
}
// ListRoutes implements the VC function of the same name.
func (m *VCMock) ListRoutes(ctx context.Context, sandboxID string) ([]*types.Route, error) {
func (m *VCMock) ListRoutes(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error) {
if m.ListRoutesFunc != nil {
return m.ListRoutesFunc(ctx, sandboxID)
}

View File

@ -13,7 +13,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/factory"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
@ -748,7 +748,7 @@ func TestVCMockAddInterface(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.AddInterfaceFunc = func(ctx context.Context, sid string, inf *types.Interface) (*types.Interface, error) {
m.AddInterfaceFunc = func(ctx context.Context, sid string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
@ -775,7 +775,7 @@ func TestVCMockRemoveInterface(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.RemoveInterfaceFunc = func(ctx context.Context, sid string, inf *types.Interface) (*types.Interface, error) {
m.RemoveInterfaceFunc = func(ctx context.Context, sid string, inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
@ -802,7 +802,7 @@ func TestVCMockListInterfaces(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.ListInterfacesFunc = func(ctx context.Context, sid string) ([]*types.Interface, error) {
m.ListInterfacesFunc = func(ctx context.Context, sid string) ([]*vcTypes.Interface, error) {
return nil, nil
}
@ -829,7 +829,7 @@ func TestVCMockUpdateRoutes(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.UpdateRoutesFunc = func(ctx context.Context, sid string, routes []*types.Route) ([]*types.Route, error) {
m.UpdateRoutesFunc = func(ctx context.Context, sid string, routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return nil, nil
}
@ -856,7 +856,7 @@ func TestVCMockListRoutes(t *testing.T) {
assert.Error(err)
assert.True(IsMockError(err))
m.ListRoutesFunc = func(ctx context.Context, sid string) ([]*types.Route, error) {
m.ListRoutesFunc = func(ctx context.Context, sid string) ([]*vcTypes.Route, error) {
return nil, nil
}

View File

@ -12,7 +12,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
@ -188,26 +188,26 @@ func (s *Sandbox) AddDevice(info config.DeviceInfo) (api.Device, error) {
}
// AddInterface implements the VCSandbox function of the same name.
func (s *Sandbox) AddInterface(inf *types.Interface) (*types.Interface, error) {
func (s *Sandbox) AddInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
// RemoveInterface implements the VCSandbox function of the same name.
func (s *Sandbox) RemoveInterface(inf *types.Interface) (*types.Interface, error) {
func (s *Sandbox) RemoveInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
return nil, nil
}
// ListInterfaces implements the VCSandbox function of the same name.
func (s *Sandbox) ListInterfaces() ([]*types.Interface, error) {
func (s *Sandbox) ListInterfaces() ([]*vcTypes.Interface, error) {
return nil, nil
}
// UpdateRoutes implements the VCSandbox function of the same name.
func (s *Sandbox) UpdateRoutes(routes []*types.Route) ([]*types.Route, error) {
func (s *Sandbox) UpdateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return nil, nil
}
// ListRoutes implements the VCSandbox function of the same name.
func (s *Sandbox) ListRoutes() ([]*types.Route, error) {
func (s *Sandbox) ListRoutes() ([]*vcTypes.Route, error) {
return nil, nil
}

View File

@ -12,7 +12,7 @@ import (
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/device/api"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
)
@ -69,9 +69,9 @@ type VCMock struct {
AddDeviceFunc func(ctx context.Context, sandboxID string, info config.DeviceInfo) (api.Device, error)
AddInterfaceFunc func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
RemoveInterfaceFunc func(ctx context.Context, sandboxID string, inf *types.Interface) (*types.Interface, error)
ListInterfacesFunc func(ctx context.Context, sandboxID string) ([]*types.Interface, error)
UpdateRoutesFunc func(ctx context.Context, sandboxID string, routes []*types.Route) ([]*types.Route, error)
ListRoutesFunc func(ctx context.Context, sandboxID string) ([]*types.Route, error)
AddInterfaceFunc func(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error)
RemoveInterfaceFunc func(ctx context.Context, sandboxID string, inf *vcTypes.Interface) (*vcTypes.Interface, error)
ListInterfacesFunc func(ctx context.Context, sandboxID string) ([]*vcTypes.Interface, error)
UpdateRoutesFunc func(ctx context.Context, sandboxID string, routes []*vcTypes.Route) ([]*vcTypes.Route, error)
ListRoutesFunc func(ctx context.Context, sandboxID string) ([]*vcTypes.Route, error)
}

View File

@ -26,7 +26,7 @@ import (
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
deviceManager "github.com/kata-containers/runtime/virtcontainers/device/manager"
"github.com/kata-containers/runtime/virtcontainers/pkg/types"
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
"github.com/kata-containers/runtime/virtcontainers/utils"
"github.com/vishvananda/netlink"
)
@ -1094,7 +1094,7 @@ func (s *Sandbox) removeNetwork() error {
return s.network.remove(s, s.factory != nil)
}
func (s *Sandbox) generateNetInfo(inf *types.Interface) (NetworkInfo, error) {
func (s *Sandbox) generateNetInfo(inf *vcTypes.Interface) (NetworkInfo, error) {
hw, err := net.ParseMAC(inf.HwAddr)
if err != nil {
return NetworkInfo{}, err
@ -1125,7 +1125,7 @@ func (s *Sandbox) generateNetInfo(inf *types.Interface) (NetworkInfo, error) {
}
// AddInterface adds new nic to the sandbox.
func (s *Sandbox) AddInterface(inf *types.Interface) (*types.Interface, error) {
func (s *Sandbox) AddInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
netInfo, err := s.generateNetInfo(inf)
if err != nil {
return nil, err
@ -1156,7 +1156,7 @@ func (s *Sandbox) AddInterface(inf *types.Interface) (*types.Interface, error) {
}
// RemoveInterface removes a nic of the sandbox.
func (s *Sandbox) RemoveInterface(inf *types.Interface) (*types.Interface, error) {
func (s *Sandbox) RemoveInterface(inf *vcTypes.Interface) (*vcTypes.Interface, error) {
for i, endpoint := range s.networkNS.Endpoints {
if endpoint.HardwareAddr() == inf.HwAddr {
s.Logger().WithField("endpoint-type", endpoint.Type()).Info("Hot detaching endpoint")
@ -1174,17 +1174,17 @@ func (s *Sandbox) RemoveInterface(inf *types.Interface) (*types.Interface, error
}
// ListInterfaces lists all nics and their configurations in the sandbox.
func (s *Sandbox) ListInterfaces() ([]*types.Interface, error) {
func (s *Sandbox) ListInterfaces() ([]*vcTypes.Interface, error) {
return s.agent.listInterfaces()
}
// UpdateRoutes updates the sandbox route table (e.g. for portmapping support).
func (s *Sandbox) UpdateRoutes(routes []*types.Route) ([]*types.Route, error) {
func (s *Sandbox) UpdateRoutes(routes []*vcTypes.Route) ([]*vcTypes.Route, error) {
return s.agent.updateRoutes(routes)
}
// ListRoutes lists all routes and their configurations in the sandbox.
func (s *Sandbox) ListRoutes() ([]*types.Route, error) {
func (s *Sandbox) ListRoutes() ([]*vcTypes.Route, error) {
return s.agent.listRoutes()
}