Documentation ¶
Overview ¶
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
* Tencent is pleased to support the open source community by making TKEStack available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func CheckContainerTopology(nsPath, containerCidr, gwIP string)
- func CleanupCNIData(networkName string) error
- func CleanupDummy() error
- func CleanupIFace(name ...string)
- func CleanupNetNS()
- func CmdAdd(containerId, ifaceCidr, argsStr, cniName, expectResult string, ...) string
- func CmdDel(containerId, cniName string, netConfStdin []byte)
- func Command(cmd string, args ...string) *exec.Cmd
- func Curl(ip, port string) ([]byte, error)
- func DebugLog(str ...string)
- func DelNetNS(containerId string) error
- func ExecCNI(cniName string, netConfStdin []byte, args *invoke.Args) error
- func ExecCNIWithResult(cniName string, netConfStdin []byte, args *invoke.Args) (types.Result, error)
- func Gateway(ipNet net.IPNet) net.IP
- func IPInfo(cidr string, vlan uint16) (string, error)
- func IPInfos(cidr string, vlan uint16, cidr2 string, vlan2 uint16) (string, error)
- func NewContainerId() string
- func NewNetNS(containerId string) (string, error)
- func Ping(ip string) ([]byte, error)
- func ProjectDir() string
- func SetupDummyDev(ifName, cidr string) error
- func SetupVlanDev(ifName, parent, cidr string, vlanID int) error
- type LinkDevice
- type NetworkTopology
- type Route
Constants ¶
This section is empty.
Variables ¶
var ( CNI_IFNAME = "eth0" NetNS_PREFIX = "test_" NetNS_PATH = "/var/run/netns" )
Functions ¶
func CheckContainerTopology ¶
func CheckContainerTopology(nsPath, containerCidr, gwIP string)
CheckContainerTopology checks network topology is expected in container
func CleanupCNIData ¶
func CleanupDummy ¶
func CleanupDummy() error
func CleanupIFace ¶
func CleanupIFace(name ...string)
func CleanupNetNS ¶
func CleanupNetNS()
func CmdAdd ¶
func CmdAdd(containerId, ifaceCidr, argsStr, cniName, expectResult string, netConfStdin []byte) string
CmdAdd calls cni binary to do cmdAdd for container
func ExecCNIWithResult ¶
func ExecCNIWithResult(cniName string, netConfStdin []byte, args *invoke.Args) (types.Result, error)
ip netns add ctn CNI_ARGS="IP=192.168.33.3" CNI_COMMAND="ADD" CNI_CONTAINERID=ctn1 CNI_NETNS=/var/run/netns/ctn CNI_IFNAME=eth0 CNI_PATH=`pwd`/bin galaxy-vlan < /etc/cni/net.d/10-mynet.conf
func NewContainerId ¶
func NewContainerId() string
func ProjectDir ¶
func ProjectDir() string
func SetupDummyDev ¶
func SetupVlanDev ¶
Types ¶
type LinkDevice ¶
type LinkDevice struct { Parent *LinkDevice Master *LinkDevice Addr *net.IPNet Type string Name string }
func NewDummyVlan ¶
func NewDummyVlan(cidrIPNet *net.IPNet, vlanId int) *LinkDevice
func NewLinkDevice ¶
func NewLinkDevice(addr *net.IPNet, name, typeStr string) *LinkDevice
func (*LinkDevice) SetMaster ¶
func (n *LinkDevice) SetMaster(master *LinkDevice) *LinkDevice
func (*LinkDevice) SetParent ¶
func (n *LinkDevice) SetParent(parent *LinkDevice) *LinkDevice
type NetworkTopology ¶
type NetworkTopology struct { LeaveDevices []*LinkDevice Routes []Route Netns string // all these objects are in netns // contains filtered or unexported fields }
func (*NetworkTopology) Verify ¶
func (t *NetworkTopology) Verify() error
func (*NetworkTopology) VerifyNeighs ¶
func (t *NetworkTopology) VerifyNeighs() []error
func (*NetworkTopology) VerifyRoutes ¶
func (t *NetworkTopology) VerifyRoutes() []error