api

package
v0.0.0-...-18508e6 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointFQDNRefPrefix : prefix used to symbolically reference endpoint FQDN
	// (instead of directly entering the FQDN).
	// Can be used in DNSEntry.FQDN.
	EndpointFQDNRefPrefix = "endpoint-fqdn." // Followed by the endpoint logical label.
	// EndpointIPRefPrefix : prefix used to symbolically reference endpoint IP address(es).
	// (instead of directly entering the IP address).
	// Translates to both IPv4 and IPv6 address if Endpoint runs in dual-stack mode.
	// Can be used in DNSEntry.IP.
	EndpointIPRefPrefix = "endpoint-ip." // Followed by the endpoint logical label.
	// EndpointIPv4RefPrefix : prefix used to symbolically reference endpoint IPv4 address.
	EndpointIPv4RefPrefix = "endpoint-ipv4." // Followed by the endpoint logical label.
	// EndpointIPv6RefPrefix : prefix used to symbolically reference endpoint IPv6 address.
	EndpointIPv6RefPrefix = "endpoint-ipv6." // Followed by the endpoint logical label.
	// AdamIPRef : string used to symbolically reference adam IP address(es).
	// Translates to both IPv4 and IPv6 address if Adam runs in dual-stack mode.
	// Can be used in DNSEntry.IP.
	AdamIPRef = "adam-ip"
	// AdamIPv4Ref : string used to symbolically reference Adam IPv4 address.
	AdamIPv4Ref = "adam-ipv4"
	// AdamIPv6Ref : string used to symbolically reference Adam IPv6 address.
	// Can be used in DNSEntry.IP.
	AdamIPv6Ref = "adam-ipv6"
)
View Source
const EndpointBridgeRefPrefix = "bridge-endpoint-"

EndpointBridgeRefPrefix : prefix used for references to bridges from endpoints.

View Source
const NetworkBridgeRefPrefix = "bridge-network"

NetworkBridgeRefPrefix : prefix used for references to bridges from networks.

View Source
const PortMasterRef = "port-master"

PortMasterRef : reference to a physical port by a master interface (bond or bridge). Same between (and within) bonds and bridges to enforce exclusive access to the port.

Variables

View Source
var BondModeToID = map[string]BondMode{
	"":              BondModeBalanceRR,
	"balance-rr":    BondModeBalanceRR,
	"active-backup": BondModeActiveBackup,
	"balance-xor":   BondModeBalanceXOR,
	"broadcast":     BondModeBroadcast,
	"802.3ad":       BondMode802Dot3AD,
	"balance-tlb":   BondModeBalanceTLB,
	"balance-alb":   BondModeBalanceALB,
}

BondModeToID : get BondMode from a string representation.

View Source
var BondModeToString = map[BondMode]string{
	BondModeBalanceRR:    "balance-rr",
	BondModeActiveBackup: "active-backup",
	BondModeBalanceXOR:   "balance-xor",
	BondModeBroadcast:    "broadcast",
	BondMode802Dot3AD:    "802.3ad",
	BondModeBalanceTLB:   "balance-tlb",
	BondModeBalanceALB:   "balance-alb",
}

BondModeToString : convert BondMode to string representation used in JSON.

View Source
var FwActionToID = map[string]FwAction{
	"":       FwAllow,
	"allow":  FwAllow,
	"reject": FwReject,
	"drop":   FwDrop,
}

FwActionToID : get FwAction from a string representation.

View Source
var FwActionToString = map[FwAction]string{
	FwAllow:  "allow",
	FwReject: "reject",
	FwDrop:   "drop",
}

FwActionToString : convert FwAction to string representation used in JSON.

View Source
var FwProtoToID = map[string]FwProto{
	"":     AnyProto,
	"any":  AnyProto,
	"icmp": ICMP,
	"tcp":  TCP,
	"udp":  UDP,
}

FwProtoToID : get FwProto from a string representation.

View Source
var FwProtoToString = map[FwProto]string{
	AnyProto: "any",
	ICMP:     "icmp",
	TCP:      "tcp",
	UDP:      "udp",
}

FwProtoToString : convert FwProto to string representation used in JSON.

View Source
var LacpRateToID = map[string]LacpRate{
	"":     LacpRateSlow,
	"slow": LacpRateSlow,
	"fast": LacpRateFast,
}

LacpRateToID : get LacpRate from a string representation.

View Source
var LacpRateToString = map[LacpRate]string{
	LacpRateSlow: "slow",
	LacpRateFast: "fast",
}

LacpRateToString : convert LacpRate to string representation used in JSON.

View Source
var NetworkTypeToID = map[string]NetworkType{
	"":           Ipv4Only,
	"ipv4-only":  Ipv4Only,
	"ipv6-only":  Ipv6Only,
	"dual-stack": DualStack,
}

NetworkTypeToID : get NetworkType from a string representation.

View Source
var NetworkTypeToString = map[NetworkType]string{
	Ipv4Only:  "ipv4-only",
	Ipv6Only:  "ipv6-only",
	DualStack: "dual-stack",
}

NetworkTypeToString : convert NetworkType to string representation used in JSON.

View Source
var ProxyActionToID = map[string]ProxyAction{
	"":        PxForward,
	"forward": PxForward,
	"reject":  PxReject,
	"mitm":    PxMITM,
}

ProxyActionToID : get ProxyAction from a string representation.

View Source
var ProxyActionToString = map[ProxyAction]string{
	PxForward: "forward",
	PxReject:  "reject",
	PxMITM:    "mitm",
}

ProxyActionToString : convert ProxyAction to string representation used in JSON.

ProxyListenProtoToID : get ProxyListenProto from a string representation.

View Source
var ProxyListenProtoToString = map[ProxyListenProto]string{
	ProxyListenProtoUnspecified: "",
	ProxyListenProtoHTTP:        "http",
	ProxyListenProtoHTTPS:       "https",
}

ProxyListenProtoToString : convert ProxyListenProto to string representation used in JSON.

Functions

This section is empty.

Types

type Bond

type Bond struct {
	// LogicalLabel : logical name used for reference.
	LogicalLabel string `json:"logicalLabel"`
	// Ports : list of aggregated ports, referenced by logical labels.
	Ports []string `json:"ports"`
	// Mode : bonding policy.
	Mode BondMode `json:"mode"`
	// LacpRate : LACPDU packets transmission rate.
	// Applicable for BondMode802Dot3AD only.
	LacpRate LacpRate `json:"lacpRate"`
	// MIIMonitor : MII link state monitoring.
	// Link monitoring is either disabled or one of the monitors
	// is enabled (MII or ARP), never both at the same time.
	MIIMonitor BondMIIMonitor `json:"miiMonitor"`
	// ARPMonitor : ARP-based link state monitoring.
	// Link monitoring is either disabled or one of the monitors
	// is enabled (MII or ARP), never both at the same time.
	ARPMonitor BondArpMonitor `json:"arpMonitor"`
}

Bond is aggregating multiple ports for load-sharing and redundancy purposes. Also known as Link aggregation group (LAG).

func (Bond) ItemLogicalLabel

func (b Bond) ItemLogicalLabel() string

ItemLogicalLabel

func (Bond) ItemType

func (b Bond) ItemType() string

ItemType

func (Bond) ReferencesFromItem

func (b Bond) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type BondArpMonitor

type BondArpMonitor struct {
	// Enabled : set to true to enable ARP-based link monitoring.
	Enabled bool `json:"enabled"`
	// Interval specifies the ARP link monitoring frequency in milliseconds.
	Interval uint32 `json:"interval"`
	// IPTargets specifies the IPv4 addresses to use as ARP monitoring peers.
	// These are the targets of ARP requests sent to determine the health of links.
	IPTargets []string `json:"ipTargets"`
}

BondArpMonitor : ARP-based link monitoring parameters.

type BondMIIMonitor

type BondMIIMonitor struct {
	// Enabled : set to true to enable MII.
	Enabled bool `json:"enabled"`
	// Interval specifies the MII link monitoring frequency in milliseconds.
	// This determines how often the link state of each bond slave is inspected
	// for link failures.
	Interval uint32 `json:"interval"`
	// UpDelay specifies the time, in milliseconds, to wait before enabling
	// a bond slave after a link recovery has been detected.
	// The UpDelay value should be a multiple of the monitoring interval; if not,
	// it will be rounded down to the nearest multiple.
	// The default value is 0.
	UpDelay uint32 `json:"upDelay"`
	// DownDelay specifies the time, in milliseconds, to wait before disabling a bond
	// slave after a link failure has been detected.
	// The DownDelay value should be a multiple of the monitoring interval; if not,
	// it will be rounded down to the nearest multiple.
	// The default value is 0.
	DownDelay uint32 `json:"downDelay"`
}

BondMIIMonitor : MII link monitoring parameters.

type BondMode

type BondMode uint8

BondMode specifies the policy indicating how bonding slaves are used during network transmissions.

const (
	// BondModeBalanceRR : Round-Robin
	// This is the default mode.
	BondModeBalanceRR BondMode = iota
	// BondModeActiveBackup : Active/Backup
	BondModeActiveBackup
	// BondModeBalanceXOR : select slave for a packet using a hash function
	BondModeBalanceXOR
	// BondModeBroadcast : send every packet on all slaves
	BondModeBroadcast
	// BondMode802Dot3AD : IEEE 802.3ad Dynamic link aggregation
	BondMode802Dot3AD
	// BondModeBalanceTLB : Adaptive transmit load balancing
	BondModeBalanceTLB
	// BondModeBalanceALB : Adaptive load balancing
	BondModeBalanceALB
)

func (BondMode) MarshalJSON

func (s BondMode) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*BondMode) UnmarshalJSON

func (s *BondMode) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type Bridge

type Bridge struct {
	// LogicalLabel : logical name used for reference.
	LogicalLabel string `json:"logicalLabel"`
	// Logical labels of ports.
	Ports []string `json:"ports"`
	// Logical labels of bonds.
	Bonds []string `json:"bonds"`
	// WithSTP: enable to run the Spanning Tree Protocol (STP).
	WithSTP bool `json:"withSTP"`
}

Bridge provides L2 connectivity.

func (Bridge) ItemLogicalLabel

func (b Bridge) ItemLogicalLabel() string

ItemLogicalLabel

func (Bridge) ItemType

func (b Bridge) ItemType() string

ItemType

func (Bridge) ReferencesFromItem

func (b Bridge) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type Client

type Client struct {
	// Endpoint configuration.
	Endpoint
}

Client emulates a remote client. Can be used to run requests towards EVE.

func (Client) ItemCategory

func (e Client) ItemCategory() string

ItemCategory

type ConfigError

type ConfigError struct {
	// ItemRef : reference to a configuration item.
	ItemRef depgraph.ItemRef
	// ErrMsg : error message
	ErrMsg string
}

ConfigError : error returned if the SDN agent failed to configure some configuration item.

type DHCP

type DHCP struct {
	// Enables DHCP. Set to false to use static IP addressing in EVE.
	// For IPv6, SLAAC remains available regardless of this setting.
	Enable bool `json:"enable"`
	// IPRange : a range of IP addresses to allocate from.
	IPRange IPRange `json:"ipRange"`
	// StaticEntries : list of MAC->IP entries statically configured for the DHCP server.
	StaticEntries []MACToIP `json:"staticEntries"`
	// WithoutDefaultRoute : do not advertise default route to DHCP clients.
	WithoutDefaultRoute bool `json:"withoutDefaultRoute"`
	// DomainName : name of the domain assigned to the network.
	// It is propagated to clients using the DHCP option 15 (24 in DHCPv6).
	DomainName string `json:"domainName"`
	// DNSClientConfig : DNS configuration passed to clients via DHCP.
	DNSClientConfig
	// Public NTP server to announce via DHCP option 42 (56 in DHCPv6).
	// Do not configure both PublicNTP and PrivateNTP.
	PublicNTP string `json:"publicNTP"`
	// Logical label of an NTP endpoint running inside Eden SDN, announced to client
	// via DHCP option 42 (56 in DHCPv6).
	// Do not configure both PublicNTP and PrivateNTP.
	PrivateNTP string `json:"privateNTP"`
	// WPAD : URL with a location of a PAC file, announced using the Web Proxy Auto-Discovery
	// Protocol (WPAD) and DHCP.
	// The PAC file should contain a javascript that the client will use to determine
	// which proxy to use for a given request.
	// URL example: http://wpad.example.com/wpad.dat
	// The client will learn the PAC file location using the DHCP option 252.
	// Not supported for IPv6.
	// An alternative (and the only available for IPv6) approach is to use DNS
	// (with a DNSServer endpoint).
	WPAD string `json:"wpad"`
	// NetbootServer : Logical label of a NetbootServer endpoint which the client should use
	// to boot EVE OS from. The IP address or FQDN and the provisioning file (iPXE script)
	// location will be announced to the client using DHCP options 66 and 67 (59 in DHCPv6).
	// Eden-SDN will announce either IP address or FQDN depending on whether any of the assigned
	// private DNS servers is able to resolve the NetbootServer domain name.
	NetbootServer string `json:"netbootServer"`
}

DHCP configuration. For IPv6, if only DNS-related options are set, SLAAC remains the sole method for address assignment. Specifying any additional options (e.g., IP range, NTP servers) enables DHCPv6.

type DNSClientConfig

type DNSClientConfig struct {
	// PublicDNS specifies a list of IP addresses of public DNS servers.
	// These will be announced to clients using:
	// - DHCPv4: via option 6 (Domain Name Server)
	// - DHCPv6: via option 23 (Recursive DNS Server - RDNSS)
	// - SLAAC (IPv6): via Router Advertisement (RFC 6106)
	// Example: ["1.1.1.1", "8.8.8.8"]
	PublicDNS []string `json:"publicDNS"`
	// PrivateDNS : list of DNS servers running as endpoints inside Eden SDN.
	// These will be announced to clients using the same mechanisms as public DNS servers.
	// The list should contain logical labels of those endpoints, not IP addresses!
	PrivateDNS []string `json:"privateDNS"`
}

DNSClientConfig : DNS configuration for a client.

type DNSEntry

type DNSEntry struct {
	// FQDN : Fully qualified domain name.
	// Can be a reference to endpoint FQDN:
	//  - "endpoint-fqdn.<endpoint-logical-label>" - translated to endpoint's FQDN by Eden-SDN
	FQDN string `json:"fqdn"`
	// IP address or a special value that Eden-SDN will automatically translate
	// to the corresponding IP address:
	//  - "endpoint-ip.<endpoint-logical-label>"
	//        - translated to IP address(es) of the endpoint
	//        - translates to both IPv4 and IPv6 addresses if endpoint runs in dual-stack mode
	//  - "endpoint-ipv4.<endpoint-logical-label>"
	//        - translated to IPv4 address of the endpoint
	//  - "endpoint-ipv6.<endpoint-logical-label>"
	//        - translated to IPv6 address of the endpoint
	//  - "adam-ip"
	//        - translated to IP address(es) on which Adam (open-source controller)
	//          is deployed and accessible
	//        - translates to both IPv4 and IPv6 addresses if Adam runs in dual-stack mode
	//  - "adam-ipv4"
	//        - translated to IPv4 address of Adam controller
	//  - "adam-ipv6"
	//        - translated to IPv6 address of Adam controller
	IP string `json:"ip"`
}

DNSEntry : Mapping between FQDN and an IP address.

type DNSServer

type DNSServer struct {
	// Endpoint configuration.
	Endpoint
	// StaticEntries : list of FQDN->IP entries statically configured
	// for the server. These are typically used for endpoints running inside Eden-SDN,
	// which are obviously not known to the public DNS servers.
	StaticEntries []DNSEntry `json:"staticEntries"`
	// UpstreamServers : list of IP addresses of public DNS servers to forward
	// requests to (unless there is a static entry).
	UpstreamServers []string `json:"upstreamServers"`
}

DNSServer : endpoint providing DNS service.

func (DNSServer) ItemCategory

func (e DNSServer) ItemCategory() string

ItemCategory

func (DNSServer) ReferencesFromItem

func (e DNSServer) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type DirectL2EpConnect

type DirectL2EpConnect struct {
	// Logical label of a Bridge to which the endpoint is connected.
	Bridge string `json:"bridge"`
	// Access VLAN ID.
	// Leave zero value to express intent of not using VLAN filtering for this endpoint.
	VlanID uint16 `json:"vlanID"`
}

DirectL2EpConnect : direct L2 connection between an endpoint and EVE.

type DualStackEndpoint

type DualStackEndpoint struct {
	// IPv4 config for Endpoint.
	IPv4 EndpointIPConfig `json:"ipv4"`
	// IPv6 config for Endpoint.
	IPv6 EndpointIPConfig `json:"ipv6"`
}

DualStackEndpoint : dual-stack IP configuration for Endpoint.

type DualStackNetwork

type DualStackNetwork struct {
	// IPv4 config for Network.
	IPv4 NetworkIPConfig `json:"ipv4"`
	// IPv6 config for Network.
	IPv6 NetworkIPConfig `json:"ipv6"`
}

DualStackNetwork : dual-stack IP configuration for Network.

type EVEConnect

type EVEConnect struct {
	// EVEInstance : name of the EVE instance to which a given port is connected.
	// In the future, Eden may support running multiple EVE instances connected
	// to the same SDN and controller. It is likely that each such instance
	// will be assigned a unique logical label, which this field will reference.
	// However, currently Eden is only able to manage a single EVE instance.
	// For the time being it is therefore expected that this field is empty
	// and EVEConnect refers to the one and only EVE instance.
	EVEInstance string `json:"eveInstance"`
	// MAC address assigned to the interface on the EVE side.
	// If not specified by the user, Eden will generate a random MAC address.
	MAC string `json:"mac"`
}

EVEConnect : connects Port to a given EVE instance.

type Endpoint

type Endpoint struct {
	// LogicalLabel : logical name used for reference.
	LogicalLabel string `json:"logicalLabel"`
	// FQDN : Fully qualified domain name of the endpoint.
	FQDN string `json:"fqdn"`
	// Single-stack endpoint IP (v4 or v6) configuration.
	// Define either this or DualStack.
	EndpointIPConfig
	// Dual-stack endpoint IP configuration.
	// Define either this or the (single-stack) embedded EndpointIPConfig.
	DualStack DualStackEndpoint `json:"dualStack"`
	// DirectL2Connect : configure direct L2 connectivity between the endpoint and EVE.
	// Use alternatively or additionally to Subnet+IP options.
	DirectL2Connect DirectL2EpConnect `json:"directL2Connect"`
	// MTU of the endpoint's interface.
	// If not defined (zero value), the default MTU for Ethernet, which is 1500 bytes,
	// will be set.
	MTU uint16 `json:"mtu"`
}

Endpoint simulates "remote" client or a server.

func (Endpoint) IsDualStack

func (e Endpoint) IsDualStack() bool

IsDualStack returns true if Endpoint is configured to operate in dual-stack IP mode.

func (Endpoint) ItemLogicalLabel

func (e Endpoint) ItemLogicalLabel() string

ItemLogicalLabel

func (Endpoint) ItemType

func (e Endpoint) ItemType() string

ItemType

func (Endpoint) ReferencesFromItem

func (e Endpoint) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem can be further extended by endpoint specializations.

type EndpointIPConfig

type EndpointIPConfig struct {
	// Subnet : network address + netmask (IPv4 or IPv6).
	// Subnet needs to fit at least two host IP addresses,
	// one for the endpoint, another for a gateway.
	Subnet string `json:"subnet"`
	// IP should be inside the Subnet.
	IP string `json:"ip"`
}

EndpointIPConfig : IP configuration for Endpoint.

type Endpoints

type Endpoints struct {
	// Clients : list of clients. Can be used to run requests towards EVE.
	Clients []Client `json:"clients,omitempty"`
	// DNSServers : list of DNS servers. Can be referenced in DHCP.PrivateDNS.
	DNSServers []DNSServer `json:"dnsServers,omitempty"`
	// NTPServers : list of NTP servers. Can be referenced in DHCP.PrivateNTP.
	NTPServers []NTPServer `json:"ntpServers,omitempty"`
	// HTTPServers : list of HTTP(s) servers. Can be used to test HTTP(s) connectivity
	// from EVE, to serve PAC files, etc.
	HTTPServers []HTTPServer `json:"httpServers,omitempty"`
	// ExplicitProxies : proxies that must be configured explicitly.
	// Consider using together with NetworkModel.Firewall, configured to block HTTP(s)
	// traffic that tries to bypass a proxy.
	ExplicitProxies []ExplicitProxy `json:"explicitProxies,omitempty"`
	// TransparentProxies are proxying both HTTP and HTTPS traffic transparently.
	TransparentProxies []TransparentProxy `json:"transparentProxies,omitempty"`
	// NetbootServers : HTTP/TFTP servers providing artifacts needed to boot EVE OS
	// over a network (using netboot/PXE + iPXE).
	NetbootServers []NetbootServer `json:"netbootServers,omitempty"`
}

Endpoints simulate "remote" clients and servers.

func (Endpoints) GetAll

func (eps Endpoints) GetAll() (all []Endpoint)

GetAll : returns all endpoints as one list. Returned list items are of type Endpoint, which is a common struct embedded inside each endpoint.

type ExplicitProxy

type ExplicitProxy struct {
	// Endpoint configuration.
	Endpoint
	// Proxy configuration (common to transparent and explicit proxies).
	Proxy
	// HTTPProxy : enable HTTP proxy (i.e. proxying of HTTP traffic) and specify
	// on which port+protocol to listen for proxy requests (can be HTTP or HTTPS).
	// Zero port number can be used to disable HTTP proxy.
	HTTPProxy ProxyPort `json:"httpProxy"`
	// HTTPSProxy : enable HTTPS proxy (i.e. proxying of HTTPS traffic) and specify
	// on which port+protocol to listen for proxy requests (can be HTTP or HTTPS).
	// Zero port number can be used to disable HTTPS proxy.
	HTTPSProxy ProxyPort `json:"httpsProxy"`
	// Users : define for username/password authentication, leave empty otherwise.
	Users []UserCredentials `json:"users"`
}

ExplicitProxy : HTTP(S) proxy configured explicitly.

func (ExplicitProxy) ItemCategory

func (e ExplicitProxy) ItemCategory() string

ItemCategory

func (ExplicitProxy) ReferencesFromItem

func (e ExplicitProxy) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type Firewall

type Firewall struct {
	// Rules : firewall rules applied in the order as configured.
	// Applied to traffic going <from> -> <to>:
	//   - network (EVE ports) -> another network
	//   - network (EVE ports) -> endpoint
	//   - network (EVE ports) -> outside of SDN VM (controller, Internet)
	//   - endpoint -> network (EVE ports)
	//   - endpoint -> another endpoint
	//   - endpoint -> outside of SDN VM (controller, Internet)
	// Note that once a connection is allowed, established and related traffic
	// (going in the opposite direction) is automatically allowed as well.
	Rules []FwRule `json:"rules"`
}

Firewall : network firewall. Note that traffic not matched by any rule is allowed!

type FwAction

type FwAction uint8

FwAction : firewall action.

const (
	// FwAllow : allow traffic.
	FwAllow FwAction = iota
	// FwReject : reject traffic.
	// The sender will be informed using an ICMP packet that the destination
	// is blocked/unavailable.
	FwReject
	// FwDrop : drop traffic.
	// Traffic is silently dropped.
	FwDrop
)

func (FwAction) MarshalJSON

func (s FwAction) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*FwAction) UnmarshalJSON

func (s *FwAction) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type FwProto

type FwProto uint8

FwProto : protocol to apply a firewall rule on.

const (
	AnyProto FwProto = iota
	ICMP
	TCP
	UDP
)

func (FwProto) MarshalJSON

func (s FwProto) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*FwProto) UnmarshalJSON

func (s *FwProto) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type FwRule

type FwRule struct {
	// SrcSubnet : subnet to match the source IP address with.
	// Can be empty to disable filtering based on source IP address.
	SrcSubnet string `json:"srcSubnet"`
	// DstSubnet : subnet to match the destination IP address with.
	// Can be empty to disable filtering based on destination IP address.
	DstSubnet string `json:"dstSubnet"`
	// Protocol : filter by protocol.
	Protocol FwProto `json:"protocol"`
	// Ports : list of destination port to which the rule applies.
	// For a non empty list, Protocol must be either TCP or UDP.
	// Empty = any.
	Ports []uint16 `json:"ports"`
	// Action to take.
	Action FwAction `json:"action"`
}

FwRule : a firewall rule.

type HTTPContent

type HTTPContent struct {
	// ContentType : HTTP(S) Content-Type.
	ContentType string `json:"contentType"`
	// Content : content returned inside a HTTP(s) response body.
	// It is a string, so binary content is not possible for now.
	Content string `json:"content"`
}

HTTPContent : content returned by an HTTP(s) handler.

type HTTPServer

type HTTPServer struct {
	// Endpoint configuration.
	Endpoint
	// DNSClientConfig : DNS configuration to be applied for the HTTP server.
	DNSClientConfig
	// HTTPPort : port to listen for HTTP requests.
	// Zero value can be used to disable HTTP.
	HTTPPort uint16 `json:"httpPort"`
	// HTTPSPort : port to listen for HTTPS requests.
	// Zero value can be used to disable HTTPS.
	HTTPSPort uint16 `json:"httpsPort"`
	// CertPEM : Server certificate in the PEM format. Required for HTTPS.
	CertPEM string `json:"certPEM"`
	// KeyPEM : Server key in the PEM format. Required for HTTPS.
	KeyPEM string `json:"keyPEM"`
	// Maps URL Path to a content to be returned inside the HTTP(s) response body.
	Paths map[string]HTTPContent `json:"paths"`
}

HTTPServer : HTTP(s) server.

func (HTTPServer) ItemCategory

func (e HTTPServer) ItemCategory() string

ItemCategory

func (HTTPServer) ReferencesFromItem

func (e HTTPServer) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type HostConfig

type HostConfig struct {
	// HostIPs : list of IP addresses used by the host system (on top of which
	// Eden runs).
	// Eden SDN requires at least one routable host IP address.
	HostIPs []string `json:"hostIPs"`
	// NetworkType specifies which IP versions (IPv4, IPv6, or both) are used by the host.
	//
	// Note: IPv4-to-IPv6 translation (e.g., DNS64/NAT64) is not currently implemented.
	// As a result, IP connectivity between EVE and the controller requires matching
	// IP versions.
	// To ensure connectivity:
	// - The host must use the same IP version as EVE, or
	// - Run in dual-stack mode (supporting both IPv4 and IPv6)
	//
	// If Adam is used as the controller, this can be configured by setting the correct
	// IP version for the Docker bridge network. However, for access to any external
	// endpoints (e.g. upstream DNS servers), it is required that the host itself
	// has working connectivity of the required IP version.
	NetworkType NetworkType `json:"networkType"`
	// ControllerPort : port on which controller listens for device requests.
	ControllerPort uint16 `json:"controllerPort"`
}

HostConfig : host configuration that Eden-SDN needs to be informed about.

type IPRange

type IPRange struct {
	// FromIP : start of the range (includes the address itself).
	FromIP string `json:"fromIP"`
	// ToIP : end of the range (includes the address itself).
	ToIP string `json:"toIP"`
}

IPRange : a range of IP addresses.

type IPRoute

type IPRoute struct {
	// DstNetwork : destination network address in the CIDR format:
	// <IP-address>/<prefix-length>
	DstNetwork string `json:"dstNetwork"`
	// Gateway IP address. It should be from within the EVE port network subnet.
	Gateway string `json:"gateway"`
}

IPRoute : a single IP route entry.

type LabeledItem

type LabeledItem interface {
	// ItemType : name of the item type (e.g. "port", "bond", "bridge", etc.)
	ItemType() string
	// ItemLogicalLabel : logical label of the item.
	ItemLogicalLabel() string
	// ReferencesFromItem : all references to logical labels from inside of the item.
	ReferencesFromItem() []LogicalLabelRef
}

LabeledItem is implemented by anything that has logical label associated with it. These methods helps with the config parsing and validation.

type LabeledItemWithCategory

type LabeledItemWithCategory interface {
	LabeledItem
	// ItemCategory : optional item category (e.g. different kinds of endpoints).
	ItemCategory() string
}

LabeledItemWithCategory : items of the same type can be further separated with categories. Still the pair (type, logicalLabel) remains as the unique item ID.

type LacpRate

type LacpRate uint8

LacpRate specifies the rate in which bond driver will ask LACP link partners to transmit LACPDU packets in 802.3ad mode.

const (
	// LacpRateSlow : Request partner to transmit LACPDUs every 30 seconds.
	// This is the default rate.
	LacpRateSlow LacpRate = iota
	// LacpRateFast : Request partner to transmit LACPDUs every 1 second.
	LacpRateFast
)

func (LacpRate) MarshalJSON

func (s LacpRate) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*LacpRate) UnmarshalJSON

func (s *LacpRate) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type LogicalLabelRef

type LogicalLabelRef struct {
	// ItemType: Type of the referenced item.
	ItemType string
	// ItemCategory : Category of the referenced item. Can be empty.
	ItemCategory string
	// ItemLogicalLabel : LogicalLabel of the referenced item.
	ItemLogicalLabel string
	// RefKey is used to enforce reference exclusivity.
	// There should not be more than one reference towards
	// the same item with the same RefKey.
	RefKey string
}

LogicalLabelRef : reference to an item's logical label.

type MACToIP

type MACToIP struct {
	// MAC address.
	MAC string `json:"mac"`
	// IP address.
	IP string `json:"ip"`
}

MACToIP maps MAC address to IP address.

type NTPServer

type NTPServer struct {
	// Endpoint configuration.
	Endpoint
	// List of (public) NTP servers to synchronize with, each referenced
	// by an IP address or a FQDN.
	UpstreamServers []string `json:"upstreamServers"`
}

NTPServer : NTP server.

func (NTPServer) ItemCategory

func (e NTPServer) ItemCategory() string

ItemCategory

type NetbootArtifact

type NetbootArtifact struct {
	// Filename : name of the file.
	// It will be served by the associated NetbootServer at the endpoint:
	// (http|tftp)://<netboot-server-fqdn>/<Filename>
	Filename string `json:"filename"`
	// DownloadFromURL : HTTP URL from where the artifact will be downloaded
	// by the netboot server. It can for example point to the eserver.
	// Note that Netboot server will forward the artifact content, not redirect
	// to this URL.
	DownloadFromURL string `json:"downloadFromURL"`
	// Entrypoint : Is this the entrypoint for netboot (i.e. the artifact to boot from)?
	// In case of iPXE, this would be enabled for the inital iPXE script.
	// Exactly one NetbootArtifact should be marked as entrypoint inside
	// both lists NetbootServer.TFTPArtifacts and NetbootServer.HTTPArtifacts.
	// If enabled, this file is then announced to netboot clients using DHCP
	// option 67 (59 in DHCPv6).
	Entrypoint bool `json:"entrypoint"`
}

NetbootArtifact - one of the artifacts used to boot EVE OS over a network.

type NetbootServer

type NetbootServer struct {
	// Endpoint configuration.
	Endpoint
	// TFTPArtifacts : boot artifacts served by the TFTP server.
	// If not specified, Eden will automatically put iPXE bootloader
	// as the entrypoint.
	TFTPArtifacts []NetbootArtifact `json:"tftpArtifacts"`
	// HTTPArtifacts : boot artifacts served by the HTTP server.
	// If not specified, Eden will automatically put iPXE artifacts
	// needed to boot EVE OS (as links to eserver where these artifacts
	// are uploaded).
	HTTPArtifacts []NetbootArtifact `json:"httpArtifacts"`
}

NetbootServer provides HTTP and TFTP server endpoints, serving all artifacts needed to boot EVE OS over a network (using iPXE, potentially also supporting older PXE-only clients). Use in combination with DHCP (see DHCP.NetbootServer). XXX Note that in all likelihood, TFTP will serve an iPXE (UEFI) bootloader, that once booted will download and boot EVE artifacts over the HTTP endpoint. This can work with only a little magic in the DHCP server configuration, known as chainloading [1]. If a client only understands netboot/PXE, DHCP will point the client first to the TFTP endpoint. Once the client has booted iPXE, it will be directed by the DHCP server to the iPXE script from the HTTP endpoint (just like any other iPXE-enabled client).

Example config for dnsmasq:

# Boot for iPXE. The idea is to send two different
# filenames, the first loads iPXE, and the second tells iPXE what to
# load. The dhcp-match sets the ipxe tag for requests from iPXE.
#dhcp-boot=undionly.kpxe
#dhcp-match=set:ipxe,175 # iPXE sends a 175 option.
#dhcp-boot=tag:ipxe,http://boot.ipxe.org/demo/boot.php

[1] https://ipxe.org/howto/chainloading

func (NetbootServer) ItemCategory

func (e NetbootServer) ItemCategory() string

ItemCategory

type Network

type Network struct {
	// LogicalLabel : logical name used for reference.
	LogicalLabel string `json:"logicalLabel"`
	// Logical label of a Bridge to which the network is attached.
	Bridge string `json:"bridge"`
	// Leave zero value to express intent of not using VLAN for this network.
	VlanID uint16 `json:"vlanID"`
	// MTU : Maximum transmission unit size set for this network.
	// If not defined (zero value), the default MTU for Ethernet, which is 1500 bytes,
	// will be set.
	MTU uint16 `json:"mtu"`
	// Single-stack network IP (v4 or v6) configuration.
	// Define either this or DualStack.
	NetworkIPConfig
	// Dual-stack network IP configuration.
	// Define either this or the (single-stack) embedded NetworkIPConfig.
	DualStack DualStackNetwork `json:"dualStack"`
	// TransparentProxy : Logical label of a TransparentProxy endpoint, performing
	// proxying of both HTTP and HTTPS traffic transparently.
	// Traffic will flow as follows:
	//   EVE -> Network -> Router -> Firewall -> TransparentProxy -> Router -> Firewall ...
	//    ... -> Endpoint
	//        OR
	//        -> another Network
	//        OR
	//        -> Outside-of-SDN-VM
	TransparentProxy string `json:"transparentProxy,omitempty"`
	// Router configuration. Every network has a separate routing context.
	// Undefined (nil) means that everything should be routed and accessible.
	// That includes all networks, endpoints and the outside of Eden SDN.
	Router *Router `json:"router,omitempty"`
}

Network provides L3 connectivity.

func (Network) HasIPv4Subnet

func (n Network) HasIPv4Subnet() bool

HasIPv4Subnet returns true if the network has IPv4 subnet.

func (Network) HasIPv6Subnet

func (n Network) HasIPv6Subnet() bool

HasIPv6Subnet returns true if the network has IPv6 subnet.

func (Network) IsDualStack

func (n Network) IsDualStack() bool

IsDualStack returns true if Network is configured to operate in dual-stack IP mode.

func (Network) ItemLogicalLabel

func (n Network) ItemLogicalLabel() string

ItemLogicalLabel

func (Network) ItemType

func (n Network) ItemType() string

ItemType

func (Network) ReferencesFromItem

func (n Network) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type NetworkIPConfig

type NetworkIPConfig struct {
	// Subnet : network address + netmask (IPv4 or IPv6).
	Subnet string `json:"subnet"`
	// GwIP should be inside the Subnet.
	GwIP string `json:"gwIP"`
	// DHCP configuration.
	DHCP DHCP `json:"dhcp"`
}

NetworkIPConfig : IP configuration for Network.

type NetworkModel

type NetworkModel struct {
	// Ports : network interfaces connecting EVE VM(s) with Eden-SDN VM.
	// Each port is essentially an interconnected pair of network interfaces, with one side
	// inserted into the EVE VM and the other to Eden-SDN. These interface pairs are created
	// in both VMs in the order as listed here. This means that Ports[0] will appear
	// as the first interface in EVE (likely named "eth0" by the kernel) and likewise
	// as the first interface in Eden-SDN. Note that Eden-SDN will have one more extra
	// interface, added as last and used for management (for eden to talk to SDN mgmt agent).
	Ports []Port `json:"ports"`
	// Bonds are aggregating multiple ports for load-sharing and redundancy purposes.
	Bonds []Bond `json:"bonds"`
	// Bridges provide L2 connectivity.
	Bridges []Bridge `json:"bridges"`
	// Networks provide L3 connectivity.
	Networks []Network `json:"networks"`
	// Endpoints simulate "remote" clients and servers.
	Endpoints Endpoints `json:"endpoints"`
	// Firewall is applied between Networks, Endpoints and the outside of Eden-SDN
	// (controller, Internet).
	Firewall Firewall `json:"firewall"`
	// Host configuration that Eden-SDN is informed about.
	// Eden SDN needs to learn about the host configuration to properly route traffic
	// to the controller and beyond to the Internet.
	// If not defined (nil pointer), Eden will try to detect host config automatically.
	Host *HostConfig `json:"host,omitempty"`
}

NetworkModel is used to declaratively describe the intended state of the networking around EVE VM(s) for the testing purposes. The model is submitted in the JSON format to Eden-SDN Agent, running inside a separate VM, connected to EVE VM(s) via inter-VM network interfaces, and emulating the desired networking using the Linux network stack, network namespaces, netfilter and with the help of several open-source projects, such as dnsmasq, radvd, goproxy, etc.

func (NetworkModel) GetPortByMAC

func (m NetworkModel) GetPortByMAC(mac string) *Port

GetPortByMAC : lookup port by MAC address.

type NetworkType

type NetworkType uint8

NetworkType : type of the network wrt. IP version used.

const (
	// Ipv4Only : host uses IPv4 only.
	Ipv4Only NetworkType = iota
	// Ipv6Only : host uses IPv6 only.
	Ipv6Only
	// DualStack : host runs with dual stack.
	DualStack = 8
)

func (NetworkType) MarshalJSON

func (s NetworkType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*NetworkType) UnmarshalJSON

func (s *NetworkType) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type Port

type Port struct {
	// LogicalLabel : logical name used for reference.
	LogicalLabel string `json:"logicalLabel"`
	// MAC address assigned to the interface on the SDN side.
	// If not specified by the user, Eden will generate a random MAC address.
	MAC string `json:"mac"`
	// AdminUP : whether the interface should be UP on the SDN side.
	// Put down to test link-down scenarios on EVE.
	AdminUP bool `json:"adminUP"`
	// EVEConnect : plug the other side of the port into a given EVE instance.
	EVEConnect EVEConnect `json:"eveConnect"`
	// TC : traffic control.
	TC TrafficControl `json:"trafficControl"`
}

Port is a network interface connecting EVE VM with Eden-SDN VM.

func (Port) ItemLogicalLabel

func (p Port) ItemLogicalLabel() string

ItemLogicalLabel

func (Port) ItemType

func (p Port) ItemType() string

ItemType

func (Port) ReferencesFromItem

func (p Port) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem

type Proxy

type Proxy struct {
	// DNSClientConfig : DNS configuration to be applied for the proxy.
	DNSClientConfig
	// CertPEM : Proxy certificate of the certificate authority in the PEM format.
	// Proxy will use CA cert to sign certificate that it generates for itself.
	// EVE should be configured to trust CA certificate.
	// Not needed if proxy is just forwarding all flows (i.e. not terminating TLS).
	CACertPEM string `json:"caCertPEM"`
	// CAKeyPEM : Proxy key of the certificate authority in the PEM format.
	// Proxy will use CA cert to sign certificate that it generates for itself.
	// EVE should be configured to trust CA certificate.
	// Not needed if proxy is just forwarding all flows (i.e. not terminating TLS).
	CAKeyPEM string `json:"caKeyPEM"`
	// ProxyRules : a set of rules that decides what to do with proxied traffic.
	// By default (no rules defined), proxy will just forward all the flows.
	ProxyRules []ProxyRule `json:"proxyRules"`
}

Proxy can be either transparent or configured explicitly.

type ProxyAction

type ProxyAction uint8

ProxyAction : proxy action.

const (
	// PxForward : just forward proxied traffic.
	PxForward ProxyAction = iota
	// PxReject : reject (block) proxied traffic.
	PxReject
	// PxMITM : act as a man-in-the-middle (split TLS tunnel in two).
	PxMITM
)

func (ProxyAction) MarshalJSON

func (s ProxyAction) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*ProxyAction) UnmarshalJSON

func (s *ProxyAction) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type ProxyListenProto

type ProxyListenProto uint8

ProxyListenProto : protocol used to listen for incoming requests for proxying.

const (
	// ProxyListenProtoUnspecified : protocol is not specified.
	// Used for transparent proxy where the protocol is implicit.
	// With explicit proxy Eden-SDN assumes HTTP as the default.
	ProxyListenProtoUnspecified ProxyListenProto = iota
	// ProxyListenProtoHTTP : proxy listens on HTTP for new proxy requests.
	ProxyListenProtoHTTP
	// ProxyListenProtoHTTPS : proxy listens on HTTPS for new proxy requests.
	ProxyListenProtoHTTPS
)

func (ProxyListenProto) MarshalJSON

func (s ProxyListenProto) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string.

func (*ProxyListenProto) UnmarshalJSON

func (s *ProxyListenProto) UnmarshalJSON(b []byte) error

UnmarshalJSON un-marshals a quoted json string to the enum value.

type ProxyPort

type ProxyPort struct {
	// Port : port number on which the HTTP/HTTPS proxy listens.
	Port uint16 `json:"port"`
	// ListenProto : protocol used to listen for incoming request for proxying
	// (not necessary the protocol which is then being proxied)
	ListenProto ProxyListenProto `json:"listenProto"`
}

ProxyPort : port+protocol used to *listen* for incoming request for proxying. Note that it can differ from protocol that is being proxied.

type ProxyRule

type ProxyRule struct {
	// ReqHost : host from HTTP request header (or from the SNI value in the TLS ClientHello)
	// to match this rule with (e.g. "google.com").
	// Empty ReqHost should be used with the default rule (put one at most).
	ReqHost string `json:"reqHost"`
	// Action to take.
	Action ProxyAction `json:"action"`
}

ProxyRule : rule used by a proxy, which, if matches a given flow, decides what to do with it.

type Router

type Router struct {
	// OutsideReachability : If enabled then it is possible to use the network to access
	// endpoints outside of Eden SDN (unless blocked by firewall).
	// This includes the controller (Adam, zedcloud), eserver (image cache) and the Internet.
	OutsideReachability bool `json:"outsideReachability"`
	// ReachableEndpoints : Logical labels of reachable endpoints.
	ReachableEndpoints []string `json:"reachableEndpoints"`
	// ReachableNetworks : Logical labels of reachable networks.
	ReachableNetworks []string `json:"reachableNetworks"`
	// RoutesTowardsEVE : a set of routes for traffic going towards EVE.
	// This is typically used if one of the apps running on EVE is used as a gateway
	// for other apps. Static routes are then needed on the Eden-SDN side to route
	// returning traffic back via that gw app.
	RoutesTowardsEVE []IPRoute `json:"routesTowardsEVE"`
}

Router routing traffic for a network based on the reachability requirements.

type SDNStatus

type SDNStatus struct {
	// MgmtIPs : IP addresses on which SDN agent is available from the host.
	MgmtIPs []string `json:"mgmtIPs"`
	// ConfigErrors : a set of current configuration errors. Normally this should be empty.
	ConfigErrors []ConfigError `json:"configErrors,omitempty"`
}

SDNStatus : Current status of Eden SDN as reported by the SDN agent.

type TrafficControl

type TrafficControl struct {
	// Delay refers to the duration, measured in milliseconds, by which each packet
	// will be delayed.
	Delay uint32 `json:"delay"`
	// DelayJitter : jitter in milliseconds added to the delay.
	DelayJitter uint32 `json:"delayJitter"`
	// LossProbability : probability of a packet loss (in percent).
	LossProbability uint8 `json:"lossProbability"`
	// CorruptProbability : probability of a packet corruption (in percent).
	CorruptProbability uint8 `json:"corruptProbability"`
	// DuplicateProbability : probability of a packet duplication (in percent).
	DuplicateProbability uint8 `json:"duplicateProbability"`
	// ReorderProbability represents the percentage probability of a packet's order
	// being modified within the queue.
	ReorderProbability uint8 `json:"reorderProbability"`
	// RateLimit represents the maximum speed, measured in kilobytes per second,
	// at which traffic can flow through the port.
	RateLimit uint32 `json:"rateLimit"`
	// QueueLimit : number of kilobytes that can be queued before being sent further.
	// Packets that would exceed the queue size are dropped.
	// Mandatory if RateLimit is set.
	QueueLimit uint32 `json:"queueLimit"`
	// BurstLimit represents the maximum amount of data, measured in kilobytes,
	// that can be sent or received in a short burst or interval, temporarily exceeding
	// the rate limit.
	// Mandatory if RateLimit is set.
	BurstLimit uint32 `json:"burstLimit"`
}

TrafficControl allows to control traffic going through a port. It can be used to emulate slow and faulty networks.

type TransparentProxy

type TransparentProxy struct {
	// Endpoint configuration.
	Endpoint
	// Proxy configuration (common to transparent and explicit proxies).
	Proxy
}

TransparentProxy is a proxy that both HTTP and HTTPS traffic is forwarded through transparently.

func (TransparentProxy) ItemCategory

func (e TransparentProxy) ItemCategory() string

ItemCategory categorizes the item within Endpoints.

func (TransparentProxy) ReferencesFromItem

func (e TransparentProxy) ReferencesFromItem() []LogicalLabelRef

ReferencesFromItem lists references to private DNS servers (if there are any).

type UserCredentials

type UserCredentials struct {
	// Username
	Username string `json:"username"`
	// Password
	Password string `json:"password"`
}

UserCredentials : User credentials for an explicit proxy.

Jump to

Keyboard shortcuts

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