Documentation
¶
Overview ¶
Package impl implements handlers for agentctl commands.
Index ¶
- func AddCommonIfPutFlags(cmd *cobra.Command)
- func AddInterfaceNameFlag(cmd *cobra.Command)
- func IfJSONPut(endpoints []string, label string)
- func InterfaceDel(endpoints []string, label string)
- func PutAfPkt(endpoints []string, label string, flags *interfaces.AfpacketLink)
- func PutEthernet(endpoints []string, label string)
- func PutLoopback(endpoints []string, label string)
- type IfaceCommonFields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommonIfPutFlags ¶
AddCommonIfPutFlags adds flags common for all interface types.
func AddInterfaceNameFlag ¶
AddInterfaceNameFlag adds a name flag to interface flags.
func IfJSONPut ¶
// PutMemif creates a memif type interface.
func PutMemif(endpoints []string, label string, flags *interfaces.MemifLink) {
found, key, ifc, db := utils.GetInterfaceKeyAndValue(endpoints, label, ifCommonFields.Name)
processCommonIfFlags(found, interfaces.Interface_MEMIF, ifc)
// Process MEMIF-specific flags.
if utils.IsFlagPresent(utils.MemifMaster) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.Master = flags.Master
}
if utils.IsFlagPresent(utils.MemifMode) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.Mode = flags.Mode
}
if utils.IsFlagPresent(utils.MemifID) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.Id = flags.Id
}
if flags.SocketFilename != "" {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.SocketFilename = flags.SocketFilename
}
if flags.Secret != "" {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.Secret = flags.Secret
}
if utils.IsFlagPresent(utils.MemifRingSize) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.RingSize = flags.RingSize
}
if utils.IsFlagPresent(utils.MemifBufferSize) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.BufferSize = flags.BufferSize
}
if utils.IsFlagPresent(utils.MemifRxQueues) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.RxQueues = flags.RxQueues
}
if utils.IsFlagPresent(utils.MemifTxQueues) {
if ifc.Memif == nil {
ifc.Memif = &interfaces.Interfaces_Interface_Memif{}
}
ifc.Memif.TxQueues = flags.TxQueues
}
utils.WriteInterfaceToDb(db, key, ifc)
}
// PutTap creates a tap type interface.
func PutTap(endpoints []string, label string) {
found, key, ifc, db := utils.GetInterfaceKeyAndValue(endpoints, label, ifCommonFields.Name)
processCommonIfFlags(found, interfaces.InterfaceType_TAP_INTERFACE, ifc)
utils.WriteInterfaceToDb(db, key, ifc)
}
// PutVxLan creates a vxlan type interface.
func PutVxLan(endpoints []string, label string, flags *interfaces.Interfaces_Interface_Vxlan) {
found, key, ifc, db := utils.GetInterfaceKeyAndValue(endpoints, label, ifCommonFields.Name)
processCommonIfFlags(found, interfaces.InterfaceType_VXLAN_TUNNEL, ifc)
// Process VXLAN-specific flags.
if flags.SrcAddress != "" {
if ifc.Vxlan == nil {
ifc.Vxlan = &interfaces.Interfaces_Interface_Vxlan{}
}
if utils.ValidateIpv4Addr(flags.SrcAddress) || utils.ValidateIpv6Addr(flags.SrcAddress) {
ifc.Vxlan.SrcAddress = flags.SrcAddress
} else {
utils.ExitWithError(utils.ExitBadArgs, errors.New("Invalid "+utils.VxLanSrcAddr+" "+flags.SrcAddress))
}
}
if flags.DstAddress != "" {
if ifc.Vxlan == nil {
ifc.Vxlan = &interfaces.Interfaces_Interface_Vxlan{}
}
if utils.ValidateIpv4Addr(flags.DstAddress) || utils.ValidateIpv6Addr(flags.DstAddress) {
ifc.Vxlan.DstAddress = flags.DstAddress
} else {
utils.ExitWithError(utils.ExitBadArgs, errors.New("Invalid "+utils.VxLanDstAddr+" "+flags.DstAddress))
}
}
if utils.IsFlagPresent(utils.VxLanVni) && flags.Vni > 0 {
if ifc.Vxlan == nil {
ifc.Vxlan = &interfaces.Interfaces_Interface_Vxlan{}
}
ifc.Vxlan.Vni = flags.Vni
}
utils.WriteInterfaceToDb(db, key, ifc)
}
IfJSONPut creates an interface according to json configuration.
func InterfaceDel ¶
InterfaceDel removes the interface with defined name.
func PutAfPkt ¶
func PutAfPkt(endpoints []string, label string, flags *interfaces.AfpacketLink)
PutAfPkt creates an Af-packet type interface.
func PutEthernet ¶
PutEthernet creates an ethernet type interface.
Types ¶
Source Files
¶
- bridge_domains.go
- doc.go
- interfaces.go
Click to show internal directories.
Click to hide internal directories.