utils

package
v2.3.20181123+incompat... Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func F

func F(table, priority int, matches, actions string) *ovs.Flow

func OVSFlowEqual

func OVSFlowEqual(of0, of1 *ovs.Flow) bool

func OVSFlowOrderMatch

func OVSFlowOrderMatch(of *ovs.Flow)

func PortRangeToMasks

func PortRangeToMasks(s, e uint16) [][2]uint16

Types

type FlowSet

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

func NewFlowSet

func NewFlowSet() *FlowSet

func NewFlowSetFromList

func NewFlowSetFromList(flows []*ovs.Flow) *FlowSet

func (*FlowSet) Add

func (fs *FlowSet) Add(f *ovs.Flow) bool

func (*FlowSet) Contains

func (fs *FlowSet) Contains(f *ovs.Flow) bool

func (*FlowSet) Diff

func (fs0 *FlowSet) Diff(fs1 *FlowSet) (flowsAdd, flowsDel []*ovs.Flow)

Diff return dels,adds that are needed to make the current set has the same elements as with fs1

func (*FlowSet) Flows

func (fs *FlowSet) Flows() []*ovs.Flow

func (*FlowSet) Remove

func (fs *FlowSet) Remove(f *ovs.Flow) bool

type FlowSource

type FlowSource interface {
	Who() string
	FlowsMap() (map[string][]*ovs.Flow, error)
}

type Guest

type Guest struct {
	Id         string
	Path       string
	HostConfig *HostConfig

	Name          string
	SecurityRules *SecurityRules
	NICs          []*GuestNIC
}

func (*Guest) FlowsMap

func (g *Guest) FlowsMap() (map[string][]*ovs.Flow, error)

func (*Guest) IsVM

func (g *Guest) IsVM() bool

func (*Guest) LoadDesc

func (g *Guest) LoadDesc() error

func (*Guest) Running

func (g *Guest) Running() bool

func (*Guest) Who

func (g *Guest) Who() string

type GuestNIC

type GuestNIC struct {
	Bridge     string
	Bw         int
	Dns        string
	Domain     string
	Driver     string
	Gateway    string
	IfnameHost string `json:"ifname"`
	Index      int
	IfnameVM   string `json:"interface"`
	IP         string `json:"ip"`
	MAC        string
	Masklen    int
	Net        string
	NetId      string `json:"net_id"`
	Virtual    bool
	VLAN       int
	WireId     string `json:"wire_id"`

	CtZoneId    uint16 `json:"-"`
	CtZoneIdSet bool   `json:"-"`
	PortNo      int    `json:"-"`
}

func (*GuestNIC) Map

func (n *GuestNIC) Map() map[string]interface{}

func (*GuestNIC) TcData

func (n *GuestNIC) TcData() *TcData

type HostConfig

type HostConfig struct {
	Port           int
	ListenIfname   string
	Networks       []*HostConfigNetwork
	ServersPath    string
	K8sClusterCidr *net.IPNet
	AllowSwitchVMs bool // allow virtual machines act as switches
}

func NewHostConfig

func NewHostConfig(file string) (*HostConfig, error)

func (*HostConfig) HostNetworkConfig

func (hc *HostConfig) HostNetworkConfig(bridge string) *HostConfigNetwork

func (*HostConfig) MasterIPMAC

func (hc *HostConfig) MasterIPMAC() (net.IP, net.HardwareAddr, error)

type HostConfigNetwork

type HostConfigNetwork struct {
	Bridge string
	Ifname string
	IP     net.IP
	// contains filtered or unexported fields
}

func NewHostConfigNetwork

func NewHostConfigNetwork(network string) (*HostConfigNetwork, error)

func (*HostConfigNetwork) IPMAC

func (hcn *HostConfigNetwork) IPMAC() (net.IP, net.HardwareAddr, error)

type HostLocal

type HostLocal struct {
	HostConfig *HostConfig
	Bridge     string
	Ifname     string
	IP         net.IP
	MAC        net.HardwareAddr
	MasterIP   net.IP
	MasterMAC  net.HardwareAddr
}

func (*HostLocal) FlowsMap

func (h *HostLocal) FlowsMap() (map[string][]*ovs.Flow, error)

func (*HostLocal) Who

func (h *HostLocal) Who() string

type SecurityRule

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

func NewSecurityRule

func NewSecurityRule(s string) (*SecurityRule, error)

func (*SecurityRule) Direction

func (*SecurityRule) IsWildMatch

func (sr *SecurityRule) IsWildMatch() bool

func (*SecurityRule) OvsActionAllow

func (sr *SecurityRule) OvsActionAllow() bool

func (*SecurityRule) OvsMatches

func (sr *SecurityRule) OvsMatches() []string

type SecurityRules

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

TODO squash neighbouring rules of the same direction

func NewSecurityRules

func NewSecurityRules(s string) (*SecurityRules, error)

func (*SecurityRules) Flows

func (sr *SecurityRules) Flows(data map[string]interface{}) []*ovs.Flow

func (*SecurityRules) InRulesString

func (sr *SecurityRules) InRulesString() string

func (*SecurityRules) OutRulesString

func (sr *SecurityRules) OutRulesString() string

type TcData

type TcData struct {
	Type        TcDataType
	Ifname      string
	IngressMbps uint64
	EgressMbps  uint64
}

func (*TcData) QdiscTree

func (td *TcData) QdiscTree() (qt *tc.QdiscTree, err error)

func (*TcData) String

func (td *TcData) String() string

type TcDataType

type TcDataType string
const (
	TC_DATA_TYPE_HOSTLOCAL TcDataType = "hostlocal"
	TC_DATA_TYPE_GUEST     TcDataType = "guest"
)

type ZoneMan

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

func NewZoneMan

func NewZoneMan(base uint16) *ZoneMan

func (*ZoneMan) AllocateZoneId

func (zm *ZoneMan) AllocateZoneId(mac string) (uint16, error)

func (*ZoneMan) FreeZoneId

func (zm *ZoneMan) FreeZoneId(mac string) bool

Jump to

Keyboard shortcuts

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