datapath

package
v0.0.0-...-e1628ab Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLSBRIDGE_LEARNING_TABLE_ID   = 0
	CLSBRIDGE_FORWARDING_TABLE_ID = 2
	CLSBRIDGE_OUTPUT_TABLE_ID     = 3
)

nolint

View Source
const (
	VLAN_INPUT_TABLE                   = 0
	VLAN_FILTER_TABLE                  = 1
	L2_FORWARDING_TABLE                = 5
	L2_LEARNING_TABLE                  = 10
	FROM_LOCAL_REDIRECT_TABLE          = 15
	FROM_LOCAL_ARP_PASS_TABLE          = 20
	FROM_LOCAL_ARP_TO_CONTROLLER_TABLE = 25
	CNI_CT_COMMIT_TABLE                = 100
	CNI_CT_REDIRECT_TABLE              = 105
	FACK_MAC                           = "ee:ee:ee:ee:ee:ee"
	P_NONE                             = 0xffff

	InternalSvcPktMark uint32 = 1 << constants.InternalSvcPktMarkBit
)
View Source
const (
	HIGH_MATCH_FLOW_PRIORITY            = 300
	MID_MATCH_FLOW_PRIORITY             = 200
	NORMAL_MATCH_FLOW_PRIORITY          = 100
	DEFAULT_DROP_FLOW_PRIORITY          = 70
	GLOBAL_DEFAULT_POLICY_FLOW_PRIORITY = 40
	DEFAULT_FLOW_MISS_PRIORITY          = 10
	FLOW_MATCH_OFFSET                   = 3
)
View Source
const (
	POLICY_TIER1    = 50
	POLICY_TIER2    = 100
	POLICY_TIER_ECP = 130
	POLICY_TIER3    = 150
)
View Source
const (
	POLICY_DIRECTION_OUT = 0
	POLICY_DIRECTION_IN  = 1
)
View Source
const (
	IP_BROADCAST_ADDR = "255.255.255.255"
	LOOP_BACK_ADDR    = "127.0.0.1"
)
View Source
const (
	FLOW_ROUND_NUM_LENGTH           = 4
	FLOW_SEQ_NUM_LENGTH             = 28
	FLOW_ROUND_NUM_MASK             = 0xf0000000
	FLOW_SEQ_NUM_MASK               = 0x0fffffff
	DEFAULT_POLICY_ENFORCEMENT_MODE = "work"
)
View Source
const (
	PROTOCOL_ARP  = 0x0806
	PROTOCOL_IP   = 0x0800
	PROTOCOL_UDP  = 0x11
	PROTOCOL_TCP  = 0x06
	PROTOCOL_ICMP = 0x01
)
View Source
const (
	LOCAL_BRIDGE_KEYWORD  = "local"
	POLICY_BRIDGE_KEYWORD = "policy"
	CLS_BRIDGE_KEYWORD    = "cls"
	UPLINK_BRIDGE_KEYWORD = "uplink"
	NAT_BRIDGE_KEYWORD    = "nat"
)
View Source
const (
	IPAddressTimeout                        = 60
	IPAddressCacheUpdateInterval            = 5
	LocalBridgeL2ForwardingTableHardTimeout = 300
	LocalBridgeL2ForwardingTableIdleTimeout = 300
	ClsBridgeL2ForwardingTableHardTimeout   = 300
	ClsBridgeL2ForwardingTableIdleTimeout   = 300
	MaxIPAddressLearningFrenquency          = 5

	LocalToPolicySuffix = "local-to-policy"
	PolicyToLocalSuffix = "policy-to-local"
	PolicyToClsSuffix   = "policy-to-cls"
	ClsToPolicySuffix   = "cls-to-policy"
	ClsToUplinkSuffix   = "cls-to-uplink"
	UplinkToClsSuffix   = "uplink-to-cls"
	LocalToNatSuffix    = "local-to-nat"
	NatToLocalSuffix    = "nat-to-local"
	NatToUplinkSuffix   = "nat-to-uplink"
	UplinkToNatSuffix   = "uplink-to-nat"

	InternalIngressRulePrefix = "/INTERNAL_INGRESS_POLICY/internal/ingress/-"
	InternalEgressRulePrefix  = "/INTERNAL_EGRESS_POLICY/internal/egress/-"

	MaxRoundNum = 15

	MaxArpChanCache = 100

	MaxCleanConntrackChanSize = 5000
)
View Source
const (
	PortMaskMatchFullBit uint16 = 65535

	FTPPort  uint16 = 21
	TFTPPort uint16 = 69
)
View Source
const (
	EveroutePolicyAllow string = "allow"
	EveroutePolicyDeny  string = "deny"
)
View Source
const (
	INPUT_TABLE                 = 0
	CT_STATE_TABLE              = 1
	DIRECTION_SELECTION_TABLE   = 10
	EGRESS_TIER1_TABLE          = 20
	EGRESS_TIER2_MONITOR_TABLE  = 24
	EGRESS_TIER2_TABLE          = 25
	EGRESS_TIER_ECP_TABLE       = 28
	EGRESS_TIER3_MONITOR_TABLE  = 29
	EGRESS_TIER3_TABLE          = 30
	INGRESS_TIER1_TABLE         = 50
	INGRESS_TIER2_MONITOR_TABLE = 54
	INGRESS_TIER2_TABLE         = 55
	INGRESS_TIER_ECP_TABLE      = 58
	INGRESS_TIER3_MONITOR_TABLE = 59
	INGRESS_TIER3_TABLE         = 60
	CT_COMMIT_TABLE             = 70
	CT_DROP_TABLE               = 71
	SFC_POLICY_TABLE            = 80
	POLICY_FORWARDING_TABLE     = 90

	RoundNumXXREG0BitStart              = 0 // codepoint0 bit start
	RoundNumXXREG0BitEnd                = 3 // codepoint0 bit end
	RoundNumXXREG0BitSize               = RoundNumXXREG0BitEnd - RoundNumXXREG0BitStart + 1
	MonitorTier2FlowSpaceXXREG0BitStart = 4  // codepoint1 bit start
	MonitorTier2FlowSpaceXXREG0BitEnd   = 31 // codepoint1 bit end
	MonitorTier3FlowSpaceXXREG0BitStart = 32 // codepoint2 bit start
	MonitorTier3FlowSpaceXXREG0BitEnd   = 59 // codepoint2 bit end
	MonitorTier3FlowSpaceXXREG0BitSize  = MonitorTier3FlowSpaceXXREG0BitEnd - MonitorTier3FlowSpaceXXREG0BitStart + 1
	WorkPolicyActionXXREG0Bit           = 127 // codepoint6
	MonitorTier3PolicyActionXXREG0Bit   = 126 // codepoint5
)

//nolint

View Source
const (
	SetupBridgeChain = `` /* 1772-byte string literal not displayed */

	CleanBridgeChain = `` /* 287-byte string literal not displayed */

	SetupCNIBridgeChain = `` /* 392-byte string literal not displayed */

	SetupProxyBridgeChain = `` /* 680-byte string literal not displayed */

	SetupTunnelBridgeChain = `` /* 298-byte string literal not displayed */

	CleanProxyBridgeChain = `
		NAT_BRIDGE="%s-nat"
		ovs-vsctl -- del-br ${NAT_BRIDGE}
	`
)
View Source
const (
	BROADCAST_MAC_ADDRESS_MASK = "01:00:00:00:00:00"
)

nolint

View Source
const InvalidGroupID uint32 = 0
View Source
const (
	SelectGroupWeight = 100
)

Variables

View Source
var (
	VlanFlagMask           uint16 = 0x1000
	InternalSvcPktMarkMask uint32 = 1 << constants.InternalSvcPktMarkBit

	InternalSvcPktMarkRange *openflow13.NXRange = openflow13.NewNXRange(constants.InternalSvcPktMarkBit, constants.InternalSvcPktMarkBit)
)
View Source
var (
	LBOArpProxyTable       uint8 = 10
	LBOInPortTable         uint8 = 30
	LBOFromNatTable        uint8 = 40
	LBOFromPolicyTable     uint8 = 50
	LBOFromLocalTable      uint8 = 60
	LBOForwardToLocalTable uint8 = 80
	LBOPaddingL2Table      uint8 = 90
	LBOOutputTable         uint8 = 110
)
View Source
var (
	LBOOutputPortReg                     = "nxm_nx_reg2"
	LBOOutputPortStart                   = 0
	LBOOutputPortRange *openflow.NXRange = openflow.NewNXRange(LBOOutputPortStart, 15)

	IcmpTypeRange *openflow.NXRange = openflow.NewNXRange(0, 7)
)
View Source
var (
	EtherTypeLength uint16 = 16
	ProtocolLength  uint16 = 8
	MacLength       uint16 = 48
	IPv4Lenth       uint16 = 32
	PortLength      uint16 = 16

	ArpOperRequest uint16 = 1
	ArpOperReply   uint64 = 2

	IcmpTypeRequest uint8 = 8
	IcmpTypeReply   uint8
)
View Source
var (
	NatBrInputTable                uint8 = 0
	NatBrInPortTable               uint8 = 4
	NatBrCTZoneTable               uint8 = 5
	NatBrCTStateTable              uint8 = 10
	NatBrSessionAffinityTable      uint8 = 30
	NatBrServiceLBTable            uint8 = 35
	NatBrExternalSvcLBTable        uint8 = 36
	NatBrSessionAffinityLearnTable uint8 = 40
	NatBrDnatTable                 uint8 = 50
	NatBrL3ForwardTable            uint8 = 90
	NatBrOutputTable               uint8 = 100
)
View Source
var (
	CTZoneReg                       = "nxm_nx_reg0"
	CTZoneRange *openflow13.NXRange = openflow13.NewNXRange(0, 15)

	ChooseBackendFlagReg   string              = "nxm_nx_reg0"
	ChooseBackendFlagRange *openflow13.NXRange = openflow13.NewNXRange(16, 16)
	ChooseBackendFlagStart int                 = 16
	NeedChoose             uint8               = 0
	NoNeedChoose           uint8               = 1

	BackendIPReg         string              = "nxm_nx_reg1"
	BackendIPRegNumber   int                 = 1
	BackendIPRange       *openflow13.NXRange = openflow13.NewNXRange(0, 31)
	BackendPortReg       string              = "nxm_nx_reg2"
	BackendPortRegNumber int                 = 2
	BackendPortRange     *openflow13.NXRange = openflow13.NewNXRange(0, 15)

	ChooseBackendFlagLength uint16 = 1
)
View Source
var (
	WorkPolicyActionDenyMatchCTLabel             = [16]byte{0x80} // 1 << WorkPolicyActionXXREG0Bit
	WorkPolicyActionDenyMatchCTLabelMask         = [16]byte{0x80} // 1 << WorkPolicyActionXXREG0Bit
	MonitorTier3PolicyActionDenyMatchCTLabel     = [16]byte{0x40} // 1 << MonitorTier3PolicyActionXXREG0Bit
	MonitorTier3PolicyActionDenyMatchCTLabelMask = [16]byte{0x40} // 1 << MonitorTier3PolicyActionXXREG0Bit

	RoundNumNXRange                 = openflow13.NewNXRange(RoundNumXXREG0BitStart, RoundNumXXREG0BitEnd)
	MonitorTier2FlowSpaceNXRange    = openflow13.NewNXRange(MonitorTier2FlowSpaceXXREG0BitStart, MonitorTier2FlowSpaceXXREG0BitEnd)
	MonitorTier3FlowSpaceNXRange    = openflow13.NewNXRange(MonitorTier3FlowSpaceXXREG0BitStart, MonitorTier3FlowSpaceXXREG0BitEnd)
	WorkPolicyActionNXRange         = openflow13.NewNXRange(WorkPolicyActionXXREG0Bit, WorkPolicyActionXXREG0Bit)
	MonitorTier3PolicyActionNXRange = openflow13.NewNXRange(MonitorTier3PolicyActionXXREG0Bit, MonitorTier3PolicyActionXXREG0Bit)
)
View Source
var (
	UBOArpProxyTable         uint8 = 10
	UBOSvcForwardTable       uint8 = 15
	UBOSvcMatchTable         uint8 = 20
	UBOResetSvcMarkTable     uint8 = 24
	UBOSvcSnatTable          uint8 = 25
	UBOForwardToLocalTable   uint8 = 30
	UBOForwardToGwTable      uint8 = 40
	UBOForwardToTunnelTable  uint8 = 35
	UBOSetRemoteIPTable      uint8 = 70
	UBOSetTunnelOutPortTable uint8 = 75
	UBOSetSvcMarkTable       uint8 = 90
	UBOPaddingL2Table        uint8 = 100
	UBOOutputTable           uint8 = 110
)
View Source
var (
	UBOOutputPortReg                     = "nxm_nx_reg2"
	UBOOutputPortStart                   = 0
	UBOOutputPortRange *openflow.NXRange = openflow.NewNXRange(UBOOutputPortStart, 15)

	TunnelDstReg = "nxm_nx_tun_ipv4_dst"
)
View Source
var IPMaskMatchFullBit = net.ParseIP("255.255.255.255")

Functions

func DeepCopyMap

func DeepCopyMap(theMap interface{}) interface{}

func ExcuteCommand

func ExcuteCommand(cmdStr, arg string) error

func InitializeVDS

func InitializeVDS(datapathManager *DpManager, vdsID string, ovsbrName string, stopChan <-chan struct{})

func NewVDSForConfig

func NewVDSForConfig(datapathManager *DpManager, vdsID, ovsbrname string)

func NewVDSForConfigBase

func NewVDSForConfigBase(datapathManager *DpManager, vdsID, ovsbrname string)

func NewVDSForConfigProxy

func NewVDSForConfigProxy(datapathManager *DpManager, vdsID, ovsbrname string)

func ParseIPAddrMaskString

func ParseIPAddrMaskString(ipAddr string) (*net.IP, *net.IP, error)

ParseIPAddrMaskString Parse IP addr string

func ParseMacToUint64

func ParseMacToUint64(b []byte) uint64

func RuleIsSame

func RuleIsSame(r1, r2 *EveroutePolicyRule) bool

func SetPortNoFlood

func SetPortNoFlood(bridge string, ofport int) error

Types

type ArpInfo

type ArpInfo struct {
	InPort uint32
	Pkt    protocol.ARP
	BrName string
}

type BaseBridge

type BaseBridge struct {
	OfSwitch *ofctrl.OFSwitch
	// contains filtered or unexported fields
}

func (*BaseBridge) AddIPPoolGW

func (b *BaseBridge) AddIPPoolGW(string) error

func (*BaseBridge) AddIPPoolSubnet

func (b *BaseBridge) AddIPPoolSubnet(string) error

func (*BaseBridge) AddLocalEndpoint

func (b *BaseBridge) AddLocalEndpoint(*Endpoint) error

func (*BaseBridge) AddMicroSegmentRule

func (b *BaseBridge) AddMicroSegmentRule(*EveroutePolicyRule, uint8, uint8, string) (*FlowEntry, error)

func (*BaseBridge) AddSFCRule

func (b *BaseBridge) AddSFCRule() error

func (*BaseBridge) AddVNFInstance

func (b *BaseBridge) AddVNFInstance() error

func (*BaseBridge) BridgeInit

func (b *BaseBridge) BridgeInit()

func (*BaseBridge) BridgeReset

func (b *BaseBridge) BridgeReset()

func (*BaseBridge) DelIPPoolGW

func (b *BaseBridge) DelIPPoolGW(string) error

func (*BaseBridge) DelIPPoolSubnet

func (b *BaseBridge) DelIPPoolSubnet(string) error

func (*BaseBridge) GetName

func (b *BaseBridge) GetName() string

func (*BaseBridge) IsSwitchConnected

func (b *BaseBridge) IsSwitchConnected() bool

func (*BaseBridge) MultipartReply

func (b *BaseBridge) MultipartReply(*ofctrl.OFSwitch, *openflow13.MultipartReply)

Controller received a multi-part reply from the switch

func (*BaseBridge) PacketRcvd

func (b *BaseBridge) PacketRcvd(*ofctrl.OFSwitch, *ofctrl.PacketIn)

Controller received a packet from the switch

func (*BaseBridge) RemoveLocalEndpoint

func (b *BaseBridge) RemoveLocalEndpoint(*Endpoint) error

func (*BaseBridge) RemoveMicroSegmentRule

func (b *BaseBridge) RemoveMicroSegmentRule(*EveroutePolicyRule) error

func (*BaseBridge) RemoveSFCRule

func (b *BaseBridge) RemoveSFCRule() error

func (*BaseBridge) RemoveVNFInstance

func (b *BaseBridge) RemoveVNFInstance() error

func (*BaseBridge) SwitchConnected

func (b *BaseBridge) SwitchConnected(sw *ofctrl.OFSwitch)

func (*BaseBridge) SwitchDisconnected

func (b *BaseBridge) SwitchDisconnected(sw *ofctrl.OFSwitch)

func (*BaseBridge) WaitForSwitchConnection

func (b *BaseBridge) WaitForSwitchConnection()

type Bridge

type Bridge interface {
	BridgeInit()
	BridgeReset()

	BridgeInitCNI()

	AddLocalEndpoint(endpoint *Endpoint) error
	RemoveLocalEndpoint(endpoint *Endpoint) error
	AddVNFInstance() error
	RemoveVNFInstance() error

	AddSFCRule() error
	RemoveSFCRule() error
	AddMicroSegmentRule(rule *EveroutePolicyRule, direction uint8, tier uint8, mode string) (*FlowEntry, error)
	RemoveMicroSegmentRule(rule *EveroutePolicyRule) error

	IsSwitchConnected() bool

	// of control app interface
	// A Switch connected to the controller
	SwitchConnected(sw *ofctrl.OFSwitch)

	// Switch disconnected from the controller
	SwitchDisconnected(sw *ofctrl.OFSwitch)

	// Controller received a packet from the switch
	PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

	// Controller received a multi-part reply from the switch
	MultipartReply(sw *ofctrl.OFSwitch, rep *openflow13.MultipartReply)

	// Everoute IPAM
	AddIPPoolSubnet(string) error
	DelIPPoolSubnet(string) error
	AddIPPoolGW(string) error
	DelIPPoolGW(string) error

	GetName() string
	// contains filtered or unexported methods
}

func NewClsBridge

func NewClsBridge(brName string, datapathManager *DpManager) Bridge

func NewLocalBridge

func NewLocalBridge(brName string, datapathManager *DpManager) Bridge

func NewUplinkBridge

func NewUplinkBridge(brName string, datapathManager *DpManager) Bridge

type ClsBridge

type ClsBridge struct {
	BaseBridge
	// contains filtered or unexported fields
}

func (*ClsBridge) AddLocalEndpoint

func (c *ClsBridge) AddLocalEndpoint(endpoint *Endpoint) error

func (*ClsBridge) AddMicroSegmentRule

func (c *ClsBridge) AddMicroSegmentRule(rule *EveroutePolicyRule, direction uint8, tier uint8, mode string) (*FlowEntry, error)

func (*ClsBridge) AddSFCRule

func (c *ClsBridge) AddSFCRule() error

func (*ClsBridge) AddVNFInstance

func (c *ClsBridge) AddVNFInstance() error

func (*ClsBridge) BridgeInit

func (c *ClsBridge) BridgeInit()

func (*ClsBridge) BridgeInitCNI

func (c *ClsBridge) BridgeInitCNI()

func (*ClsBridge) BridgeReset

func (c *ClsBridge) BridgeReset()

func (*ClsBridge) InitVlanMacLearningAction

func (c *ClsBridge) InitVlanMacLearningAction(learnAction *ofctrl.LearnAction, learnedDstField string, learnedDstFieldBit uint16, learnedSrcValue uint16) error

func (*ClsBridge) MultipartReply

func (c *ClsBridge) MultipartReply(sw *ofctrl.OFSwitch, rep *openflow13.MultipartReply)

func (*ClsBridge) PacketRcvd

func (c *ClsBridge) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

func (*ClsBridge) RemoveLocalEndpoint

func (c *ClsBridge) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*ClsBridge) RemoveMicroSegmentRule

func (c *ClsBridge) RemoveMicroSegmentRule(rule *EveroutePolicyRule) error

func (*ClsBridge) RemoveSFCRule

func (c *ClsBridge) RemoveSFCRule() error

func (*ClsBridge) RemoveVNFInstance

func (c *ClsBridge) RemoveVNFInstance() error

type ClsBridgeOverlay

type ClsBridgeOverlay struct {
	BaseBridge
}

func (*ClsBridgeOverlay) BridgeInitCNI

func (c *ClsBridgeOverlay) BridgeInitCNI()

type DpManager

type DpManager struct {
	DpManagerMutex     sync.Mutex
	BridgeChainMap     map[string]map[string]Bridge                 // map vds to bridge instance map
	OvsdbDriverMap     map[string]map[string]*ovsdbDriver.OvsDriver // map vds to bridge ovsdbDriver map
	ControllerMap      map[string]map[string]*ofctrl.Controller
	BridgeChainPortMap map[string]map[string]uint32 // map vds to patch port to ofport-num map

	Config        *DpManagerConfig
	Info          *DpManagerInfo
	Rules         map[string]*EveroutePolicyRuleEntry // rules database
	FlowIDToRules map[uint64]*EveroutePolicyRuleEntry

	ArpChan chan ArpInfo
	// contains filtered or unexported fields
}

func InitCNIDpMgrUT

func InitCNIDpMgrUT(stopCh <-chan struct{}, brName string, enableProxy bool, enableOverlay bool, enableIPAM bool) (*DpManager, error)

func NewDatapathManager

func NewDatapathManager(datapathConfig *DpManagerConfig, ofPortIPAddressUpdateChan chan *types.EndpointIP) *DpManager

Datapath manager act as openflow controller: 1. event driven local endpoint info crud and related flow update, 2. collect local endpoint ip learned from different ovsbr(1 per vds), and sync it to management plane

func (*DpManager) AddEveroutePolicyRule

func (datapathManager *DpManager) AddEveroutePolicyRule(rule *EveroutePolicyRule, ruleName string, direction uint8, tier uint8, mode string) error

func (*DpManager) AddIPPoolGW

func (datapathManager *DpManager) AddIPPoolGW(gw string) error

func (*DpManager) AddIPPoolSubnet

func (datapathManager *DpManager) AddIPPoolSubnet(subnet string) error

func (*DpManager) AddLocalEndpoint

func (datapathManager *DpManager) AddLocalEndpoint(endpoint *Endpoint) error

func (*DpManager) DelIPPoolGW

func (datapathManager *DpManager) DelIPPoolGW(gw string) error

func (*DpManager) DelIPPoolSubnet

func (datapathManager *DpManager) DelIPPoolSubnet(subnet string) error

func (*DpManager) GetAllRules

func (datapathManager *DpManager) GetAllRules() []*v1alpha1.RuleEntry

func (*DpManager) GetChainBridge

func (datapathManager *DpManager) GetChainBridge() []string

func (*DpManager) GetNatBridges

func (datapathManager *DpManager) GetNatBridges() []*NatBridge

func (*DpManager) GetPolicyByFlowID

func (datapathManager *DpManager) GetPolicyByFlowID(flowID ...uint64) []*PolicyInfo

func (*DpManager) GetRulesByFlowIDs

func (datapathManager *DpManager) GetRulesByFlowIDs(flowIDs ...uint64) []*v1alpha1.RuleEntry

func (*DpManager) GetRulesByRuleIDs

func (datapathManager *DpManager) GetRulesByRuleIDs(ruleIDs ...string) []*v1alpha1.RuleEntry

func (*DpManager) GetUplinkBridgeOverlay

func (datapathManager *DpManager) GetUplinkBridgeOverlay() *UplinkBridgeOverlay

func (*DpManager) HandleEndpointIPTimeout

func (datapathManager *DpManager) HandleEndpointIPTimeout(_ context.Context, endpointIP *types.EndpointIP) error

func (*DpManager) InitializeCNI

func (datapathManager *DpManager) InitializeCNI()

func (*DpManager) InitializeDatapath

func (datapathManager *DpManager) InitializeDatapath(stopChan <-chan struct{})

func (*DpManager) IsBridgesConnected

func (datapathManager *DpManager) IsBridgesConnected() bool

func (*DpManager) IsEnableCNI

func (datapathManager *DpManager) IsEnableCNI() bool

func (*DpManager) IsEnableKubeProxyReplace

func (datapathManager *DpManager) IsEnableKubeProxyReplace() bool

func (*DpManager) IsEnableOverlay

func (datapathManager *DpManager) IsEnableOverlay() bool

func (*DpManager) IsEnableProxy

func (datapathManager *DpManager) IsEnableProxy() bool

func (*DpManager) RemoveEveroutePolicyRule

func (datapathManager *DpManager) RemoveEveroutePolicyRule(ruleID string, ruleName string) error

func (*DpManager) RemoveLocalEndpoint

func (datapathManager *DpManager) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*DpManager) ReplayEverouteIPAMFlow

func (datapathManager *DpManager) ReplayEverouteIPAMFlow(vdsID string, brKey string) error

func (*DpManager) ReplayVDSLocalEndpointFlow

func (datapathManager *DpManager) ReplayVDSLocalEndpointFlow(vdsID string, keyWord string) error

func (*DpManager) ReplayVDSMicroSegmentFlow

func (datapathManager *DpManager) ReplayVDSMicroSegmentFlow(vdsID string) error

func (*DpManager) SetOverlaySyncFunc

func (datapathManager *DpManager) SetOverlaySyncFunc(f func())

func (*DpManager) SetProxySyncFunc

func (datapathManager *DpManager) SetProxySyncFunc(f func())

func (*DpManager) UpdateLocalEndpoint

func (datapathManager *DpManager) UpdateLocalEndpoint(newEndpoint, oldEndpoint *Endpoint) error

func (*DpManager) UseEverouteIPAM

func (datapathManager *DpManager) UseEverouteIPAM() bool

func (*DpManager) WaitForBridgeConnected

func (datapathManager *DpManager) WaitForBridgeConnected()

type DpManagerCNIConfig

type DpManagerCNIConfig struct {
	EnableProxy      bool // enable proxy
	EncapMode        string
	MTU              int // pod mtu
	IPAMType         string
	KubeProxyReplace bool
	SvcInternalIP    net.IP // kube-proxy replace need it
}

type DpManagerConfig

type DpManagerConfig struct {
	ManagedVDSMap    map[string]string   // map vds to ovsbr-name
	InternalIPs      []string            // internal IPs
	EnableIPLearning bool                // enable ip learning
	EnableCNI        bool                // enable CNI in Everoute
	CNIConfig        *DpManagerCNIConfig // config related CNI
}

type DpManagerInfo

type DpManagerInfo struct {
	NodeName   string
	PodCIDR    []cnitypes.IPNet
	BridgeName string

	ClusterCIDR    *cnitypes.IPNet
	ClusterPodCIDR *net.IPNet
	ClusterPodGw   *net.IP

	LocalGwName   string
	LocalGwIP     net.IP
	LocalGwMac    net.HardwareAddr
	LocalGwOfPort uint32

	GatewayName   string
	GatewayIP     net.IP
	GatewayMask   net.IPMask
	GatewayMac    net.HardwareAddr
	GatewayOfPort uint32

	TunnelOfPort uint32

	Namespace string
}

type Endpoint

type Endpoint struct {
	InterfaceUUID        string
	InterfaceName        string // interface name that endpoint attached to
	IPAddr               net.IP
	IPAddrMutex          sync.RWMutex
	IPAddrLastUpdateTime time.Time
	IPv6Addr             net.IP
	PortNo               uint32 // endpoint of port
	MacAddrStr           string
	VlanID               uint16 // endpoint vlan id
	Trunk                string // vlan trunk config
	BridgeName           string // bridge name that endpoint attached to
}

type EveroutePolicyRule

type EveroutePolicyRule struct {
	RuleID      string // Unique identifier for the rule
	Priority    int    // Priority for the rule (1..100. 100 is highest)
	SrcIPAddr   string // source IP addrss and mask
	DstIPAddr   string // Destination IP address and mask
	IPProtocol  uint8  // IP protocol number
	SrcPort     uint16 // Source port
	SrcPortMask uint16
	DstPort     uint16 // destination port
	DstPortMask uint16
	Action      string // rule action: 'allow' or 'deny'
}

func (EveroutePolicyRule) MatchConntrackFlow

func (rule EveroutePolicyRule) MatchConntrackFlow(flow *netlink.ConntrackFlow) bool

type EveroutePolicyRuleEntry

type EveroutePolicyRuleEntry struct {
	EveroutePolicyRule  *EveroutePolicyRule
	Direction           uint8
	Tier                uint8
	Mode                string
	RuleFlowMap         map[string]*FlowEntry
	PolicyRuleReference sets.String
}

type EveroutePolicyRuleList

type EveroutePolicyRuleList []EveroutePolicyRule

func (EveroutePolicyRuleList) MatchConntrackFlow

func (list EveroutePolicyRuleList) MatchConntrackFlow(flow *netlink.ConntrackFlow) bool

type FlowEntry

type FlowEntry struct {
	Table    *ofctrl.Table
	Priority uint16
	FlowID   uint64
}

type IPAddressReference

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

type LocalBridge

type LocalBridge struct {
	BaseBridge
	// contains filtered or unexported fields
}

func (*LocalBridge) AddLocalEndpoint

func (l *LocalBridge) AddLocalEndpoint(endpoint *Endpoint) error

func (*LocalBridge) AddMicroSegmentRule

func (l *LocalBridge) AddMicroSegmentRule(rule *EveroutePolicyRule, direction uint8, tier uint8, mode string) (*FlowEntry, error)

func (*LocalBridge) AddSFCRule

func (l *LocalBridge) AddSFCRule() error

func (*LocalBridge) AddVNFInstance

func (l *LocalBridge) AddVNFInstance() error

func (*LocalBridge) BridgeInit

func (l *LocalBridge) BridgeInit()

specific type Bridge interface

func (*LocalBridge) BridgeInitCNI

func (l *LocalBridge) BridgeInitCNI()

func (*LocalBridge) BridgeReset

func (l *LocalBridge) BridgeReset()

func (*LocalBridge) InitFromLocalLearnAction

func (l *LocalBridge) InitFromLocalLearnAction(fromLocalLearnAction *ofctrl.LearnAction) error

func (*LocalBridge) InitFromLocalTrunkPortLearnAction

func (l *LocalBridge) InitFromLocalTrunkPortLearnAction(fromLocalLearnAction *ofctrl.LearnAction) error

func (*LocalBridge) MultipartReply

func (l *LocalBridge) MultipartReply(sw *ofctrl.OFSwitch, rep *openflow13.MultipartReply)

func (*LocalBridge) PacketRcvd

func (l *LocalBridge) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

func (*LocalBridge) RemoveLocalEndpoint

func (l *LocalBridge) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*LocalBridge) RemoveMicroSegmentRule

func (l *LocalBridge) RemoveMicroSegmentRule(rule *EveroutePolicyRule) error

func (*LocalBridge) RemoveSFCRule

func (l *LocalBridge) RemoveSFCRule() error

func (*LocalBridge) RemoveVNFInstance

func (l *LocalBridge) RemoveVNFInstance() error

type LocalBridgeOverlay

type LocalBridgeOverlay struct {
	BaseBridge
	// contains filtered or unexported fields
}

func (*LocalBridgeOverlay) AddIPPoolGW

func (l *LocalBridgeOverlay) AddIPPoolGW(gw string) error

func (*LocalBridgeOverlay) AddIPPoolSubnet

func (l *LocalBridgeOverlay) AddIPPoolSubnet(subnetStr string) error

func (*LocalBridgeOverlay) AddLocalEndpoint

func (l *LocalBridgeOverlay) AddLocalEndpoint(endpoint *Endpoint) error

func (*LocalBridgeOverlay) BridgeInitCNI

func (l *LocalBridgeOverlay) BridgeInitCNI()

func (*LocalBridgeOverlay) DelIPPoolGW

func (l *LocalBridgeOverlay) DelIPPoolGW(gw string) error

func (*LocalBridgeOverlay) DelIPPoolSubnet

func (l *LocalBridgeOverlay) DelIPPoolSubnet(subnetStr string) error

func (*LocalBridgeOverlay) RemoveLocalEndpoint

func (l *LocalBridgeOverlay) RemoveLocalEndpoint(endpoint *Endpoint) error

type NatBridge

type NatBridge struct {
	BaseBridge
	// contains filtered or unexported fields
}

func NewNatBridge

func NewNatBridge(brName string, datapathManager *DpManager) *NatBridge

func (*NatBridge) AddDNATFlow

func (n *NatBridge) AddDNATFlow(ip string, protocol corev1.Protocol, port int32) error

func (*NatBridge) AddLBIP

func (n *NatBridge) AddLBIP(svcID, ip string, ports []*proxycache.Port, sessionAffinityTimeout int32, tp ertype.TrafficPolicyType) error

func (*NatBridge) AddLBPort

func (n *NatBridge) AddLBPort(svcID string, port *proxycache.Port, ips []string, sessionAffinityTimeout int32, tp ertype.TrafficPolicyType) error

func (*NatBridge) AddLocalEndpoint

func (n *NatBridge) AddLocalEndpoint(endpoint *Endpoint) error

func (*NatBridge) AddSessionAffinity

func (n *NatBridge) AddSessionAffinity(svcID string, ips []string, ports []*proxycache.Port, sessionAffinityTimeout int32) error

func (*NatBridge) BridgeInit

func (n *NatBridge) BridgeInit()

func (*NatBridge) BridgeInitCNI

func (n *NatBridge) BridgeInitCNI()

func (*NatBridge) BridgeReset

func (n *NatBridge) BridgeReset()

func (*NatBridge) DelDnatFlow

func (n *NatBridge) DelDnatFlow(ip string, protocol corev1.Protocol, port int32) error

func (*NatBridge) DelLBGroup

func (n *NatBridge) DelLBGroup(svcID, portName string) error

func (*NatBridge) DelLBIP

func (n *NatBridge) DelLBIP(svcID, ip string) error

func (*NatBridge) DelLBPort

func (n *NatBridge) DelLBPort(svcID, portName string) error

func (*NatBridge) DelService

func (n *NatBridge) DelService(svcID string) error

func (*NatBridge) DelSessionAffinity

func (n *NatBridge) DelSessionAffinity(svcID string) error

func (*NatBridge) DelSvcLBFlow

func (n *NatBridge) DelSvcLBFlow(svcID string) error

func (*NatBridge) GetSvcIndexCache

func (n *NatBridge) GetSvcIndexCache() *cache.SvcIndex

func (*NatBridge) RemoveLocalEndpoint

func (n *NatBridge) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*NatBridge) ResetLBGroup

func (n *NatBridge) ResetLBGroup(svcID, portName string) error

func (*NatBridge) UpdateLBGroup

func (n *NatBridge) UpdateLBGroup(svcID, portName string, backends []everoutesvc.Backend, tp ertype.TrafficPolicyType) error

func (*NatBridge) UpdateLBPort

func (n *NatBridge) UpdateLBPort(svcID string, port *proxycache.Port, ips []string, sessionAffinityTimeout int32, tp ertype.TrafficPolicyType) error

func (*NatBridge) UpdateSessionAffinityTimeout

func (n *NatBridge) UpdateSessionAffinityTimeout(svcID string, ips []string, ports []*proxycache.Port, sessionAffinityTimeout int32) error

type PolicyBridge

type PolicyBridge struct {
	BaseBridge
	// contains filtered or unexported fields
}

func NewPolicyBridge

func NewPolicyBridge(brName string, datapathManager *DpManager) *PolicyBridge

func (*PolicyBridge) AddLocalEndpoint

func (p *PolicyBridge) AddLocalEndpoint(endpoint *Endpoint) error

func (*PolicyBridge) AddMicroSegmentRule

func (p *PolicyBridge) AddMicroSegmentRule(rule *EveroutePolicyRule, direction uint8, tier uint8, mode string) (*FlowEntry, error)

func (*PolicyBridge) AddSFCRule

func (p *PolicyBridge) AddSFCRule() error

func (*PolicyBridge) AddVNFInstance

func (p *PolicyBridge) AddVNFInstance() error

func (*PolicyBridge) BridgeInit

func (p *PolicyBridge) BridgeInit()

func (*PolicyBridge) BridgeInitCNI

func (p *PolicyBridge) BridgeInitCNI()

func (*PolicyBridge) BridgeReset

func (p *PolicyBridge) BridgeReset()

func (*PolicyBridge) GetTierTable

func (p *PolicyBridge) GetTierTable(direction uint8, tier uint8, mode string) (*ofctrl.Table, *ofctrl.Table, error)

func (*PolicyBridge) MultipartReply

func (p *PolicyBridge) MultipartReply(sw *ofctrl.OFSwitch, rep *openflow13.MultipartReply)

func (*PolicyBridge) PacketRcvd

func (p *PolicyBridge) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

func (*PolicyBridge) RemoveLocalEndpoint

func (p *PolicyBridge) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*PolicyBridge) RemoveMicroSegmentRule

func (p *PolicyBridge) RemoveMicroSegmentRule(rule *EveroutePolicyRule) error

func (*PolicyBridge) RemoveSFCRule

func (p *PolicyBridge) RemoveSFCRule() error

func (*PolicyBridge) RemoveVNFInstance

func (p *PolicyBridge) RemoveVNFInstance() error

type PolicyInfo

type PolicyInfo struct {
	Dir    uint8
	Action string
	Mode   string
	FlowID uint64
	Item   []PolicyItem
}

type PolicyItem

type PolicyItem struct {
	Name       string
	Namespace  string
	PolicyType policycache.PolicyType
}

type RoundInfo

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

type UplinkBridge

type UplinkBridge struct {
	BaseBridge
	// contains filtered or unexported fields
}

func (*UplinkBridge) AddLocalEndpoint

func (u *UplinkBridge) AddLocalEndpoint(endpoint *Endpoint) error

func (*UplinkBridge) AddMicroSegmentRule

func (u *UplinkBridge) AddMicroSegmentRule(rule *EveroutePolicyRule, direction uint8, tier uint8, mode string) (*FlowEntry, error)

func (*UplinkBridge) AddSFCRule

func (u *UplinkBridge) AddSFCRule() error

func (*UplinkBridge) AddVNFInstance

func (u *UplinkBridge) AddVNFInstance() error

func (*UplinkBridge) BridgeInit

func (u *UplinkBridge) BridgeInit()

func (*UplinkBridge) BridgeInitCNI

func (u *UplinkBridge) BridgeInitCNI()

func (*UplinkBridge) BridgeReset

func (u *UplinkBridge) BridgeReset()

func (*UplinkBridge) MultipartReply

func (u *UplinkBridge) MultipartReply(sw *ofctrl.OFSwitch, rep *openflow13.MultipartReply)

func (*UplinkBridge) PacketRcvd

func (u *UplinkBridge) PacketRcvd(sw *ofctrl.OFSwitch, pkt *ofctrl.PacketIn)

func (*UplinkBridge) RemoveLocalEndpoint

func (u *UplinkBridge) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*UplinkBridge) RemoveMicroSegmentRule

func (u *UplinkBridge) RemoveMicroSegmentRule(rule *EveroutePolicyRule) error

func (*UplinkBridge) RemoveSFCRule

func (u *UplinkBridge) RemoveSFCRule() error

func (*UplinkBridge) RemoveVNFInstance

func (u *UplinkBridge) RemoveVNFInstance() error

type UplinkBridgeOverlay

type UplinkBridgeOverlay struct {
	BaseBridge
	// contains filtered or unexported fields
}

func (*UplinkBridgeOverlay) AddIPPoolSubnet

func (u *UplinkBridgeOverlay) AddIPPoolSubnet(subnetStr string) error

func (*UplinkBridgeOverlay) AddLocalEndpoint

func (u *UplinkBridgeOverlay) AddLocalEndpoint(endpoint *Endpoint) error

func (*UplinkBridgeOverlay) AddRemoteEndpoint

func (u *UplinkBridgeOverlay) AddRemoteEndpoint(epIP, remoteNodeIP net.IP) error

func (*UplinkBridgeOverlay) BridgeInitCNI

func (u *UplinkBridgeOverlay) BridgeInitCNI()

func (*UplinkBridgeOverlay) DelIPPoolSubnet

func (u *UplinkBridgeOverlay) DelIPPoolSubnet(subnetStr string) error

func (*UplinkBridgeOverlay) RemoveLocalEndpoint

func (u *UplinkBridgeOverlay) RemoveLocalEndpoint(endpoint *Endpoint) error

func (*UplinkBridgeOverlay) RemoveRemoteEndpoint

func (u *UplinkBridgeOverlay) RemoveRemoteEndpoint(epIPStr string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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