Documentation
¶
Index ¶
- func AddOutputPortToMirror(portUUID, mirrorName string) (string, error)
- func AddSelectPortToMirror(portUUID, mirrorName string, ingress, egress bool) (bool, error)
- func CheckEmptyMirrorsExistence(mirrorNames []string, exists bool)
- func CheckPortsInMirrors(mirrors []types.Mirror, hasExternalOwner bool, ovsPortOwner string, ...) bool
- func ContainsElement(list []string, el string) bool
- func CreateEmptyMirrors(bridgeName string, mirrorNames []string, ovsPortOwner string)
- func GetMirrorAttribute(mirrorName, attributeName string) (string, error)
- func GetMirrorDstPorts(mirrorName string) ([]string, error)
- func GetMirrorOutputPorts(mirrorName string) ([]string, error)
- func GetMirrorPorts(mirrorName string, attributeName SelectPort) ([]string, error)
- func GetMirrorSrcPorts(mirrorName string) ([]string, error)
- func GetPortUUIDByName(name string) (string, error)
- func GetPortUUIDFromResult(r cnitypes.Result) string
- func IsMirrorExists(name string) (bool, error)
- func OnlyContainsOrEmpty(list []string, el string) bool
- func ToJSONString(input interface{}) (string, error)
- type MirrorNet040
- type MirrorNetCurrent
- type SelectPort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOutputPortToMirror ¶
AddOutputPortToMirror adds portUUID as 'output_port' to a specific mirror via 'ovs-vsctl'
func AddSelectPortToMirror ¶
AddSelectPortToMirror adds portUUID to a specific mirror via 'ovs-vsctl' as 'select_*' based on ingress and egress values. ingress == true => adds portUUID as 'select_src_port' egress == true => adds portUUID as 'select_dst_port'
func CheckEmptyMirrorsExistence ¶
CheckEmptyMirrorsExistence checks if all mirrors exist or not, based on 'exists' value.
func CheckPortsInMirrors ¶
func CheckPortsInMirrors(mirrors []types.Mirror, hasExternalOwner bool, ovsPortOwner string, results ...cnitypes.Result) bool
CheckPortsInMirrors extracts ports from results and check if every mirror contains those port UUIDs. Since it's not possibile to have mirrors without both ingress and egress, it's enough finding the port in either ingress or egress. It also verify the mirror owner using 'external_ids' attribute. You can skip this check with hasExternalOwner=true.
func ContainsElement ¶
ContainsElement returns true if a list of strings contains a string element
func CreateEmptyMirrors ¶
CreateEmptyMirrors creates multiple mirrors in a bridge with an optional owner in external_ids. If ovsPortOwner is an empty string, it will leave external_ids empty.
func GetMirrorAttribute ¶
GetMirrorAttribute gets a mirror attribute
func GetMirrorDstPorts ¶
GetMirrorDstPorts gets 'select_dst_port' of a mirror as a string slice
func GetMirrorOutputPorts ¶
GetMirrorOutputPorts gets 'output_port' of a mirror as a string slice
func GetMirrorPorts ¶
func GetMirrorPorts(mirrorName string, attributeName SelectPort) ([]string, error)
GetMirrorPorts gets either 'select_src_port' or 'select_dst_port of a mirror
func GetMirrorSrcPorts ¶
GetMirrorSrcPorts gets 'select_src_port' of a mirror as a string slice
func GetPortUUIDByName ¶
GetPortUUIDByName gets a portUUID by its name
func GetPortUUIDFromResult ¶
GetPortUUIDFromResult gets portUUID from a cnitypes.Result object
func IsMirrorExists ¶
IsMirrorExists checks if a mirror exists by its name
func OnlyContainsOrEmpty ¶
OnlyContainsOrEmpty checks if a list of strings contains only 'el' element or is empty
func ToJSONString ¶
ToJSONString coverts input into a JSON string
Types ¶
type MirrorNet040 ¶
type MirrorNet040 struct { CNIVersion string `json:"cniVersion"` Name string `json:"name"` Type string `json:"type"` Bridge string `json:"bridge"` Mirrors []*types.Mirror `json:"mirrors"` RawPrevResult map[string]interface{} `json:"prevResult,omitempty"` PrevResult types040.Result `json:"-"` }
MirrorNet040 struct that represent the network configuration for CNI spec 0.4.0
type MirrorNetCurrent ¶
type MirrorNetCurrent struct { CNIVersion string `json:"cniVersion"` Name string `json:"name"` Type string `json:"type"` Bridge string `json:"bridge"` Mirrors []*types.Mirror `json:"mirrors"` RawPrevResult map[string]interface{} `json:"prevResult,omitempty"` PrevResult current.Result `json:"-"` }
MirrorNetCurrent struct that represent the network configuration for CNI spec 1.0.0
type SelectPort ¶
type SelectPort string
SelectPort type that represent the kind of select_*_port
const ( // SelectSrcPort const with value "select_src_port" // (ports on which arriving packets are selected for mirroring) SelectSrcPort SelectPort = "select_src_port" // SelectDstPort const with value "select_dst_port" // (ports on which departing packets are selected for mirroring) SelectDstPort SelectPort = "select_dst_port" )