types

package
v0.0.0-...-7f3d85a Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NT_NOOP      NetworkType = 0
	NT_IPV4                  = 4
	NT_IPV6                  = 6
	NT_CryptoEID             = 14 // Either IPv6 or IPv4; adapter Addr
	// determines whether IPv4 EIDs are in use.
	NT_CryptoV4 = 24 // Not used
	NT_CryptoV6 = 26 // Not used

)

Variables

View Source
var GlobalConfigDefaults = GlobalConfig{
	ConfigInterval:          60,
	MetricInterval:          60,
	ResetIfCloudGoneTime:    7 * 24 * 3600,
	FallbackIfCloudGoneTime: 300,
	MintimeUpdateSuccess:    600,

	NetworkGeoRedoTime:        3600,
	NetworkGeoRetryTime:       600,
	NetworkTestDuration:       30,
	NetworkTestInterval:       300,
	NetworkTestBetterInterval: 0,
	NetworkFallbackAnyEth:     TS_ENABLED,

	UsbAccess:             true,
	SshAccess:             true,
	StaleConfigTime:       600,
	DownloadGCTime:        600,
	VdiskGCTime:           3600,
	DownloadRetryTime:     600,
	DomainBootRetryTime:   600,
	DefaultLogLevel:       "info",
	DefaultRemoteLogLevel: "info",
}

Default values until/unless we receive them from the cloud We do a GET of config every 60 seconds, PUT of metrics every 60 seconds, If we don't hear anything from the cloud in a week, then we reboot, and during a post-update boot that time is reduced to 10 minutes. On reboot if we can't get a config, then we use a saved one if the saved is not older than 10 minutes. A downloaded image which isn't used is garbage collected after 10 minutes. If a instance has been removed its read/write vdisks are deleted after one hour.

View Source
var GlobalConfigMinimums = GlobalConfig{
	ConfigInterval:          5,
	MetricInterval:          5,
	ResetIfCloudGoneTime:    120,
	FallbackIfCloudGoneTime: 60,
	MintimeUpdateSuccess:    30,

	NetworkGeoRedoTime:        60,
	NetworkGeoRetryTime:       5,
	NetworkTestDuration:       10,
	NetworkTestInterval:       300,
	NetworkTestBetterInterval: 0,

	StaleConfigTime:     0,
	DownloadGCTime:      60,
	VdiskGCTime:         60,
	DownloadRetryTime:   60,
	DomainBootRetryTime: 10,
}

We enforce that timers are not below these values

Functions

func AdapterToIfName

func AdapterToIfName(deviceNetworkStatus *DeviceNetworkStatus,
	adapter string) string

lookup port Name to find IfName Can also match on IfName If not found, return the adapter string

func CountLocalAddrAnyNoLinkLocal

func CountLocalAddrAnyNoLinkLocal(globalStatus DeviceNetworkStatus) int

Return number of local IP addresses for all the management ports excluding link-local addresses

func CountLocalAddrAnyNoLinkLocalIf

func CountLocalAddrAnyNoLinkLocalIf(globalStatus DeviceNetworkStatus,
	port string) int

Return number of local IP addresses for all the management ports excluding link-local addresses

func CountLocalAddrFreeNoLinkLocal

func CountLocalAddrFreeNoLinkLocal(globalStatus DeviceNetworkStatus) int

Return number of local IP addresses for all the free management ports excluding link-local addresses

func CountLocalAddrFreeNoLinkLocalIf

func CountLocalAddrFreeNoLinkLocalIf(globalStatus DeviceNetworkStatus,
	port string) int

Return number of local IP addresses for all the management ports with given name excluding link-local addresses

func CountLocalIPv4AddrAnyNoLinkLocal

func CountLocalIPv4AddrAnyNoLinkLocal(globalStatus DeviceNetworkStatus) int

XXX move AF functionality to getInterfaceAddr? Only IPv4 counted

func CountLocalIPv4AddrAnyNoLinkLocalIf

func CountLocalIPv4AddrAnyNoLinkLocalIf(globalStatus DeviceNetworkStatus,
	port string) int

Return number of local IP addresses for all the management ports with given name excluding link-local addresses Only IPv4 counted

func DeriveLedCounter

func DeriveLedCounter(ledCounter, usableAddressCount int) int

Merge the 1/2 values based on having usable addresses or not, with the value we get based on access to zedcloud or errors.

func EidKey

func EidKey(uuidAndVers UUIDandVersion, iid uint32) string

func EnsureGCFile

func EnsureGCFile()

Agents which wait for GlobalConfig initialized should call this on startup to make sure we have a GlobalConfig file.

func GetDefaultRouteTable

func GetDefaultRouteTable() int

func GetExistingInterfaceList

func GetExistingInterfaceList(globalStatus DeviceNetworkStatus) []string

Return the list of ifnames in DNC which exist in the kernel

func GetLocalAddrAny

func GetLocalAddrAny(globalStatus DeviceNetworkStatus, pickNum int,
	port string) (net.IP, error)

Pick one address from all of the management ports, unless if port is set in which we pick from that port. Includes link-local addresses. We put addresses from the free management ports first in the list i.e., returned for the lower 'pickNum'

func GetLocalAddrAnyNoLinkLocal

func GetLocalAddrAnyNoLinkLocal(globalStatus DeviceNetworkStatus, pickNum int,
	port string) (net.IP, error)

Pick one address from all of the management ports, unless if port is set in which we pick from that port. Excludes link-local addresses. We put addresses from the free management ports first in the list i.e., returned for the lower 'pickNum'

func GetLocalAddrFreeNoLinkLocal

func GetLocalAddrFreeNoLinkLocal(globalStatus DeviceNetworkStatus, pickNum int,
	port string) (net.IP, error)

Pick one address from the free management ports, unless if port is set in which we pick from that port. Excludes link-local addresses. We put addresses from the free management ports first in the list i.e., returned for the lower 'pickNum'

func GetMgmtPortFromAddr

func GetMgmtPortFromAddr(globalStatus DeviceNetworkStatus, addr net.IP) string

Given an address tell me its IfName

func GetMgmtPortsAny

func GetMgmtPortsAny(globalStatus DeviceNetworkStatus, rotation int) []string

Return all management ports

func GetMgmtPortsFree

func GetMgmtPortsFree(globalStatus DeviceNetworkStatus, rotation int) []string

Return all free management ports

func GetMgmtPortsNonFree

func GetMgmtPortsNonFree(globalStatus DeviceNetworkStatus, rotation int) []string

Return all non-free management ports

func IoBundleToPci

func IoBundleToPci(ib *IoBundle) ([]string, []string, error)

Returns the long and short PCI IDs; if Lookup is set there can be a PCI ID for each member. Check if PCI ID exists on system. Returns null strings for non-PCI devices since we can't check if they exist.

func IsFreeMgmtPort

func IsFreeMgmtPort(globalStatus DeviceNetworkStatus, port string) bool

Check if an interface/adapter name is a free management port

func IsMgmtPort

func IsMgmtPort(globalStatus DeviceNetworkStatus, port string) bool

Check if an interface/adapter name is a management port

func IsPort

func IsPort(globalStatus DeviceNetworkStatus, port string) bool

Check if an interface/adapter name is a port owned by zedrouter

func PciLongToUnique

func PciLongToUnique(long string) (bool, string)

Return a string likely to be unique for the device. Used to make sure devices don't move around Returns exist bool, string

func ReportPorts

func ReportPorts(deviceNetworkStatus DeviceNetworkStatus) []string

Return list of port names we will report in info and metrics

func RoundupToKB

func RoundupToKB(b uint64) uint64

func SafenameToFilename

func SafenameToFilename(safename string) string

Remove initial part up to last '/' in URL. Note that '/' was converted to ' ' in Safename

func UpdateLedManagerConfig

func UpdateLedManagerConfig(count int)

Used by callers to change the behavior or the LED

func UrlToFilename

func UrlToFilename(urlName string) string

func UrlToSafename

func UrlToSafename(url string, sha string) string

Types

type ACE

type ACE struct {
	Matches []ACEMatch
	Actions []ACEAction
}

Similar support as in draft-ietf-netmod-acl-model

type ACEAction

type ACEAction struct {
	Drop bool // Otherwise accept

	Limit      bool   // Is limiter enabled?
	LimitRate  int    // Packets per unit
	LimitUnit  string // "s", "m", "h", for second, minute, hour
	LimitBurst int    // Packets

	PortMap    bool // Is port mapping part of action?
	TargetPort int  // Internal port
}

type ACEMatch

type ACEMatch struct {
	Type  string
	Value string
}

The Type can be "ip" or "host" (aka domain name), "eidset", "protocol", "fport", or "lport" for now. The ip and host matches the remote IP/hostname. The host matching is suffix-matching thus zededa.net matches *.zededa.net. XXX Need "interface"... e.g. "uplink" or "eth1"? Implicit in network used? For now the matches are bidirectional. XXX Add directionality? Different rate limits in different directions? Value is always a string. There is an implicit reject rule at the end. The "eidset" type is special for the overlay. Matches all the IPs which are part of the DnsNameToIPList.

type AdditionalInfoApp

type AdditionalInfoApp struct {
	DisplayName string
	DeviceEID   net.IP
	DeviceIID   uint32
	UnderlayIP  string
	Hostname    string `json:",omitempty"` // From reverse DNS
}

Tie the Application EID back to the device

type AdditionalInfoDevice

type AdditionalInfoDevice struct {
	UnderlayIP string
	Hostname   string `json:",omitempty"` // From reverse DNS
	City       string `json:",omitempty"`
	Region     string `json:",omitempty"`
	Country    string `json:",omitempty"`
	Loc        string `json:",omitempty"` // Lat and long as string
	Org        string `json:",omitempty"` // From AS number
}

Retrieved from geolocation service for device underlay connectivity

type AddrInfo

type AddrInfo struct {
	Addr             net.IP
	Geo              ipinfo.IPInfo
	LastGeoTimestamp time.Time
}

type AddressType

type AddressType int32
const (
	AddressTypeNone       AddressType = 0 // For switch networks
	AddressTypeIPV4       AddressType = 1
	AddressTypeIPV6       AddressType = 2
	AddressTypeCryptoIPV4 AddressType = 3
	AddressTypeCryptoIPV6 AddressType = 4
	AddressTypeLast       AddressType = 255
)

The values here should be same as the ones defined in zconfig.AddressType

type AppInstanceConfig

type AppInstanceConfig struct {
	UUIDandVersion  UUIDandVersion
	DisplayName     string
	ConfigSha256    string
	ConfigSignature string

	// Error
	//	If this is set, do not process further.. Just set the status to error
	//	so the cloud gets it.
	Errors              []string
	FixedResources      VmConfig // CPU etc
	StorageConfigList   []StorageConfig
	Activate            bool
	OverlayNetworkList  []EIDOverlayConfig
	UnderlayNetworkList []UnderlayNetworkConfig
	IoAdapterList       []IoAdapter
	RestartCmd          AppInstanceOpsCmd
	PurgeCmd            AppInstanceOpsCmd
	CloudInitUserData   string // base64-encoded
	RemoteConsole       bool
}

This is what we assume will come from the ZedControl for each application instance. Note that we can have different versions configured for the same UUID, hence the key is the UUIDandVersion We assume the elements in StorageConfig should be installed, but activation (advertize the EID in lisp and boot the guest) is driven by the Activate attribute.

func (AppInstanceConfig) Key

func (config AppInstanceConfig) Key() string

func (AppInstanceConfig) VerifyFilename

func (config AppInstanceConfig) VerifyFilename(fileName string) bool

type AppInstanceOpsCmd

type AppInstanceOpsCmd struct {
	Counter   uint32
	ApplyTime string // XXX not currently used
}

type AppInstanceStatus

type AppInstanceStatus struct {
	UUIDandVersion     UUIDandVersion
	DisplayName        string
	DomainName         string // Once booted
	Activated          bool
	ActivateInprogress bool     // Needed for cleanup after failure
	FixedResources     VmConfig // CPU etc
	StorageStatusList  []StorageStatus
	EIDList            []EIDStatusDetails
	OverlayNetworks    []OverlayNetworkStatus
	UnderlayNetworks   []UnderlayNetworkStatus
	// Copies of config to determine diffs
	OverlayNetworkList  []EIDOverlayConfig
	UnderlayNetworkList []UnderlayNetworkConfig
	BootTime            time.Time
	IoAdapterList       []IoAdapter
	RestartCmd          AppInstanceOpsCmd
	PurgeCmd            AppInstanceOpsCmd
	RestartInprogress   Inprogress
	PurgeInprogress     Inprogress
	// Mininum state across all steps and all StorageStatus.
	// Error* set implies error.
	State            SwState
	MissingDatastore bool // If some DatastoreId not found
	MissingNetwork   bool // If some Network UUID not found
	// All error strings across all steps and all StorageStatus
	ErrorSource string
	Error       string
	ErrorTime   time.Time
}

Indexed by UUIDandVersion as above

func (AppInstanceStatus) CheckPendingAdd

func (status AppInstanceStatus) CheckPendingAdd() bool

func (AppInstanceStatus) CheckPendingDelete

func (status AppInstanceStatus) CheckPendingDelete() bool

func (AppInstanceStatus) CheckPendingModify

func (status AppInstanceStatus) CheckPendingModify() bool

func (AppInstanceStatus) Key

func (status AppInstanceStatus) Key() string

func (AppInstanceStatus) VerifyFilename

func (status AppInstanceStatus) VerifyFilename(fileName string) bool

type AppNetworkConfig

type AppNetworkConfig struct {
	UUIDandVersion      UUIDandVersion
	DisplayName         string
	Activate            bool
	IsZedmanager        bool
	LegacyDataPlane     bool
	OverlayNetworkList  []OverlayNetworkConfig
	UnderlayNetworkList []UnderlayNetworkConfig
}

Indexed by UUID If IsZedmanager is set we do not create boN but instead configure the EID locally. This will go away once ZedManager runs in a domU like any application.

func (*AppNetworkConfig) IsNetworkUsed

func (config *AppNetworkConfig) IsNetworkUsed(network uuid.UUID) bool

func (AppNetworkConfig) Key

func (config AppNetworkConfig) Key() string

func (AppNetworkConfig) VerifyFilename

func (config AppNetworkConfig) VerifyFilename(fileName string) bool

type AppNetworkStatus

type AppNetworkStatus struct {
	UUIDandVersion UUIDandVersion
	AppNum         int
	Activated      bool
	PendingAdd     bool
	PendingModify  bool
	PendingDelete  bool
	DisplayName    string
	// Copy from the AppNetworkConfig; used to delete when config is gone.
	IsZedmanager        bool
	LegacyDataPlane     bool
	OverlayNetworkList  []OverlayNetworkStatus
	UnderlayNetworkList []UnderlayNetworkStatus
	MissingNetwork      bool // If any Missing flag is set in the networks
	// Any errros from provisioning the network
	Error     string
	ErrorTime time.Time
}

Indexed by UUID

func (AppNetworkStatus) CheckPendingAdd

func (status AppNetworkStatus) CheckPendingAdd() bool

func (AppNetworkStatus) CheckPendingDelete

func (status AppNetworkStatus) CheckPendingDelete() bool

func (AppNetworkStatus) CheckPendingModify

func (status AppNetworkStatus) CheckPendingModify() bool

func (AppNetworkStatus) Key

func (status AppNetworkStatus) Key() string

func (AppNetworkStatus) Pending

func (status AppNetworkStatus) Pending() bool

func (AppNetworkStatus) VerifyFilename

func (status AppNetworkStatus) VerifyFilename(fileName string) bool

type AssignableAdapters

type AssignableAdapters struct {
	Initialized  bool
	IoBundleList []IoBundle
}

func (*AssignableAdapters) LookupIoBundleForMember

func (aa *AssignableAdapters) LookupIoBundleForMember(
	ioType IoType, memberName string) *IoBundle

type BaseOsConfig

type BaseOsConfig struct {
	UUIDandVersion    UUIDandVersion
	BaseOsVersion     string // From GetShortVersion
	ConfigSha256      string
	ConfigSignature   string
	OsParams          []OsVerParams // From GetLongVersion
	StorageConfigList []StorageConfig
	RetryCount        int32
	Activate          bool
	TestComplete      bool
}

func (BaseOsConfig) Key

func (config BaseOsConfig) Key() string

func (BaseOsConfig) VerifyFilename

func (config BaseOsConfig) VerifyFilename(fileName string) bool

type BaseOsStatus

type BaseOsStatus struct {
	UUIDandVersion    UUIDandVersion
	BaseOsVersion     string
	ConfigSha256      string
	Activated         bool
	Reboot            bool
	TestComplete      bool
	TooEarly          bool // Failed since previous was inprogress/test
	OsParams          []OsVerParams
	StorageStatusList []StorageStatus
	PartitionLabel    string
	PartitionDevice   string // From zboot
	PartitionState    string // From zboot

	// Mininum state across all steps/StorageStatus.
	// Error* set implies error.
	State            SwState
	MissingDatastore bool // If some DatastoreId not found
	// error strings across all steps/StorageStatus
	Error     string
	ErrorTime time.Time
}

Indexed by UUIDandVersion as above

func (BaseOsStatus) CheckPendingAdd

func (status BaseOsStatus) CheckPendingAdd() bool

func (BaseOsStatus) CheckPendingDelete

func (status BaseOsStatus) CheckPendingDelete() bool

func (BaseOsStatus) CheckPendingModify

func (status BaseOsStatus) CheckPendingModify() bool

func (BaseOsStatus) Key

func (status BaseOsStatus) Key() string

func (BaseOsStatus) VerifyFilename

func (status BaseOsStatus) VerifyFilename(fileName string) bool

type CertConfig

type CertConfig struct {
	ServerCert DownloaderConfig
	CertChain  []DownloaderConfig
}

type CertObjConfig

type CertObjConfig struct {
	UUIDandVersion    UUIDandVersion
	ConfigSha256      string
	StorageConfigList []StorageConfig
}

captures the certificate config currently embeded in Storage config from various objects the UUIDandVersion/Config Sha are just copied from the holder object configuration for indexing XXX shouldn't it be keyed by safename

func (CertObjConfig) Key

func (config CertObjConfig) Key() string

func (CertObjConfig) VerifyFilename

func (config CertObjConfig) VerifyFilename(fileName string) bool

type CertObjStatus

type CertObjStatus struct {
	UUIDandVersion    UUIDandVersion
	ConfigSha256      string
	StorageStatusList []StorageStatus
	// Mininum state across all steps/ StorageStatus.
	// Error* set implies error.
	State            SwState
	MissingDatastore bool // If some DatastoreId not found
	// error strings across all steps/StorageStatus
	Error     string
	ErrorTime time.Time
}

Indexed by UUIDandVersion as above XXX shouldn't it be keyed by safename

func (CertObjStatus) CheckPendingAdd

func (status CertObjStatus) CheckPendingAdd() bool

func (CertObjStatus) CheckPendingDelete

func (status CertObjStatus) CheckPendingDelete() bool

func (CertObjStatus) CheckPendingModify

func (status CertObjStatus) CheckPendingModify() bool

func (CertObjStatus) Key

func (status CertObjStatus) Key() string

func (CertObjStatus) VerifyFilename

func (status CertObjStatus) VerifyFilename(fileName string) bool

type ChangeInProgressType

type ChangeInProgressType int32
const (
	ChangeInProgressTypeNone   ChangeInProgressType = 0
	ChangeInProgressTypeCreate ChangeInProgressType = 1
	ChangeInProgressTypeModify ChangeInProgressType = 2
	ChangeInProgressTypeDelete ChangeInProgressType = 3
	ChangeInProgressTypeLast   ChangeInProgressType = 255
)

type ConfigItem

type ConfigItem struct {
	Key   string
	Value interface{}
}

Mirrors proto definition for ConfigItem The value can be bool, float, uint, or string

type DatastoreConfig

type DatastoreConfig struct {
	UUID     uuid.UUID
	DsType   string
	Fqdn     string
	ApiKey   string
	Password string
	Dpath    string // depending on DsType, it could be bucket or path
	Region   string
}

func (DatastoreConfig) Key

func (config DatastoreConfig) Key() string

type DeviceConfigResponse

type DeviceConfigResponse struct {
	Config EdgeDevConfig
}

top level config container

type DeviceNetworkConfig

type DeviceNetworkConfig struct {
	Uplink      []string // ifname; all uplinks
	FreeUplinks []string // subset used for image downloads
}

Global network config. For backwards compatibility with build artifacts XXX move to using DevicePortConfig in build? XXX remove since it uses old "Uplink" terms. Need to fix build etc

type DeviceNetworkStatus

type DeviceNetworkStatus struct {
	Version DevicePortConfigVersion // From DevicePortConfig
	Testing bool                    // Ignore since it is not yet verified
	Ports   []NetworkPortStatus
}

Published to microservices which needs to know about ports and IP addresses

func (*DeviceNetworkStatus) GetPortByIfName

func (status *DeviceNetworkStatus) GetPortByIfName(
	port string) *NetworkPortStatus

func (*DeviceNetworkStatus) GetPortByName

func (status *DeviceNetworkStatus) GetPortByName(
	port string) *NetworkPortStatus

type DevicePortConfig

type DevicePortConfig struct {
	Version      DevicePortConfigVersion
	Key          string
	TimePriority time.Time // All zero's is fallback lowest priority

	// Times when last ping test Failed/Succeeded.
	// All zeros means never tested.
	LastFailed    time.Time
	LastSucceeded time.Time
	LastError     string // Set when LastFailed is updated

	Ports []NetworkPortConfig
}

A complete set of configuration for all the ports used by zedrouter on the device

func (*DevicePortConfig) DoSanitize

func (portConfig *DevicePortConfig) DoSanitize(
	sanitizeTimePriority bool,
	sanitizeKey bool, key string,
	sanitizeName bool)

func (*DevicePortConfig) IsAnyPortInPciBack

func (portConfig *DevicePortConfig) IsAnyPortInPciBack(
	aa *AssignableAdapters) (bool, string, uuid.UUID)

IsAnyPortInPciBack

Checks is any of the Ports are part of IO bundles which are in PCIback.
If true, it also returns the portName ( NOT bundle name )
Also returns whether it is currently used by an application by
returning a UUID. If the UUID is zero it is in PCIback but available.

func (DevicePortConfig) IsDPCTestable

func (portConfig DevicePortConfig) IsDPCTestable() bool

Return false if recent failure (less than 60 seconds ago)

func (DevicePortConfig) IsDPCUntested

func (portConfig DevicePortConfig) IsDPCUntested() bool

func (DevicePortConfig) WasDPCWorking

func (portConfig DevicePortConfig) WasDPCWorking() bool

Check if the last results for the DPC was Success

type DevicePortConfigList

type DevicePortConfigList struct {
	CurrentIndex   int
	PortConfigList []DevicePortConfig
}

Array in timestamp aka priority order; first one is the most desired config to use

type DevicePortConfigVersion

type DevicePortConfigVersion uint32
const (
	DPCInitial DevicePortConfigVersion = iota
	DPCIsMgmt                          // Require IsMgmt to be set for management ports
)

When new fields and/or new semantics are added to DevicePortConfig a new version value is added here.

type DhcpConfig

type DhcpConfig struct {
	Dhcp       DhcpType // If DT_STATIC use below; if DT_NONE do nothing
	AddrSubnet string   // In CIDR e.g., 192.168.1.44/24
	Gateway    net.IP
	DomainName string
	NtpServer  net.IP
	DnsServers []net.IP // If not set we use Gateway as DNS server
}

type DhcpType

type DhcpType uint8
const (
	DT_NOOP       DhcpType = iota
	DT_STATIC              // Device static config
	DT_NONE                // App passthrough e.g., to a bridge
	DT_Deprecated          // XXX to match .proto value
	DT_CLIENT              // Device client on external port
)

type DiskConfig

type DiskConfig struct {
	ImageSha256 string // sha256 of immutable image
	ReadOnly    bool
	Preserve    bool // If set a rw disk will be preserved across
	// boots (acivate/inactivate)
	Maxsizebytes uint64 // Resize filesystem to this size if set
	Format       string // Default "raw"; could be raw, qcow, qcow2, vhd
	Devtype      string // Default ""; could be e.g. "cdrom"
}

XenManager will pass these to the xen xl config file The vdev is automatically assigned as xvd[x], where X is a, b, c etc, based on the order in the DiskList Note that vdev in general can be hd[x], xvd[x], sd[x] but here we only use xvd

type DiskStatus

type DiskStatus struct {
	ImageSha256        string // sha256 of immutable image
	ReadOnly           bool
	Preserve           bool
	FileLocation       string // Local location of Image
	Maxsizebytes       uint64 // Resize filesystem to this size if set
	Format             string // From config
	Devtype            string // From config
	Vdev               string // Allocated
	ActiveFileLocation string // Allocated; private copy if RW; FileLocation if RO
}

type DnsNameToIP

type DnsNameToIP struct {
	HostName string
	IPs      []net.IP
}

type DomainConfig

type DomainConfig struct {
	UUIDandVersion UUIDandVersion
	DisplayName    string // Use as name for domU? DisplayName+version?
	Activate       bool   // Actually start the domU as opposed to prepare
	AppNum         int    // From networking; makes the name unique
	VmConfig
	DiskConfigList    []DiskConfig
	VifList           []VifInfo
	IoAdapterList     []IoAdapter
	CloudInitUserData string // base64-encoded
}

The information XenManager needs to boot and halt domains If the the version (in UUIDandVersion) changes then the domain needs to halted and booted?? NO, because an ACL change from ZedControl would bump the version. Who determines which changes require halt+reboot? Do we need an explicit interlock with ZedManager when a reboot is needed? For instance, ZedManager could remove the DomainConfig, what for DomainStatus to be deleted, then re-create the DomainConfig.

func (DomainConfig) Key

func (config DomainConfig) Key() string

func (DomainConfig) VerifyFilename

func (config DomainConfig) VerifyFilename(fileName string) bool

type DomainStatus

type DomainStatus struct {
	UUIDandVersion     UUIDandVersion
	DisplayName        string
	State              SwState // BOOTING and above?
	Activated          bool    // XXX remove??
	AppNum             int
	PendingAdd         bool
	PendingModify      bool
	PendingDelete      bool
	DomainName         string // Name of Xen domain
	DomainId           int
	BootTime           time.Time
	DiskStatusList     []DiskStatus
	VifList            []VifInfo
	IoAdapterList      []IoAdapter
	VirtualizationMode VmMode
	EnableVnc          bool
	VncDisplay         uint32
	VncPasswd          string
	TriedCount         int
	LastErr            string // Xen error
	LastErrTime        time.Time
	BootFailed         bool
	AdaptersFailed     bool
}

func (DomainStatus) CheckPendingAdd

func (status DomainStatus) CheckPendingAdd() bool

func (DomainStatus) CheckPendingDelete

func (status DomainStatus) CheckPendingDelete() bool

func (DomainStatus) CheckPendingModify

func (status DomainStatus) CheckPendingModify() bool

func (DomainStatus) Key

func (status DomainStatus) Key() string

func (DomainStatus) Pending

func (status DomainStatus) Pending() bool

func (DomainStatus) VerifyFilename

func (status DomainStatus) VerifyFilename(fileName string) bool

type DownloaderConfig

type DownloaderConfig struct {
	Safename         string
	DownloadURL      string
	UseFreeMgmtPorts bool
	TransportMethod  string // Download Method S3/HTTP/SFTP etc.
	Dpath            string
	ApiKey           string
	Password         string
	Region           string
	Size             uint64 // In bytes
	ImageSha256      string // sha256 of immutable image
	FinalObjDir      string // final Object Store
	RefCount         uint
}

The key/index to this is the Safename which is allocated by ZedManager. That is the filename in which we store the corresponding json files.

func (DownloaderConfig) Key

func (config DownloaderConfig) Key() string

func (DownloaderConfig) VerifyFilename

func (config DownloaderConfig) VerifyFilename(fileName string) bool

type DownloaderStatus

type DownloaderStatus struct {
	Safename         string
	ObjType          string
	PendingAdd       bool
	PendingModify    bool
	PendingDelete    bool
	RefCount         uint      // Zero means not downloaded
	LastUse          time.Time // When RefCount dropped to zero
	Expired          bool      // Handshake to client
	DownloadURL      string
	UseFreeMgmtPorts bool
	ImageSha256      string  // sha256 of immutable image
	State            SwState // DOWNLOADED etc
	ReservedSpace    uint64  // Contribution to global ReservedSpace
	Size             uint64  // Once DOWNLOADED; in bytes
	Progress         uint    // In percent i.e., 0-100
	ModTime          time.Time
	LastErr          string // Download error
	LastErrTime      time.Time
	RetryCount       int
}

The key/index to this is the Safename which comes from DownloaderConfig. That is the filename in which we store the corresponding json files.

func (DownloaderStatus) CheckPendingAdd

func (status DownloaderStatus) CheckPendingAdd() bool

func (DownloaderStatus) CheckPendingDelete

func (status DownloaderStatus) CheckPendingDelete() bool

func (DownloaderStatus) CheckPendingModify

func (status DownloaderStatus) CheckPendingModify() bool

func (DownloaderStatus) Key

func (status DownloaderStatus) Key() string

func (DownloaderStatus) Pending

func (status DownloaderStatus) Pending() bool

func (DownloaderStatus) VerifyFilename

func (status DownloaderStatus) VerifyFilename(fileName string) bool

type EIDAllocation

type EIDAllocation struct {
	Allocate            bool
	ExportPrivate       bool   // Provide private key to ZedManager
	AllocationPrefix    []byte // Normally and default 0xfd
	AllocationPrefixLen int    // Normally and default 8
}

Parameters which determine whether and how the EID is allocated

type EIDConfig

type EIDConfig struct {
	UUIDandVersion UUIDandVersion
	DisplayName    string
	EIDConfigDetails
}

Indexed by UUID plus IID; version not included in index Implies a given App Instance can not have multiple interfaces to the same IID.

func (EIDConfig) Key

func (config EIDConfig) Key() string

func (EIDConfig) VerifyFilename

func (config EIDConfig) VerifyFilename(fileName string) bool

type EIDConfigDetails

type EIDConfigDetails struct {
	IID uint32
	EIDAllocation
	// When Allocate is false the ZedCloud provides these parameters.
	// No work for IdentityMgr in that case.
	// When Allocate is true these fields are not set in the config
	EID           net.IP
	LispSignature string
	PemCert       []byte
	PemPrivateKey []byte
}

type EIDOverlayConfig

type EIDOverlayConfig struct {
	Name string // From proto message
	EIDConfigDetails
	ACLs       []ACE
	AppMacAddr net.HardwareAddr // If set use it for vif
	AppIPAddr  net.IP           // EIDv4 or EIDv6
	Network    uuid.UUID

	// UsesNetworkInstance
	//   This attribute can be deleted when we stop network-service
	//   support.
	UsesNetworkInstance bool
	// Error
	//	If there is a parsing error and this uLNetwork config cannot be
	//	processed, set the error here. This allows the error to be propagated
	//  back to zedcloud
	//	If this is non-empty ( != ""), the network Config should not be
	// 	processed further. It Should just	be flagged to be in error state
	//  back to the cloud.
	Error string
}

type EIDStatus

type EIDStatus struct {
	UUIDandVersion UUIDandVersion
	DisplayName    string
	EIDStatusDetails
}

Indexed by UUID plus IID. Version is not part of the index.

func (EIDStatus) CheckPendingAdd

func (status EIDStatus) CheckPendingAdd() bool

func (EIDStatus) CheckPendingDelete

func (status EIDStatus) CheckPendingDelete() bool

func (EIDStatus) CheckPendingModify

func (status EIDStatus) CheckPendingModify() bool

func (EIDStatus) Key

func (status EIDStatus) Key() string

func (EIDStatus) Pending

func (status EIDStatus) Pending() bool

func (EIDStatus) VerifyFilename

func (status EIDStatus) VerifyFilename(fileName string) bool

type EIDStatusDetails

type EIDStatusDetails struct {
	IID uint32
	EIDAllocation
	PendingAdd    bool
	PendingModify bool
	PendingDelete bool
	EID           net.IP
	LispSignature string
	PemCert       []byte
	PemPublicKey  []byte
	PemPrivateKey []byte    // If ExportPrivate. XXX or in separate type?
	CreateTime    time.Time // When EID was created
}

type EdgeDevConfig

type EdgeDevConfig struct {
	Id                 UUIDandVersion
	DevConfigSha256    string
	DevConfigSignature string
	Apps               []AppInstanceConfig
	Networks           []UnderlayNetworkConfig
}

type EidMap

type EidMap struct {
	IID  uint64
	Eids []net.IP
}

type EidStatistics

type EidStatistics struct {
	IID       uint64
	Eid       net.IP
	RlocStats []LispRlocStatistics
}

type GlobalConfig

type GlobalConfig struct {
	ConfigInterval          uint32 // Try get of device config
	MetricInterval          uint32 // push metrics to cloud
	ResetIfCloudGoneTime    uint32 // reboot if no cloud connectivity
	FallbackIfCloudGoneTime uint32 // ... and shorter during update
	MintimeUpdateSuccess    uint32 // time before zedagent declares success
	StaleConfigTime         uint32 // On reboot use saved config if not stale
	DownloadGCTime          uint32 // Garbage collect if no use
	VdiskGCTime             uint32 // Garbage collect RW disk if no use

	DownloadRetryTime   uint32 // Retry failed download after N sec
	DomainBootRetryTime uint32 // Retry failed boot after N sec

	// Control NIM testing behavior: In seconds
	NetworkGeoRedoTime        uint32   // Periodic IP geolocation
	NetworkGeoRetryTime       uint32   // Redo IP geolocation failure
	NetworkTestDuration       uint32   // Time we wait for DHCP to complete
	NetworkTestInterval       uint32   // Re-test DevicePortConfig
	NetworkTestBetterInterval uint32   // Look for better DevicePortConfig
	NetworkFallbackAnyEth     TriState // When no connectivity try any Ethernet; XXX LTE?

	// UsbAccess
	// Determines if Dom0 can use USB devices.
	// If false:
	//		USB devices can only be passed through to the applications
	//		( pciBack=true). The devices are in pci-assignable-list
	// If true:
	// 		dom0 can use these devices as well.
	//		All USB devices will be assigned to dom0. pciBack=false.
	//		But these devices are still available in pci-assignable-list.
	UsbAccess             bool
	SshAccess             bool
	AllowAppVnc           bool
	DefaultLogLevel       string
	DefaultRemoteLogLevel string

	// Per agent settings of log levels; if set for an agent it
	// overrides the Default*Level above
	AgentSettings map[string]PerAgentSettings
}

Agents subscribe to this info to get at least the log levels A value of zero means we should use the default All times are in seconds.

func ApplyGlobalConfig

func ApplyGlobalConfig(newgc GlobalConfig) GlobalConfig

Check which values are set and which should come from defaults Zero integers means to use default

func EnforceGlobalConfigMinimums

func EnforceGlobalConfigMinimums(newgc GlobalConfig) GlobalConfig

type GlobalDownloadConfig

type GlobalDownloadConfig struct {
	MaxSpace uint64 // Number of kbytes allowed in /var/tmp/zedmanager/downloads
}

type GlobalDownloadStatus

type GlobalDownloadStatus struct {
	UsedSpace      uint64 // Number of kbytes used in /var/tmp/zedmanager/downloads
	ReservedSpace  uint64 // Reserved for ongoing downloads
	RemainingSpace uint64 // MaxSpace - UsedSpace - ReservedSpace
}

These are all in kbytes

type ImageStatus

type ImageStatus struct {
	Filename     string // Basename; used as key
	FileLocation string // Local location of Image
	RefCount     uint
	LastUse      time.Time // When RefCount dropped to zero
	Size         uint64
}

Track the active image files in rwImgDirname

func (ImageStatus) Key

func (status ImageStatus) Key() string

type Inprogress

type Inprogress uint8

Track more complicated workflows

const (
	NONE     Inprogress = iota
	DOWNLOAD            // Download and verify new images
	BRING_DOWN
	BRING_UP
)

type IoAdapter

type IoAdapter struct {
	Type IoType
	Name string // Short hand name such as "com"
}

type IoBundle

type IoBundle struct {
	// Type
	//	Type of the IoBundle
	Type IoType
	// Name
	//	Short hand name such as "com".
	//  xxx - Any description is where this is used? How this is to be set etc??
	Name string // Short hand name such as "com"
	// Members
	//	List of members ( names )
	//  XXX - Should this be a map?? With list, we cannot detect duplicate members
	//		In most cases, we probably do lookups on members - they become easy with
	//		Maps too.
	Members []string // E.g., "com1", "com2"
	// UsedByUUID
	//	Application UUID ( Can be Dom0 too ) that owns the Bundle.
	//	For unassigned adapters, this is not set.
	UsedByUUID uuid.UUID

	// Local information not reported to cloud
	Lookup   bool   // Look up name to find PCI
	PciLong  string // If adapter on some bus and not Eth
	PciShort string // If pci adapter and not Eth
	XenCfg   string // If template for the bundle
	Unique   string // From firmware_node symlink; used for debug checks

	// For each member we have these with the same indicies. Only used when
	// Lookup is set.
	// XXX a Member struct would make more sense but need compatibility with existing json
	MPciLong  []string // If adapter on some bus
	MPciShort []string // If pci adapter
	MUnique   []string // From firmware_node symlink; used for debug checks

	// IsPciBack
	//	Is the IoBundle assigned to pciBack; means all members are assigned
	//  If the device is managed by dom0, this is False.
	//  If the device is ( or to be ) managed by DomU, this is True
	IsPCIBack bool // Assigned to pciback
	IsPort    bool // Whole or part of the bundle is a zedrouter port

}

func LookupIoBundle

func LookupIoBundle(aa *AssignableAdapters, ioType IoType, name string) *IoBundle

Returns nil if not found

type IoType

type IoType uint8

Should match definition in appconfig.proto

const (
	IoNop   IoType = 0
	IoEth   IoType = 1
	IoUSB   IoType = 2
	IoCom   IoType = 3
	IoOther IoType = 255
)

type IpRange

type IpRange struct {
	Start net.IP
	End   net.IP
}

type LedBlinkCounter

type LedBlinkCounter struct {
	BlinkCounter int
}

type LinkPktStats

type LinkPktStats struct {
	InPkts  PktStats
	OutPkts PktStats
}

type LispConfig

type LispConfig struct {
	MapServers    []MapServer
	IID           uint32
	Allocate      bool
	ExportPrivate bool
	EidPrefix     net.IP
	EidPrefixLen  uint32

	Experimental bool
}

type LispDatabaseMap

type LispDatabaseMap struct {
	IID             uint64
	MapCacheEntries []LispMapCacheEntry
}

type LispDataplaneConfig

type LispDataplaneConfig struct {
	// If true, we run legacy lispers.net data plane.
	Legacy bool
}

type LispDecapKey

type LispDecapKey struct {
	Rloc     net.IP
	Port     uint64
	KeyCount uint64
}

type LispInfoStatus

type LispInfoStatus struct {
	ItrCryptoPort uint64
	EtrNatPort    uint64
	Interfaces    []string
	DatabaseMaps  []LispDatabaseMap
	DecapKeys     []LispDecapKey
}

type LispMapCacheEntry

type LispMapCacheEntry struct {
	EID   net.IP
	Rlocs []LispRlocState
}

type LispMetrics

type LispMetrics struct {
	// Encap Statistics
	EidMaps            []EidMap
	EidStats           []EidStatistics
	ItrPacketSendError LispPktStat
	InvalidEidError    LispPktStat

	// Decap Statistics
	NoDecryptKey       LispPktStat
	OuterHeaderError   LispPktStat
	BadInnerVersion    LispPktStat
	GoodPackets        LispPktStat
	ICVError           LispPktStat
	LispHeaderError    LispPktStat
	CheckSumError      LispPktStat
	DecapReInjectError LispPktStat
	DecryptError       LispPktStat
}

type LispPktStat

type LispPktStat struct {
	Pkts  uint64
	Bytes uint64
}

type LispRlocState

type LispRlocState struct {
	Rloc      net.IP
	Reachable bool
}

type LispRlocStatistics

type LispRlocStatistics struct {
	Rloc                   net.IP
	Stats                  LispPktStat
	SecondsSinceLastPacket uint64
}

type MapServer

type MapServer struct {
	ServiceType MapServerType
	NameOrIp    string
	Credential  string
}

type MapServerType

type MapServerType uint8
const (
	MST_INVALID MapServerType = iota
	MST_MAPSERVER
	MST_SUPPORT_SERVER
	MST_LAST = 255
)

type MetricItem

type MetricItem struct {
	Key   string
	Type  MetricItemType
	Value interface{}
}

Mirrors proto definition for MetricItem The value can be bool, float, uint, or string

type MetricItemType

type MetricItemType uint8
const (
	MetricItemOther   MetricItemType = iota // E.g., a string like an ESSID
	MetricItemGauge                         // Goes up and down over time
	MetricItemCounter                       // Monotonically increasing (until reboot)
	MetricItemState                         // Toggles on and off; count transitions
)

type NetLinkConfig

type NetLinkConfig struct {
	Name        string
	IpAddr      string
	SubnetBlock string
}

type NetworkInstanceConfig

type NetworkInstanceConfig struct {
	UUIDandVersion
	DisplayName string

	Type NetworkInstanceType

	// Activate - Activate the config.
	Activate bool

	// Port - Port name specified in the Device Config.
	Port string

	// IP configuration for the Application
	IpType          AddressType
	Subnet          net.IPNet
	Gateway         net.IP
	DomainName      string
	NtpServer       net.IP
	DnsServers      []net.IP // If not set we use Gateway as DNS server
	DhcpRange       IpRange
	DnsNameToIPList []DnsNameToIP // Used for DNS and ACL ipset

	HasEncap bool // Lisp/Vpn, for adjusting pMTU
	// For other network services - Proxy / Lisp /StrongSwan etc..
	OpaqueConfig string
	LispConfig   NetworkInstanceLispConfig
}

NetworkInstanceConfig

Config Object for NetworkInstance
Extracted from the protobuf NetworkInstanceConfig

func (*NetworkInstanceConfig) IsIPv6

func (config *NetworkInstanceConfig) IsIPv6() bool

func (*NetworkInstanceConfig) Key

func (config *NetworkInstanceConfig) Key() string

type NetworkInstanceInfo

type NetworkInstanceInfo struct {
	BridgeNum    int
	BridgeName   string // bn<N>
	BridgeIPAddr string
	BridgeMac    string

	// interface names for the Port
	IfNameList []string // Recorded at time of activate

	// Collection of address assignments; from MAC address to IP address
	IPAssignments map[string]net.IP

	// Union of all ipsets fed to dnsmasq for the linux bridge
	BridgeIPSets []string

	// Set of vifs on this bridge
	Vifs []VifNameMac

	Ipv4Eid bool // Track if this is a CryptoEid with IPv4 EIDs

	// Any errrors from provisioning the network
	Error     string
	ErrorTime time.Time

	// Vif metric map. This should have a union of currently existing
	// vifs and previously deleted vifs.
	// XXX When a vif is removed from bridge (app instance delete case),
	// device might start reporting smaller statistic values. To avoid this
	// from happening, we keep a list of all vifs that were ever connected
	// to this bridge and their statistics.
	// We add statistics from all vifs while reporting to cloud.
	VifMetricMap map[string]NetworkMetric
}

func (*NetworkInstanceInfo) AddVif

func (instanceInfo *NetworkInstanceInfo) AddVif(
	vifName string, appMac string, appID uuid.UUID)

func (*NetworkInstanceInfo) IsVifInBridge

func (instanceInfo *NetworkInstanceInfo) IsVifInBridge(
	vifName string) bool

func (*NetworkInstanceInfo) RemoveVif

func (instanceInfo *NetworkInstanceInfo) RemoveVif(
	vifName string)

type NetworkInstanceLispConfig

type NetworkInstanceLispConfig struct {
	MapServers    []MapServer
	IID           uint32
	Allocate      bool
	ExportPrivate bool
	EidPrefix     net.IP
	EidPrefixLen  uint32

	Experimental bool
}

type NetworkInstanceMetrics

type NetworkInstanceMetrics struct {
	UUIDandVersion UUIDandVersion
	DisplayName    string
	Type           NetworkInstanceType
	NetworkMetrics NetworkMetrics
	VpnMetrics     *VpnMetrics
	LispMetrics    *LispMetrics
}

func (NetworkInstanceMetrics) Key

func (metrics NetworkInstanceMetrics) Key() string

type NetworkInstanceStatus

type NetworkInstanceStatus struct {
	NetworkInstanceConfig
	ChangeInProgress ChangeInProgressType

	// Activated
	//	Keeps track of current state of object - if it has been activated
	Activated bool

	NetworkInstanceInfo

	OpaqueStatus string
	LispStatus   NetworkInstanceLispConfig

	VpnStatus      *ServiceVpnStatus
	LispInfoStatus *LispInfoStatus
	LispMetrics    *LispMetrics
}

NetworkInstanceStatus

Config Object for NetworkInstance
Extracted from the protobuf NetworkInstanceConfig

func (*NetworkInstanceStatus) IsIpAssigned

func (status *NetworkInstanceStatus) IsIpAssigned(ip net.IP) bool

Returns true if found

func (*NetworkInstanceStatus) IsUsingPort

func (status *NetworkInstanceStatus) IsUsingPort(port string) bool

Check if port is used even if a label like "uplink" is used to specify it

func (*NetworkInstanceStatus) SetError

func (status *NetworkInstanceStatus) SetError(err error)

func (*NetworkInstanceStatus) UpdateBridgeMetrics

func (status *NetworkInstanceStatus) UpdateBridgeMetrics(
	nms *NetworkMetrics, netMetric *NetworkMetric)

* Tx/Rx of bridge is equal to the total of Tx/Rx on all member * virtual interfaces excluding the bridge itself. * * Drops/Errors/AclDrops of bridge is equal to total of Drops/Errors/AclDrops * on all member virtual interface including the bridge.

func (*NetworkInstanceStatus) UpdateNetworkMetrics

func (status *NetworkInstanceStatus) UpdateNetworkMetrics(
	nms *NetworkMetrics) *NetworkMetric

* Tx/Rx of bridge is equal to the total of Tx/Rx on all member * virtual interfaces excluding the bridge itself. * * Drops/Errors/AclDrops of bridge is equal to total of Drops/Errors/AclDrops * on all member virtual interface including the bridge.

type NetworkInstanceType

type NetworkInstanceType int32
const (
	NetworkInstanceTypeFirst       NetworkInstanceType = 0
	NetworkInstanceTypeSwitch      NetworkInstanceType = 1
	NetworkInstanceTypeLocal       NetworkInstanceType = 2
	NetworkInstanceTypeCloud       NetworkInstanceType = 3
	NetworkInstanceTypeMesh        NetworkInstanceType = 4
	NetworkInstanceTypeHoneyPot    NetworkInstanceType = 5
	NetworkInstanceTypeTransparent NetworkInstanceType = 6
	NetworkInstanceTypeLast        NetworkInstanceType = 255
)

These values should be same as the ones defined in zconfig.ZNetworkInstType

type NetworkMetric

type NetworkMetric struct {
	IfName              string
	TxBytes             uint64
	RxBytes             uint64
	TxDrops             uint64
	RxDrops             uint64
	TxPkts              uint64
	RxPkts              uint64
	TxErrors            uint64
	RxErrors            uint64
	TxAclDrops          uint64 // For implicit deny/drop at end
	RxAclDrops          uint64 // For implicit deny/drop at end
	TxAclRateLimitDrops uint64 // For all rate limited rules
	RxAclRateLimitDrops uint64 // For all rate limited rules
}

type NetworkMetrics

type NetworkMetrics struct {
	MetricList []NetworkMetric
}

Network metrics for overlay and underlay Matches networkMetrics protobuf message

func CastNetworkMetrics

func CastNetworkMetrics(in interface{}) NetworkMetrics

XXX this works but ugly as ... Alternative seems to be a deep walk with type assertions in order to produce the map of map of map with the correct type.

func (*NetworkMetrics) LookupNetworkMetrics

func (nms *NetworkMetrics) LookupNetworkMetrics(ifName string) (NetworkMetric, bool)

type NetworkObjectConfig

type NetworkObjectConfig struct {
	UUID            uuid.UUID
	Type            NetworkType
	Dhcp            DhcpType // If DT_STATIC or DT_CLIENT use below
	Subnet          net.IPNet
	Gateway         net.IP
	DomainName      string
	NtpServer       net.IP
	DnsServers      []net.IP // If not set we use Gateway as DNS server
	DhcpRange       IpRange
	DnsNameToIPList []DnsNameToIP // Used for DNS and ACL ipset
	Proxy           *ProxyConfig
}

Extracted from the protobuf NetworkConfig Referenced using the UUID in Overlay/UnderlayNetworkConfig Note that NetworkConfig can be referenced (by UUID) from NetworkService. If there is no such reference the NetworkConfig ends up being local to the host.

func (NetworkObjectConfig) Key

func (config NetworkObjectConfig) Key() string

type NetworkObjectStatus

type NetworkObjectStatus struct {
	NetworkObjectConfig
	PendingAdd    bool
	PendingModify bool
	PendingDelete bool

	NetworkInstanceInfo
	// Used to populate DNS and eid ipset
	DnsNameToIPList []DnsNameToIP
}

func (NetworkObjectStatus) Key

func (status NetworkObjectStatus) Key() string

type NetworkPortConfig

type NetworkPortConfig struct {
	IfName string
	Name   string // New logical name set by controller/model
	IsMgmt bool   // Used to talk to controller
	Free   bool   // Higher priority to talk to controller since no cost
	DhcpConfig
	ProxyConfig
}

type NetworkPortStatus

type NetworkPortStatus struct {
	IfName string
	Name   string // New logical name set by controller/model
	IsMgmt bool   // Used to talk to controller
	Free   bool
	NetworkObjectConfig
	AddrInfoList []AddrInfo
	ProxyConfig
	Error     string
	ErrorTime time.Time
}

func GetMgmtPortsFreeNoLinkLocal

func GetMgmtPortsFreeNoLinkLocal(globalStatus DeviceNetworkStatus) []NetworkPortStatus

Return a list of free management ports that have non link local IP addresses Used by LISP.

func GetPort

func GetPort(globalStatus DeviceNetworkStatus, port string) *NetworkPortStatus

type NetworkProxyType

type NetworkProxyType uint8
const (
	NPT_HTTP NetworkProxyType = iota
	NPT_HTTPS
	NPT_SOCKS
	NPT_FTP
	NPT_NOPROXY
	NPT_LAST = 255
)

Values if these definitions should match the values given to the types in zapi.ProxyProto

type NetworkServiceConfig

type NetworkServiceConfig struct {
	UUID         uuid.UUID
	Internal     bool // Internally created - not from zedcloud
	DisplayName  string
	Type         NetworkServiceType
	Activate     bool
	AppLink      uuid.UUID
	Adapter      string // Ifname or group like "uplink", or empty
	OpaqueConfig string
	LispConfig   LispConfig
}

Extracted from protobuf Service definition

func (NetworkServiceConfig) Key

func (config NetworkServiceConfig) Key() string

type NetworkServiceMetrics

type NetworkServiceMetrics struct {
	UUID        uuid.UUID
	DisplayName string
	Type        NetworkServiceType
	VpnMetrics  *VpnMetrics
	LispMetrics *LispMetrics
}

func (NetworkServiceMetrics) Key

func (metrics NetworkServiceMetrics) Key() string

type NetworkServiceStatus

type NetworkServiceStatus struct {
	UUID          uuid.UUID
	PendingAdd    bool
	PendingModify bool
	PendingDelete bool
	DisplayName   string
	Type          NetworkServiceType
	Activated     bool
	AppLink       uuid.UUID
	Adapter       string // Ifname or group like "uplink", or empty
	OpaqueStatus  string
	LispStatus    LispConfig
	IfNameList    []string  // Recorded at time of activate
	Subnet        net.IPNet // Recorded at time of activate

	MissingNetwork bool // If AppLink UUID not found
	// Any errrors from provisioning the service
	Error          string
	ErrorTime      time.Time
	VpnStatus      *ServiceVpnStatus
	LispInfoStatus *LispInfoStatus
	LispMetrics    *LispMetrics
}

func (NetworkServiceStatus) Key

func (status NetworkServiceStatus) Key() string

type NetworkServiceType

type NetworkServiceType uint8
const (
	NST_FIRST NetworkServiceType = iota
	NST_STRONGSWAN
	NST_LISP
	NST_BRIDGE
	NST_NAT // Default?
	NST_LB  // What is this?
	// XXX Add a NST_L3/NST_ROUTER to describe IP forwarding?
	NST_LAST = 255
)

type NetworkType

type NetworkType uint8

type OsVerParams

type OsVerParams struct {
	OSVerKey   string
	OSVerValue string
}

type OverlayNetworkConfig

type OverlayNetworkConfig struct {
	Name          string // From proto message
	EID           net.IP // Always EIDv6
	LispSignature string
	ACLs          []ACE
	AppMacAddr    net.HardwareAddr // If set use it for vif
	AppIPAddr     net.IP           // EIDv4 or EIDv6

	// Network
	//   Currently overloaded. Can point to NetworkInstance or
	//   NetworkConfig. If UsesNetworkInstance is set, Network
	//   UUID points to NetworkInstance. Else, it points
	//   to Network
	//   XXX - Clean this up when deleting Network-Service support.
	Network uuid.UUID
	// UsesNetworkInstance
	//   This attribute can be deleted when we stop network-service
	//   support.
	UsesNetworkInstance bool

	// Error
	//	If there is a parsing error and this uLNetwork config cannot be
	//	processed, set the error here. This allows the error to be propagated
	//  back to zedcloud
	//	If this is non-empty ( != ""), the network Config should not be
	// 	processed further. It Should just	be flagged to be in error state
	//  back to the cloud.
	Error string
	// Optional additional information
	AdditionalInfoDevice *AdditionalInfoDevice

	// These field are only for isMgmt. XXX remove when isMgmt is removed
	MgmtIID             uint32
	MgmtDnsNameToIPList []DnsNameToIP // Used to populate DNS for the overlay
	MgmtMapServers      []MapServer
}

type OverlayNetworkStatus

type OverlayNetworkStatus struct {
	OverlayNetworkConfig
	VifInfo
	BridgeMac    net.HardwareAddr
	BridgeIPAddr string // The address for DNS/DHCP service in zedrouter
	HostName     string
}

type PerAgentSettings

type PerAgentSettings struct {
	LogLevel       string // What we log to files
	RemoteLogLevel string // What we log to zedcloud
}

type PktStats

type PktStats struct {
	Pkts  uint64
	Bytes uint64
}

type ProxyConfig

type ProxyConfig struct {
	Proxies    []ProxyEntry
	Exceptions string
	Pacfile    string
	// If Enable is set we use WPAD. If the URL is not set we try
	// the various DNS suffixes until we can download a wpad.dat file
	NetworkProxyEnable bool   // Enable WPAD
	NetworkProxyURL    string // Complete URL i.e., with /wpad.dat
	WpadURL            string // The URL determined from DNS
}

type ProxyEntry

type ProxyEntry struct {
	Type   NetworkProxyType
	Server string
	Port   uint32
}

type RetStatus

type RetStatus struct {
	Changed          bool
	MinState         SwState
	WaitingForCerts  bool
	MissingDatastore bool
	AllErrors        string
	ErrorTime        time.Time
}

return value holder

type ServiceVpnStatus

type ServiceVpnStatus struct {
	Version            string    // strongswan package version
	UpTime             time.Time // service start time stamp
	IpAddrs            string    // listening ip addresses, can be multiple
	ActiveVpnConns     []*VpnConnStatus
	StaleVpnConns      []*VpnConnStatus
	ActiveTunCount     uint32
	ConnectingTunCount uint32
	PolicyBased        bool
}

type SignatureInfo

type SignatureInfo struct {
	IntermediateCertsPem []byte
	SignerCertPem        []byte
	Signature            []byte
}

The Intermediate can be a byte sequence of PEM certs

type StorageConfig

type StorageConfig struct {
	DatastoreId      uuid.UUID
	Name             string   // XXX Do depend on URL for clobber avoidance?
	NameIsURL        bool     // If not we form URL based on datastore info
	Size             uint64   // In bytes
	CertificateChain []string //name of intermediate certificates
	ImageSignature   []byte   //signature of image
	SignatureKey     string   //certificate containing public key

	ImageSha256 string // sha256 of immutable image
	ReadOnly    bool
	Preserve    bool // If set a rw disk will be preserved across
	// boots (acivate/inactivate)
	Maxsizebytes uint64 // Resize filesystem to this size if set
	Format       string // Default "raw"; could be raw, qcow, qcow2, vhd
	Devtype      string // Default ""; could be e.g. "cdrom"
	Target       string // Default "" is interpreted as "disk"
}

If the Target is "" or "disk", then this becomes a vdisk for the domU Other possible targets are: - "kernel" - "ramdisk" - "device_tree"

type StorageStatus

type StorageStatus struct {
	DatastoreId        uuid.UUID
	Name               string
	ImageSha256        string   // sha256 of immutable image
	Size               uint64   // In bytes
	CertificateChain   []string //name of intermediate certificates
	ImageSignature     []byte   //signature of image
	SignatureKey       string   //certificate containing public key
	ReadOnly           bool
	Preserve           bool
	Maxsizebytes       uint64 // Resize filesystem to this size if set
	Format             string
	Devtype            string
	Target             string  // Default "" is interpreted as "disk"
	State              SwState // DOWNLOADED etc
	Progress           uint    // In percent i.e., 0-100
	HasDownloaderRef   bool    // Reference against downloader to clean up
	HasVerifierRef     bool    // Reference against verifier to clean up
	ActiveFileLocation string  // Location of filestystem
	FinalObjDir        string  // Installation dir; may differ from verified
	MissingDatastore   bool    // If DatastoreId not found
	Error              string  // Download or verify error
	ErrorSource        string
	ErrorTime          time.Time
}

type StrongSwanServiceConfig

type StrongSwanServiceConfig struct {
	VpnRole          string
	PolicyBased      bool
	IsClient         bool
	VpnGatewayIpAddr string
	VpnSubnetBlock   string
	VpnLocalIpAddr   string
	VpnRemoteIpAddr  string
	PreSharedKey     string
	LocalSubnetBlock string
	ClientConfigList []VpnClientConfig
}

Input Opaque Config

type SwState

type SwState uint8

Enum names from OMA-TS-LWM2M_SwMgmt-V1_0-20151201-C The ones starting with BOOTING are in addition to OMA and represent operational/activated states.

const (
	INITIAL          SwState = iota + 1
	DOWNLOAD_STARTED         // Really download in progress
	DOWNLOADED
	DELIVERED // Package integrity verified
	INSTALLED // Available to be activated
	BOOTING
	RUNNING
	HALTING // being halted
	HALTED
	RESTARTING // Restarting due to config change or zcli
	PURGING    // Purging due to config change
	MAXSTATE   //
)

type TriState

type TriState uint8

Use this for booleans which have a none/dontcare/notset value

const (
	TS_NONE TriState = iota
	TS_DISABLED
	TS_ENABLED
)

func ParseTriState

func ParseTriState(value string) (TriState, error)

type UUIDandVersion

type UUIDandVersion struct {
	UUID    uuid.UUID
	Version string
}

UUID plus version

type UnderlayNetworkConfig

type UnderlayNetworkConfig struct {
	Name       string           // From proto message
	AppMacAddr net.HardwareAddr // If set use it for vif
	AppIPAddr  net.IP           // If set use DHCP to assign to app

	// Error
	//	If there is a parsing error and this uLNetwork config cannot be
	//	processed, set the error here. This allows the error to be propagated
	//  back to zedcloud
	//	If this is non-empty ( != ""), the UL network Config should not be
	// 	processed further. It Should just	be flagged to be in error state
	//  back to the cloud.
	Error string

	// Network
	//   Currently overloaded. Can point to NetworkInstance or
	//   NetworkConfig. If UsesNetworkInstance is set, Network
	//   UUID points to NetworkInstance. Else, it points
	//   to Network
	//   XXX - Clean this up when deleting Network-Service support.
	Network uuid.UUID
	// UsesNetworkInstance
	//   This attribute can be deleted when we stop network-service
	//   support.
	UsesNetworkInstance bool
	ACLs                []ACE
}

type UnderlayNetworkStatus

type UnderlayNetworkStatus struct {
	UnderlayNetworkConfig
	VifInfo
	BridgeMac      net.HardwareAddr
	BridgeIPAddr   string // The address for DNS/DHCP service in zedrouter
	AssignedIPAddr string // Assigned to domU
	HostName       string
}

type UrlCloudCfg

type UrlCloudCfg struct {
	ConfigUrl  string
	MetricsUrl string
	StatusUrl  string
	LogUrl     string
}

type UuidToNum

type UuidToNum struct {
	UUID        uuid.UUID
	Number      int
	NumType     string // For logging
	CreateTime  time.Time
	LastUseTime time.Time
	InUse       bool
}

Used to retain UUID to integer maps across reboots. Used for appNum and bridgeNum

func (UuidToNum) Key

func (info UuidToNum) Key() string

type VerifyImageConfig

type VerifyImageConfig struct {
	Safename         string // Also refers to the dirname in pending dir
	Name             string // For logging output
	ImageSha256      string // sha256 of immutable image
	RefCount         uint
	CertificateChain []string //name of intermediate certificates
	ImageSignature   []byte   //signature of image
	SignatureKey     string   //certificate containing public key
}

The key/index to this is the Safename which is allocated by ZedManager. That is the filename in which we store the corresponding json files.

func (VerifyImageConfig) Key

func (config VerifyImageConfig) Key() string

func (VerifyImageConfig) VerifyFilename

func (config VerifyImageConfig) VerifyFilename(fileName string) bool

type VerifyImageStatus

type VerifyImageStatus struct {
	Safename      string
	ObjType       string
	PendingAdd    bool
	PendingModify bool
	PendingDelete bool
	ImageSha256   string  // sha256 of immutable image
	State         SwState // DELIVERED; LastErr* set if failed
	LastErr       string  // Verification error
	LastErrTime   time.Time
	Size          int64
	RefCount      uint
	LastUse       time.Time // When RefCount dropped to zero
	Expired       bool      // Handshake to client
}

The key/index to this is the Safename which comes from VerifyImageConfig. That is the filename in which we store the corresponding json files.

func (VerifyImageStatus) CheckPendingAdd

func (status VerifyImageStatus) CheckPendingAdd() bool

func (VerifyImageStatus) CheckPendingDelete

func (status VerifyImageStatus) CheckPendingDelete() bool

func (VerifyImageStatus) CheckPendingModify

func (status VerifyImageStatus) CheckPendingModify() bool

func (VerifyImageStatus) Key

func (status VerifyImageStatus) Key() string

func (VerifyImageStatus) Pending

func (status VerifyImageStatus) Pending() bool

func (VerifyImageStatus) VerifyFilename

func (status VerifyImageStatus) VerifyFilename(fileName string) bool

type VifInfo

type VifInfo struct {
	Bridge string
	Vif    string
	Mac    string
}

type VifNameMac

type VifNameMac struct {
	Name    string
	MacAddr string
	AppID   uuid.UUID
}

type VmConfig

type VmConfig struct {
	Kernel     string // default ""
	Ramdisk    string // default ""
	Memory     int    // in kbytes; Rounded up to Mbytes for xen
	MaxMem     int    // Default not set i.e. no ballooning
	VCpus      int    // default 1
	MaxCpus    int    // default VCpus
	RootDev    string // default "/dev/xvda1"
	ExtraArgs  string // added to bootargs
	BootLoader string // default ""
	// For CPU pinning
	CPUs string // default "", list of "1,2"
	// Needed for device passthru
	DeviceTree string // default ""; sets device_tree
	// Example: device_tree="guest-gpio.dtb"
	DtDev []string // default nil; sets dtdev
	// Example, DtDev=["/smb/gpio@f7020000","/smb/gpio@f8013000"]
	IRQs []int // default nil; sets irqs
	// Example, IRQs=[88,86]
	IOMem []string // default nil; sets iomem
	// Example, IOMem=["0xf7020,1","0xf8013,1"]
	VirtualizationMode VmMode
	EnableVnc          bool
	VncDisplay         uint32
	VncPasswd          string
}

Some of these items can be overridden by matching Targets in StorageConfigList. For example, a Target of "kernel" means to set/override the Kernel attribute below.

type VmMode

type VmMode uint8
const (
	PV VmMode = iota + 0 // Default
	HVM
)

type VpnClientConfig

type VpnClientConfig struct {
	IpAddr       string
	SubnetBlock  string
	PreSharedKey string
	TunnelConfig VpnTunnelConfig
}

type VpnConnMetrics

type VpnConnMetrics struct {
	Id        string // ipsec connection id
	Name      string // connection name
	EstTime   uint64 // established time
	Type      NetworkServiceType
	NIType    NetworkInstanceType
	LEndPoint VpnEndPointMetrics
	REndPoint VpnEndPointMetrics
}

type VpnConnStatus

type VpnConnStatus struct {
	Id         string   // ipsec connection id
	Name       string   // connection name
	State      VpnState // vpn state
	Version    string   // ike version
	Ikes       string   // ike parameters
	EstTime    uint64   // established time
	ReauthTime uint64   // reauth time
	LInfo      VpnEndPoint
	RInfo      VpnEndPoint
	Links      []*VpnLinkStatus
	StartLine  uint32
	EndLine    uint32
	MarkDelete bool
}

type VpnEndPoint

type VpnEndPoint struct {
	Id     string // ipsec id
	IpAddr string // end point ip address
	Port   uint32 // udp port
}

type VpnEndPointMetrics

type VpnEndPointMetrics struct {
	IpAddr   string // end point ip address
	LinkInfo VpnLinkMetrics
	PktStats PktStats
}

type VpnLinkInfo

type VpnLinkInfo struct {
	SubNet    string // connecting subnet
	SpiId     string // security parameter index
	Direction bool   // 0 - in, 1 - out
	PktStats  PktStats
}

type VpnLinkMetrics

type VpnLinkMetrics struct {
	SubNet string // connecting subnet
	SpiId  string // security parameter index
}

type VpnLinkStatus

type VpnLinkStatus struct {
	Id         string
	Name       string
	ReqId      string
	InstTime   uint64 // installation time
	ExpTime    uint64 // expiry time
	RekeyTime  uint64 // rekey time
	EspInfo    string
	State      VpnState
	LInfo      VpnLinkInfo
	RInfo      VpnLinkInfo
	MarkDelete bool
}

type VpnMetrics

type VpnMetrics struct {
	UpTime     time.Time // service start time stamp
	DataStat   LinkPktStats
	IkeStat    LinkPktStats
	NatTStat   LinkPktStats
	EspStat    LinkPktStats
	ErrStat    LinkPktStats
	PhyErrStat LinkPktStats
	VpnConns   []*VpnConnMetrics
}

type VpnServiceConfig

type VpnServiceConfig struct {
	VpnRole          string
	PolicyBased      bool
	IsClient         bool
	PortConfig       NetLinkConfig
	AppLinkConfig    NetLinkConfig
	GatewayConfig    NetLinkConfig
	ClientConfigList []VpnClientConfig
}

structure for internal handling

type VpnState

type VpnState uint8
const (
	VPN_INVALID VpnState = iota
	VPN_INITIAL
	VPN_CONNECTING
	VPN_ESTABLISHED
	VPN_INSTALLED
	VPN_REKEYED
	VPN_DELETED  VpnState = 10
	VPN_MAXSTATE VpnState = 255
)

type VpnTunnelConfig

type VpnTunnelConfig struct {
	Name         string
	Key          string
	Mtu          string
	Metric       string
	LocalIpAddr  string
	RemoteIpAddr string
}

type ZbootStatus

type ZbootStatus struct {
	PartitionLabel   string
	PartitionDevname string
	PartitionState   string
	ShortVersion     string
	LongVersion      string
	CurrentPartition bool
}

func (ZbootStatus) Key

func (status ZbootStatus) Key() string

Jump to

Keyboard shortcuts

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