common

package
v1.6.65 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TYPE_UPDATE = 1
	TYPE_RENEW  = 2
	TYPE_EXIT   = 3
)
View Source
const (
	DEVICE_TYPE_KVM_HOST         = "kvm-host"
	DEVICE_TYPE_KVM_VM           = "kvm-vm"
	DEVICE_TYPE_DOCKER_HOST      = "docker-host"
	DEVICE_TYPE_DOCKER_CONTAINER = "docker-container"
	DEVICE_TYPE_PUBLIC_CLOUD     = "public-cloud"
	DEVICE_TYPE_PHYSICAL_MACHINE = "physical-machine"
)
View Source
const (
	SYNC_TYPE_FORMAT = "%v-%v-%v-%v" // region-orgID-type-vtapID
)

Variables

View Source
var IPRegex = regexp.MustCompile("^\\s+inet6?\\s+([\\d\\.A-Za-z:]+)/(\\d+)\\s+.*scope\\s+(global|link|host)")
View Source
var IfaceRegex = regexp.MustCompile("^(\\d+):\\s+([^@:]+)(@.*)?\\:")
View Source
var MACRegex = regexp.MustCompile("^\\s+link/\\S+\\s+(([\\dA-Za-z]{2}:){5}[\\dA-Za-z]{2}) brd.*$")

Functions

func GetTeamShortLcuuidToInfo

func GetTeamShortLcuuidToInfo() (map[string]TeamInfo, error)

func IPInRanges

func IPInRanges(ip string, ipRanges ...netaddr.IPPrefix) bool

func ParseBrctlShow

func ParseBrctlShow(s string) (map[string][]string, error)

func ParseCSV

func ParseCSV(s string, fields ...string) ([]map[string]string, error)

func ParseCSVWithKey

func ParseCSVWithKey(s, key string, fields ...string) (map[string]map[string]string, error)

func ParseCompressedInfo

func ParseCompressedInfo(cInfo []byte) (bytes.Buffer, error)

func ParseKVString

func ParseKVString(s string) (map[string]string, error)

func ParseVLANConfig

func ParseVLANConfig(s string) (map[string]int, error)

func ParseVMStates

func ParseVMStates(s string) (map[string]int, error)

func RequestGet

func RequestGet(url string, timeout int, queryStrings map[string]string) error

func Uint64ToMac

func Uint64ToMac(v uint64) net.HardwareAddr

Types

type DomStatus

type DomStatus struct {
	Domains KVMDomain `xml:"domain"`
}

type ETCDomains

type ETCDomains struct {
	Domains []KVMDomain `xml:"domain"`
}

type GenesisSyncData added in v1.6.65

type GenesisSyncData struct {
	IPLastSeens map[int][]model.GenesisIP
	VIPs        map[int][]model.GenesisVIP
	VMs         map[int][]model.GenesisVM
	VPCs        map[int][]model.GenesisVpc
	Hosts       map[int][]model.GenesisHost
	Lldps       map[int][]model.GenesisLldp
	Ports       map[int][]model.GenesisPort
	Networks    map[int][]model.GenesisNetwork
	Vinterfaces map[int][]model.GenesisVinterface
	Processes   map[int][]model.GenesisProcess
}

type GenesisSyncDataResponse added in v1.6.65

type GenesisSyncDataResponse struct {
	IPLastSeens []model.GenesisIP
	VIPs        []model.GenesisVIP
	VMs         []model.GenesisVM
	VPCs        []model.GenesisVpc
	Hosts       []model.GenesisHost
	Lldps       []model.GenesisLldp
	Ports       []model.GenesisPort
	Networks    []model.GenesisNetwork
	Vinterfaces []model.GenesisVinterface
	Processes   []model.GenesisProcess
}

type Iface

type Iface struct {
	Index     int
	PeerIndex int
	MAC       string
	Name      string
	Peer      string
	IPs       []VifInfo
}

func ParseIPOutput

func ParseIPOutput(s string) ([]Iface, error)

type K8SRPCMessage added in v1.6.65

type K8SRPCMessage struct {
	ORGID       int
	MessageType int
	VtapID      uint32
	Peer        string
	Message     *trident.KubernetesAPISyncRequest
}

type KVMAddress

type KVMAddress struct {
	AddressValue  string `xml:"type,attr"`
	DomainValue   string `xml:"domain,attr"`
	BusValue      string `xml:"bus,attr"`
	SlotValue     string `xml:"slot,attr"`
	FunctionValue string `xml:"function,attr"`
}

type KVMDevices

type KVMDevices struct {
	Interfaces []KVMInterface `xml:"interface"`
}

type KVMDomain

type KVMDomain struct {
	Type     string      `xml:"type,attr"`
	UUID     string      `xml:"uuid"`
	Name     string      `xml:"name"`
	Title    string      `xml:"title"`
	MetaData KVMMetaData `xml:"metadata"`
	Devices  KVMDevices  `xml:"devices"`
}

type KVMInstance

type KVMInstance struct {
	Namespace string   `xml:"xmlns nova,attr"`
	Name      string   `xml:"name"`
	Owner     KVMOwner `xml:"owner"`
}

type KVMInterface

type KVMInterface struct {
	Type    string     `xml:"type,attr"`
	Mac     KVMMac     `xml:"mac"`
	Source  KVMSource  `xml:"source"`
	Target  KVMTarget  `xml:"target"`
	Model   KVMModel   `xml:"model"`
	Address KVMAddress `xml:"address"`
}

type KVMMac

type KVMMac struct {
	Value string `xml:"address,attr"`
}

type KVMMetaData

type KVMMetaData struct {
	Instance KVMInstance `xml:"instance"`
}

type KVMModel

type KVMModel struct {
	Value string `xml:"type,attr"`
}

type KVMOwner

type KVMOwner struct {
	User    KVMUser    `xml:"user"`
	Project KVMProject `xml:"project"`
}

type KVMProject

type KVMProject struct {
	UUID  string `xml:"uuid,attr"`
	Value string `xml:",innerxml"`
}

type KVMSource

type KVMSource struct {
	Value string `xml:"bridge,attr"`
}

type KVMTarget

type KVMTarget struct {
	Value string `xml:"dev,attr"`
}

type KVMUser

type KVMUser struct {
	UUID  string `xml:"uuid,attr"`
	Value string `xml:",innerxml"`
}

type KubernetesInfo added in v1.6.65

type KubernetesInfo struct {
	ORGID     int
	ClusterID string
	ErrorMSG  string
	Version   uint64
	Epoch     time.Time
	Entries   []*common.KubernetesAPIInfo
}

type RUNDomains

type RUNDomains struct {
	DomStatus []DomStatus `xml:"domstatus"`
}

type TeamInfo

type TeamInfo struct {
	OrgID  int
	TeamId int
}

type VIFRPCMessage added in v1.6.65

type VIFRPCMessage struct {
	ORGID        int
	MessageType  int
	TeamID       uint32
	VtapID       uint32
	Peer         string
	K8SClusterID string
	Message      *trident.GenesisSyncRequest
}

type VifInfo

type VifInfo struct {
	MaskLen uint32
	Address string
	Scope   string
}

type XMLInterface

type XMLInterface struct {
	Mac    string
	Target string
}

type XMLVM

type XMLVM struct {
	UUID       string
	Name       string
	Label      string
	VPC        XMLVPC
	Interfaces []XMLInterface
}

func ParseVMXml

func ParseVMXml(s, nameField string) ([]XMLVM, error)

type XMLVPC

type XMLVPC struct {
	UUID string
	Name string
}

Jump to

Keyboard shortcuts

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