datastore

package
v3.3.3+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeLoopIFInfo

func GetNodeLoopIFInfo(node *telemetrymodel.Node) (*telemetrymodel.NodeInterface, error)

GetNodeLoopIFInfo gets the loop interface for the given node

Types

type K8sDataStore

type K8sDataStore struct {
	// contains filtered or unexported fields
}

K8sDataStore implements the K8sCache interface. The K8sDataStore structure holds k8s related information separate from vpp related information

func NewK8sDataStore

func NewK8sDataStore() *K8sDataStore

NewK8sDataStore will return a pointer to a new cache which holds various types of k8s related information.

func (*K8sDataStore) CreateK8sNode

func (k *K8sDataStore) CreateK8sNode(name string, PodCIDR string, ProviderID string,
	Addresses []*node.NodeAddress, NodeInfo *node.NodeSystemInfo) error

CreateK8sNode will add a k8s type node to the Contiv Telemtry cache, making sure there are no duplicates.

func (*K8sDataStore) CreatePod

func (k *K8sDataStore) CreatePod(name, Namespace string, label []*pod2.Pod_Label, IPAddress,
	hostIPAddress string, container []*pod2.Pod_Container) error

CreatePod adds a pod with the given parameters to the contiv telemetry cache.

func (*K8sDataStore) DeleteK8sNode

func (k *K8sDataStore) DeleteK8sNode(name string) error

DeleteK8sNode deletes the specified node from the K8s cache. If the node is found, the node is deleted; otherwise, an error is returned.

func (*K8sDataStore) DeletePod

func (k *K8sDataStore) DeletePod(name string) error

DeletePod deletes the specified pod from the K8s cache. If the pod is found, the pod is deleted; otherwise, an error is returned.

func (*K8sDataStore) ReinitializeCache

func (k *K8sDataStore) ReinitializeCache()

ReinitializeCache will clear all data from the data store

func (*K8sDataStore) RetrieveAllK8sNodes

func (k *K8sDataStore) RetrieveAllK8sNodes() []*node.Node

RetrieveAllK8sNodes returns a list of all nodes in the data store.

func (*K8sDataStore) RetrieveAllPods

func (k *K8sDataStore) RetrieveAllPods() []*telemetrymodel.Pod

RetrieveAllPods returns a list of all pods in the data store.

func (*K8sDataStore) RetrieveK8sNode

func (k *K8sDataStore) RetrieveK8sNode(name string) (*node.Node, error)

RetrieveK8sNode will retrieve a k8s node from the cache with the given name or return an error if it is not found.gi

func (*K8sDataStore) RetrievePod

func (k *K8sDataStore) RetrievePod(name string) (*telemetrymodel.Pod, error)

RetrievePod will retrieve a pod from the cache with the given name or return an error if it is not found.

func (*K8sDataStore) UpdateK8sNode

func (k *K8sDataStore) UpdateK8sNode(name string, PodCIDR string, ProviderID string,
	Addresses []*node.NodeAddress, NodeInfo *node.NodeSystemInfo) error

UpdateK8sNode updates the specified node in the K8s cache. If the node is found, its data is updated; otherwise, an error is returned.

func (*K8sDataStore) UpdatePod

func (k *K8sDataStore) UpdatePod(name string, namespace string, label []*pod2.Pod_Label,
	IPAddress, hostIPAddress string, container []*pod2.Pod_Container) error

UpdatePod updates the specified pod in the K8s cache. If the pod is found, its data is updated; otherwise, an error is returned.

type SimpleReport

type SimpleReport struct {
	Log       logging.Logger
	Data      telemetrymodel.Reports
	Output    io.Writer
	TimeStamp time.Time
	Prefix    string
}

SimpleReport holds error/warning messages recorded during data collection / validation

func NewSimpleReport

func NewSimpleReport(log logging.Logger) *SimpleReport

NewSimpleReport creates a new SimpleReport instance

func (*SimpleReport) AppendToNodeReport

func (r *SimpleReport) AppendToNodeReport(nodeName string, errString string)

AppendToNodeReport appends the string to the status log

func (*SimpleReport) Clear

func (r *SimpleReport) Clear()

Clear clears the status log

func (*SimpleReport) GetTimeStamp

func (r *SimpleReport) GetTimeStamp() time.Time

GetTimeStamp returns the reports time stamp.

func (*SimpleReport) LogErrAndAppendToNodeReport

func (r *SimpleReport) LogErrAndAppendToNodeReport(nodeName string, errString string)

LogErrAndAppendToNodeReport log an error and appends the string to the status log

func (*SimpleReport) Print

func (r *SimpleReport) Print()

Print prints the status log

func (*SimpleReport) RetrieveReport

func (r *SimpleReport) RetrieveReport() telemetrymodel.Reports

RetrieveReport returns the map of report strings

func (*SimpleReport) SetPrefix added in v1.4.0

func (r *SimpleReport) SetPrefix(pfx string)

SetPrefix sets a prefix that will be henceforth prepended to each error message, so that the source of the error can be easier identified. Each validation routine should set it own prefix.

func (*SimpleReport) SetTimeStamp

func (r *SimpleReport) SetTimeStamp(time time.Time)

SetTimeStamp sets the reports timestamp based on the time passed.

type VppDataStore

type VppDataStore struct {
	NodeMap    map[string]*telemetrymodel.Node
	LoopIPMap  map[string]*telemetrymodel.Node
	GigEIPMap  map[string]*telemetrymodel.Node
	LoopMACMap map[string]*telemetrymodel.Node
	HostIPMap  map[string]*telemetrymodel.Node
	// contains filtered or unexported fields
}

VppDataStore holds various maps which all take different keys but point to the same underlying value.

func NewVppDataStore

func NewVppDataStore() (n *VppDataStore)

NewVppDataStore returns a reference to a new Vpp data store

func (*VppDataStore) ClearCache

func (vds *VppDataStore) ClearCache()

ClearCache with clear all vpp cache data except for the base NodeMap that contains the discovered nodes..

func (*VppDataStore) CreateNode

func (vds *VppDataStore) CreateNode(ID uint32, nodeName, IPAddr string) error

CreateNode will add a node to the node cache with the given parameters, making sure there are no duplicates.

func (*VppDataStore) DeleteNode

func (vds *VppDataStore) DeleteNode(nodeName string) error

DeleteNode handles node deletions from the cache. The delete callback actually hands off to us the node ID in a string format, so we have to first find the node by its ID, not its name. If the nodeName parameter is invalid, or it does not identify a node that is present in the cache, we return an error.

func (*VppDataStore) DumpCache added in v1.4.0

func (vds *VppDataStore) DumpCache()

DumpCache prints basic cache information to the console. The intended use of this function is debugging.

func (*VppDataStore) ReinitializeCache

func (vds *VppDataStore) ReinitializeCache()

ReinitializeCache completely re-initializes the cache, clearing all data including the discovered nodes.

func (*VppDataStore) RetrieveAllNodes

func (vds *VppDataStore) RetrieveAllNodes() []*telemetrymodel.Node

RetrieveAllNodes returns an ordered slice of all nodes in a database organized by name.

func (*VppDataStore) RetrieveNode

func (vds *VppDataStore) RetrieveNode(nodeName string) (n *telemetrymodel.Node, err error)

RetrieveNode returns a pointer to a node for the given key. Returns an error if that key is not found.

func (*VppDataStore) RetrieveNodeByGigEIPAddr

func (vds *VppDataStore) RetrieveNodeByGigEIPAddr(ipAddress string) (*telemetrymodel.Node, error)

RetrieveNodeByGigEIPAddr returns a reference to node dat for the specified VPP GigE IP address.

func (*VppDataStore) RetrieveNodeByHostIPAddr

func (vds *VppDataStore) RetrieveNodeByHostIPAddr(ipAddr string) (*telemetrymodel.Node, error)

RetrieveNodeByHostIPAddr returns a reference to node dat for the specified management (host) IP address.

func (*VppDataStore) RetrieveNodeByLoopIPAddr

func (vds *VppDataStore) RetrieveNodeByLoopIPAddr(ipAddress string) (*telemetrymodel.Node, error)

RetrieveNodeByLoopIPAddr returns a reference to node dat for the specified loopback Loop0 IP address.

func (*VppDataStore) RetrieveNodeByLoopMacAddr

func (vds *VppDataStore) RetrieveNodeByLoopMacAddr(macAddress string) (*telemetrymodel.Node, error)

RetrieveNodeByLoopMacAddr returns a reference to node dat for the specified loopback Loop0 MAC address.

func (*VppDataStore) SetLinuxInterfaces added in v1.5.1

func (vds *VppDataStore) SetLinuxInterfaces(nodeName string, nInt telemetrymodel.LinuxInterfaces) error

SetLinuxInterfaces is a simple function to set a nodes interface given its name.

func (*VppDataStore) SetNodeBridgeDomain

func (vds *VppDataStore) SetNodeBridgeDomain(nodeName string, nBridge telemetrymodel.NodeBridgeDomains) error

SetNodeBridgeDomain is a simple function to set a nodes bridge domain given its name.

func (*VppDataStore) SetNodeIPARPs

func (vds *VppDataStore) SetNodeIPARPs(nodeName string, nArps telemetrymodel.NodeIPArpTable) error

SetNodeIPARPs is a simple function to set a nodes ip arp table given its name.

func (*VppDataStore) SetNodeIPam

func (vds *VppDataStore) SetNodeIPam(nodeName string, nIPam restapi.NodeIPAMInfo) error

SetNodeIPam is a simple function to set the node with the given node name's ipam

func (*VppDataStore) SetNodeInterfaces

func (vds *VppDataStore) SetNodeInterfaces(nodeName string, nInt telemetrymodel.NodeInterfaces) error

SetNodeInterfaces is a simple function to set a nodes interface given its name.

func (*VppDataStore) SetNodeL2Fibs

func (vds *VppDataStore) SetNodeL2Fibs(nodeName string, nL2F telemetrymodel.NodeL2FibTable) error

SetNodeL2Fibs is a simple function to set a nodes l2 fibs given its name.

func (*VppDataStore) SetNodeLiveness

func (vds *VppDataStore) SetNodeLiveness(nodeName string, nLive *status.AgentStatus) error

SetNodeLiveness is a simple function to set a nodes liveness given its name.

func (*VppDataStore) SetNodeStaticRoutes

func (vds *VppDataStore) SetNodeStaticRoutes(nodeName string, nSrs telemetrymodel.NodeStaticRoutes) error

SetNodeStaticRoutes is a simple function to set a nodes static routes given its name.

func (*VppDataStore) SetNodeTelemetry

func (vds *VppDataStore) SetNodeTelemetry(nodeName string, nTele map[string]telemetrymodel.NodeTelemetry) error

SetNodeTelemetry is a simple function to set a nodes telemetry data given its name.

func (*VppDataStore) SetSecondaryNodeIndices

func (vds *VppDataStore) SetSecondaryNodeIndices(node *telemetrymodel.Node) []string

SetSecondaryNodeIndices populates many of needed node maps for processing once all of the information has been retrieved. It also checks to make sure that there are no duplicate addresses within the map.

func (*VppDataStore) UpdateNode

func (vds *VppDataStore) UpdateNode(ID uint32, nodeName, IPAddr string) error

UpdateNode handles updates of node data in the cache. If the node identified by 'nodeName' exists, its data is updated and nil error is returned. otherwise, an error is returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL