Documentation ¶
Index ¶
- Constants
- func DeleteDataFromDb(db keyval.ProtoBroker, key string, labelFilter []string, typeFilter []string) (bool, error)
- func DeleteFibDataFromDb(db keyval.ProtoBroker, key string)
- func ExitWithError(code int, err error)
- func GetBridgeDomainKeyAndValue(endpoints []string, label string, bdName string) (bool, string, *l2.BridgeDomains_BridgeDomain, keyval.ProtoBroker)
- func GetDbForAllAgents(endpoints []string) (keyval.ProtoBroker, error)
- func GetDbForOneAgent(endpoints []string, agentLabel string) (keyval.ProtoBroker, error)
- func GetFibEntry(endpoints []string, label string, bdLabel string, fibMac string) (bool, string, *l2.FibTableEntries_FibTableEntry)
- func GetInterfaceKeyAndValue(endpoints []string, label string, ifName string) (bool, string, *interfaces.Interfaces_Interface, keyval.ProtoBroker)
- func IsFlagPresent(flag string) bool
- func ParseKey(key string) (label string, dataType string, name string, plugStatCfgRev string)
- func UpdateIpv4Address(old []string, updates []string) []string
- func UpdateIpv6Address(old []string, updates []string) []string
- func ValidateIpv4Addr(ipv4Addr string) bool
- func ValidateIpv6Addr(ipv6Addr string) bool
- func ValidatePhyAddr(pAddr string)
- func WriteBridgeDomainToDb(db keyval.ProtoBroker, key string, bd *l2.BridgeDomains_BridgeDomain)
- func WriteFibDataToDb(db keyval.ProtoBroker, key string, fib *l2.FibTableEntries_FibTableEntry)
- func WriteInterfaceToDb(db keyval.ProtoBroker, key string, ifc *interfaces.Interfaces_Interface)
- type BdConfigWithMD
- type BdStateWithMD
- type BdWithMD
- type BridgeDomainErrorWithMD
- type EtcdDump
- func (ed EtcdDump) CreateEmptyRecord(key string)
- func (ed EtcdDump) PrintDataAsJSON(filter []string) (*bytes.Buffer, error)
- func (ed EtcdDump) PrintDataAsTable(table *goterm.Table, filter []string, short bool, active bool) (*goterm.Table, error)
- func (ed EtcdDump) PrintDataAsText(showEtcd bool, printAsTree bool) (*bytes.Buffer, error)
- func (ed EtcdDump) ReadDataFromDb(db keyval.ProtoBroker, key string, labelFilter []string, typeFilter []string) (found bool, err error)
- type FibTableWithMD
- type IfConfigWithMD
- type IfStateWithMD
- type InterfaceErrorWithMD
- type InterfaceWithMD
- type PfxStack
- type PfxStackEntry
- type PrintLine
- type StaticRoutesWithMD
- type TableVppDataContext
- type TreeWriter
- type VppData
- type VppMetaData
- type VppStatusWithMD
- type XconnectWithMD
Constants ¶
const ( ExitSuccess = iota ExitError ExitBadConnection ExitInvalidInput ExitBadFeature ExitInterrupted ExitIO ExitBadArgs = 128 )
Common exit flags
const ( HostIfName = "host-if-name" MemifMaster = "master" MemifMode = "mode" MemifID = "id" MemifSktFileName = "sock-filename" MemifSecret = "secret" MemifRingSize = "ring-size" MemifBufferSize = "buffer-size" MemifRxQueues = "rx-queues" MemifTxQueues = "tx-queues" VxLanSrcAddr = "src-addr" VxLanDstAddr = "dst-addr" VxLanVni = "vni" )
Interface flag names
const ( BDName = "bridge-domain-name" IfName = "interface-name" BVI = "bvi" SHZ = "split-horizon-group" IPAddress = "ip-address" PhysAddress = "physical-address" StaticConfig = "static-config" IsDrop = "is-drop" IsDelete = "is-delete" )
Bridge domain flag names
const ( // IfConfig labels used by json formatter IfConfig = "INTERFACE CONFIG" // IfState labels used by json formatter IfState = "INTERFACE STATE" // BdConfig labels used by json formatter BdConfig = "BRIDGE DOMAINS CONFIG" // BdState labels used by json formatter BdState = "BRIDGE DOMAINS State" // L2FibConfig labels used by json formatter L2FibConfig = "L2 FIB TABLE" // L3FibConfig labels used by json formatter L3FibConfig = "L3 FIB TABLE" )
const ( InPkt string = "IN-PKT" InBytes string = "IN-BYTES" InErrPkt string = "IN-ERR-PKT" InMissPkt string = "IN-MISS-PKT" InNoBuf string = "IN-NO-BUFF" OutPkt string = "OUT-PKT" OutBytes string = "OUT-BYTES" OutErrPkt string = "OUT-ERR-PKT" Drop string = "DROP" Punt string = "PUNT" Ipv4Pkt string = "IPV4-PKT" Ipv6Pkt string = "IPV6-PKT" NoData string = "Nothing to show, add some data or change the filter" NoSpace string = "There is not enough space to show the whole table. Use --short" )
Used as a header/info message
Variables ¶
This section is empty.
Functions ¶
func DeleteDataFromDb ¶
func DeleteDataFromDb(db keyval.ProtoBroker, key string, labelFilter []string, typeFilter []string) (bool, error)
DeleteDataFromDb deletes the specified Key from the database, if the Key matches both the labelFilter and the dataFilter.
The function returns an error if the etcd client encountered an error. The function returns true if the specified item has been found and successfully deleted.
func DeleteFibDataFromDb ¶
func DeleteFibDataFromDb(db keyval.ProtoBroker, key string)
DeleteFibDataFromDb removes FIB entry from the ETCD
func ExitWithError ¶
ExitWithError is used by all commands to print out an error and exit.
func GetBridgeDomainKeyAndValue ¶
func GetBridgeDomainKeyAndValue(endpoints []string, label string, bdName string) (bool, string, *l2.BridgeDomains_BridgeDomain, keyval.ProtoBroker)
GetBridgeDomainKeyAndValue returns true if a bridge domain with the specified name was found together with the BD key, data and data broker
func GetDbForAllAgents ¶
func GetDbForAllAgents(endpoints []string) (keyval.ProtoBroker, error)
GetDbForAllAgents opens a connection to Etcd specified in the command line or the "ETCDV3_ENDPOINTS" environment variable
func GetDbForOneAgent ¶
func GetDbForOneAgent(endpoints []string, agentLabel string) (keyval.ProtoBroker, error)
GetDbForOneAgent opens a connection to Etcd specified in the command line or the "ETCDV3_ENDPOINTS" environment variable
func GetFibEntry ¶
func GetFibEntry(endpoints []string, label string, bdLabel string, fibMac string) (bool, string, *l2.FibTableEntries_FibTableEntry)
GetFibEntry returns the FIB entry if exists
func GetInterfaceKeyAndValue ¶
func GetInterfaceKeyAndValue(endpoints []string, label string, ifName string) (bool, string, *interfaces.Interfaces_Interface, keyval.ProtoBroker)
GetInterfaceKeyAndValue returns true if an interface with the specified name was found together with the interface key, data and data broker
func IsFlagPresent ¶
IsFlagPresent verifies flag presence in the OS args
func ParseKey ¶
ParseKey parses the etcd Key for the microservice label and the data type encoded in the Key. The function returns the microservice label, the data type and a list of parameters that contains path segments that follow the data path segment in the Key URL. The parameter list is empty if data path is the Last segment in the Key ..
URI Examples: * /vnf-agent/{agent-label}/vpp/config/v1/interface/{interface-name} * /vnf-agent/{agent-label}/vpp/status/v1/interface/{interface-name} * /vnf-agent/{agent-label}/check/status/v1/agent
Explanation of the URI examples: * allAgntsPref label plugin stats ver dataType * ps[0] ps[1] ps[2]ps[3] ps[4]
Example for dataType ... "check/status/v1/"
func UpdateIpv4Address ¶
UpdateIpv4Address updates interface's IPv4 address
func UpdateIpv6Address ¶
UpdateIpv6Address updates interface's IPv6 address
func ValidateIpv4Addr ¶
ValidateIpv4Addr validates string representation of IPv4 address
func ValidateIpv6Addr ¶
ValidateIpv6Addr validates string representation of IPv6 address
func ValidatePhyAddr ¶
func ValidatePhyAddr(pAddr string)
ValidatePhyAddr validates string representation of MAC address
func WriteBridgeDomainToDb ¶
func WriteBridgeDomainToDb(db keyval.ProtoBroker, key string, bd *l2.BridgeDomains_BridgeDomain)
WriteBridgeDomainToDb writes bridge domain to the ETCD
func WriteFibDataToDb ¶
func WriteFibDataToDb(db keyval.ProtoBroker, key string, fib *l2.FibTableEntries_FibTableEntry)
WriteFibDataToDb writes FIB entry to the ETCD
func WriteInterfaceToDb ¶
func WriteInterfaceToDb(db keyval.ProtoBroker, key string, ifc *interfaces.Interfaces_Interface)
WriteInterfaceToDb validates and writes interface to the ETCD
Types ¶
type BdConfigWithMD ¶
type BdConfigWithMD struct { Metadata VppMetaData BridgeDomain *l2.BridgeDomains_BridgeDomain }
BdConfigWithMD contains a Bridge Domain config data record and its Etcd metadata
type BdStateWithMD ¶
type BdStateWithMD struct { Metadata VppMetaData BridgeDomainState *l2.BridgeDomainState_BridgeDomain }
BdStateWithMD contains a Bridge Domain state data record and its Etcd metadata
type BdWithMD ¶
type BdWithMD struct { Config *BdConfigWithMD State *BdStateWithMD }
BdWithMD contains a Bridge Domain data record and its Etcd metadata
type BridgeDomainErrorWithMD ¶
type BridgeDomainErrorWithMD struct { VppMetaData BdErrorList []*l2.BridgeDomainErrors_BridgeDomain }
BridgeDomainErrorWithMD contains a data record for bridge domain errors and its Etcd metadata
type EtcdDump ¶
EtcdDump is a map of VppData records. It constitutes a temporary storage for data retrieved from Etcd. "Temporary" means during the execution of an agentctl command. Every command first reads data from Etcd, then processes it, and finally either outputs the processed data to the user or updates one or more data records in Etcd.
func NewEtcdDump ¶
func NewEtcdDump() EtcdDump
NewEtcdDump returns a new instance of the temporary storage that will hold data retrieved from Etcd.
func (EtcdDump) CreateEmptyRecord ¶
CreateEmptyRecord creates an empty placeholder record in the EtcdDump temporary storage.
func (EtcdDump) PrintDataAsJSON ¶
PrintDataAsJSON prints ETCD data in JSON format
func (EtcdDump) PrintDataAsTable ¶
func (ed EtcdDump) PrintDataAsTable(table *goterm.Table, filter []string, short bool, active bool) (*goterm.Table, error)
PrintDataAsTable receives the complete Etcd data, applies all filters, flags and other restrictions, then prints table filled with interface statistics
func (EtcdDump) PrintDataAsText ¶
PrintDataAsText prints data from an EtcdDump repo in text format. If tree option is chosen, output is printed with tree lines
func (EtcdDump) ReadDataFromDb ¶
func (ed EtcdDump) ReadDataFromDb(db keyval.ProtoBroker, key string, labelFilter []string, typeFilter []string) (found bool, err error)
ReadDataFromDb reads a data record from Etcd, parses it according to the expected record type and stores it in the EtcdDump temporary storage. A record is identified by a Key.
The function returns an error if the etcd client encountered an error. The function returns true if the specified item has been found.
type FibTableWithMD ¶
type FibTableWithMD struct { VppMetaData FibTable []*l2.FibTableEntries_FibTableEntry }
FibTableWithMD contains a FIB table data record and its Etcd metadata
type IfConfigWithMD ¶
type IfConfigWithMD struct { Metadata VppMetaData Interface *interfaces.Interfaces_Interface }
IfConfigWithMD contains a data record for interface configuration and its Etcd metadata
type IfStateWithMD ¶
type IfStateWithMD struct { Metadata VppMetaData InterfaceState *interfaces.InterfacesState_Interface }
IfStateWithMD contains a data record for interface State and its Etcd metadata
type InterfaceErrorWithMD ¶
type InterfaceErrorWithMD struct { VppMetaData InterfaceErrorList []*interfaces.InterfaceErrors_Interface }
InterfaceErrorWithMD contains a data record for interface errors and its Etcd metadata
type InterfaceWithMD ¶
type InterfaceWithMD struct { Config *IfConfigWithMD State *IfStateWithMD }
InterfaceWithMD contains a data record for interface and its Etcd metadata
type PfxStack ¶
type PfxStack struct { Entries []PfxStackEntry Spaces int FirstDash string MiddleDash string LastDash string }
PfxStack is helper struct while creating tree output
func (*PfxStack) GetPreamble ¶
GetPreamble creates the string for a prefix stack entry. The prefix itself is then created by joining all prefix Entries.
func (*PfxStack) Pop ¶
func (stack *PfxStack) Pop()
Pop increases the current prefix stack level (i.e. it make the prefix stack shorter. If after Pop the element at the top of the prefix stack is not the the Last element on a list, it's replaced by the list element (FirstDash) icon.
func (*PfxStack) Push ¶
func (stack *PfxStack) Push()
Push increases the current prefix stack level (i.e. it makes the prefix stack longer. If the list at the current level continues (i.e. the list element is not the Last element), the current prefix element is replaced with a vertical bar (MiddleDash) icon. If the current element is the Last element of a list, the current prefix element is replaced with a space (i.e. the vertical line in the tree will not continue).
type PfxStackEntry ¶
PfxStackEntry represents entry in prefix stack entry list
type PrintLine ¶
type PrintLine struct {
// contains filtered or unexported fields
}
PrintLine represents one line in the tree output
type StaticRoutesWithMD ¶
type StaticRoutesWithMD struct { VppMetaData Routes []*l3.StaticRoutes_Route }
StaticRoutesWithMD contains a static route data record and its Etcd metadata
type TableVppDataContext ¶
type TableVppDataContext struct {
// contains filtered or unexported fields
}
TableVppDataContext is data context for one vpp (where number of interfaces == rows) with mandatory info: agent label (vpp name), list of interfaces used in table (without filtered items) and interfaceMap with statistics data
type TreeWriter ¶
type TreeWriter struct {
// contains filtered or unexported fields
}
TreeWriter is an implementation of the TreePrinter interface.
func NewTreeWriter ¶
func NewTreeWriter(spaces int, first string, middle string, last string) *TreeWriter
NewTreeWriter returns a reference to a newly created TreeWriter instance. Parameters passed into this function determine the visual appearance of the tree in which data is printed. A typical usage would be:
p := NewTreeWriter(1, "├─", "│ ", "└─")
func (*TreeWriter) FlushTree ¶
func (p *TreeWriter) FlushTree()
FlushTree takes the content of the finalize buffer formats it into a tree and prints it out to stdout.
type VppData ¶
type VppData struct { Interfaces map[string]InterfaceWithMD InterfaceErrors map[string]InterfaceErrorWithMD BridgeDomains map[string]BdWithMD BridgeDomainErrors map[string]BridgeDomainErrorWithMD FibTableEntries FibTableWithMD XConnectPairs map[string]XconnectWithMD StaticRoutes StaticRoutesWithMD Status map[string]VppStatusWithMD ShowEtcd bool }
VppData defines a structure to hold all Etcd data records (of all types) for one VPP.
type VppMetaData ¶
VppMetaData defines the Etcd metadata
type VppStatusWithMD ¶
type VppStatusWithMD struct { VppMetaData status.AgentStatus }
VppStatusWithMD contains a VPP Status data record and its Etcd metadata
type XconnectWithMD ¶
type XconnectWithMD struct { VppMetaData *l2.XConnectPairs_XConnectPair }
XconnectWithMD contains an l2 cross-Connect data record and its Etcd metadata