Documentation ¶
Index ¶
- Constants
- Variables
- func GetEndpointGroupID(stateDriver core.StateDriver, groupName, tenantName string) (int, error)
- func GetEndpointGroupKey(groupName, tenantName string) string
- func GetNwCfgKey(network, tenant string) string
- func InitPolicyMgr(stateDriver core.StateDriver, ofm *ofnet.OfnetMaster) error
- func NotifyEpgChanged(epgID int)
- type CfgBgpState
- type CfgEndpointState
- type CfgNetworkState
- func (s *CfgNetworkState) Clear() error
- func (s *CfgNetworkState) DecrEpCount() error
- func (s *CfgNetworkState) IncrEpCount() error
- func (s *CfgNetworkState) Read(id string) error
- func (s *CfgNetworkState) ReadAll() ([]core.State, error)
- func (s *CfgNetworkState) WatchAll(rsps chan core.WatchState) error
- func (s *CfgNetworkState) Write() error
- type CfgServiceLBState
- type EndpointGroupState
- type EpgPolicy
- func (gp *EpgPolicy) AddRule(rule *contivModel.Rule) error
- func (gp *EpgPolicy) Clear() error
- func (gp *EpgPolicy) DelRule(rule *contivModel.Rule) error
- func (gp *EpgPolicy) Delete() error
- func (gp *EpgPolicy) Read(id string) error
- func (gp *EpgPolicy) ReadAll() ([]core.State, error)
- func (gp *EpgPolicy) WatchAll(rsps chan core.WatchState) error
- func (gp *EpgPolicy) Write() error
- type GlobConfig
- type OldResState
- type Provider
- type RuleMap
- type ServiceLBInfo
- type SvcProvider
Constants ¶
const ( // StateBasePath is the base path for all state operations. StateBasePath = "/contiv.io/" // StateConfigPath is the path to the root of the configuration state StateConfigPath = StateBasePath + "state/" // StateOperPath is the path for operational/runtime state StateOperPath = StateBasePath + "oper/" )
Variables ¶
var ProviderDb = make(map[string]*Provider)
ProviderDb is map of providers for a service keyed by provider ip
var ServiceLBDb = make(map[string]*ServiceLBInfo) //DB for all services keyed by servicename.tenant
ServiceLBDb is map of all services
var SvcMutex sync.RWMutex
SvcMutex is mutex for service transaction
Functions ¶
func GetEndpointGroupID ¶
func GetEndpointGroupID(stateDriver core.StateDriver, groupName, tenantName string) (int, error)
GetEndpointGroupID returns endpoint group Id for a service It autocreates the endpoint group if it doesnt exist
func GetEndpointGroupKey ¶
GetEndpointGroupKey returns endpoint group key
func GetNwCfgKey ¶
GetNwCfgKey returns the key for network state
func InitPolicyMgr ¶
func InitPolicyMgr(stateDriver core.StateDriver, ofm *ofnet.OfnetMaster) error
InitPolicyMgr initializes the policy manager
Types ¶
type CfgBgpState ¶
type CfgBgpState struct { core.CommonState Hostname string `json:"hostname"` RouterIP string `json:"router-ip"` As string `json:"as"` NeighborAs string `json:"neighbor-as"` Neighbor string `json:"neighbor"` }
CfgBgpState is the router Bgp configuration for the host
func (*CfgBgpState) Clear ¶
func (s *CfgBgpState) Clear() error
Clear removes the configuration from the state store.
func (*CfgBgpState) Read ¶
func (s *CfgBgpState) Read(id string) error
Read the state in for a given ID.
func (*CfgBgpState) ReadAll ¶
func (s *CfgBgpState) ReadAll() ([]core.State, error)
ReadAll reads all the state for master bgp configurations and returns it.
func (*CfgBgpState) WatchAll ¶
func (s *CfgBgpState) WatchAll(rsps chan core.WatchState) error
WatchAll state transitions and send them through the channel.
type CfgEndpointState ¶
type CfgEndpointState struct { core.CommonState NetID string `json:"netID"` EndpointID string `json:"endpointID"` ServiceName string `json:"serviceName"` EndpointGroupID int `json:"endpointGroupId"` EndpointGroupKey string `json:"endpointGroupKey"` IPAddress string `json:"ipAddress"` IPv6Address string `json:"ipv6Address"` MacAddress string `json:"macAddress"` HomingHost string `json:"homingHost"` IntfName string `json:"intfName"` VtepIP string `json:"vtepIP"` Labels map[string]string `json:"labels"` ContainerID string `json:"containerId"` EPCommonName string `json:"epCommonName"` }
CfgEndpointState implements the State interface for an endpoint implemented using vlans with ovs. The state is stored as Json objects.
func (*CfgEndpointState) Read ¶
func (s *CfgEndpointState) Read(id string) error
Read the state for a given identifier.
func (*CfgEndpointState) ReadAll ¶
func (s *CfgEndpointState) ReadAll() ([]core.State, error)
ReadAll reads all state objects for the endpoints.
func (*CfgEndpointState) WatchAll ¶
func (s *CfgEndpointState) WatchAll(rsps chan core.WatchState) error
WatchAll fills a channel on each state event related to endpoints.
type CfgNetworkState ¶
type CfgNetworkState struct { core.CommonState Tenant string `json:"tenant"` NetworkName string `json:"networkName"` NwType string `json:"nwType"` PktTagType string `json:"pktTagType"` PktTag int `json:"pktTag"` ExtPktTag int `json:"extPktTag"` SubnetIP string `json:"subnetIP"` SubnetLen uint `json:"subnetLen"` Gateway string `json:"gateway"` IPAddrRange string `json:"ipAddrRange"` EpAddrCount int `json:"epAddrCount"` EpCount int `json:"epCount"` IPAllocMap bitset.BitSet `json:"ipAllocMap"` DNSServer string `json:"dnsServer"` IPv6Subnet string `json:"ipv6SubnetIP"` IPv6SubnetLen uint `json:"ipv6SubnetLen"` IPv6Gateway string `json:"ipv6Gateway"` IPv6AllocMap map[string]bool `json:"ipv6AllocMap"` IPv6LastHost string `json:"ipv6LastHost"` }
CfgNetworkState implements the State interface for a network implemented using vlans with ovs. The state is stored as Json objects.
func (*CfgNetworkState) DecrEpCount ¶
func (s *CfgNetworkState) DecrEpCount() error
DecrEpCount decrements endpoint count
func (*CfgNetworkState) IncrEpCount ¶
func (s *CfgNetworkState) IncrEpCount() error
IncrEpCount Increments endpoint count
func (*CfgNetworkState) Read ¶
func (s *CfgNetworkState) Read(id string) error
Read the state for a given identifier
func (*CfgNetworkState) ReadAll ¶
func (s *CfgNetworkState) ReadAll() ([]core.State, error)
ReadAll state and return the collection.
func (*CfgNetworkState) WatchAll ¶
func (s *CfgNetworkState) WatchAll(rsps chan core.WatchState) error
WatchAll state transitions and send them through the channel.
type CfgServiceLBState ¶
type CfgServiceLBState struct { core.CommonState ServiceName string `json:"servicename"` Tenant string `json:"tenantname"` Network string `json:"subnet"` Ports []string `json:"ports"` Selectors map[string]string `json:"selectors"` IPAddress string `json:"ipaddress"` Providers map[string]*Provider `json:"providers"` }
CfgServiceLBState is the service object configuration
func (*CfgServiceLBState) Clear ¶
func (s *CfgServiceLBState) Clear() error
Clear removes the configuration from the state store.
func (*CfgServiceLBState) Read ¶
func (s *CfgServiceLBState) Read(id string) error
Read the state in for a given ID.
func (*CfgServiceLBState) ReadAll ¶
func (s *CfgServiceLBState) ReadAll() ([]core.State, error)
ReadAll reads all the state for master bgp configurations and returns it.
func (*CfgServiceLBState) WatchAll ¶
func (s *CfgServiceLBState) WatchAll(rsps chan core.WatchState) error
WatchAll state transitions and send them through the channel.
type EndpointGroupState ¶
type EndpointGroupState struct { core.CommonState GroupName string `json:"groupName"` TenantName string `json:"tenantName"` NetworkName string `json:"networkName"` EndpointGroupID int `json:"endpointGroupId"` PktTagType string `json:"pktTagType"` PktTag int `json:"pktTag"` ExtPktTag int `json:"extPktTag"` EpCount int `json:"epCount"` // To store endpoint Count DSCP int `json:"DSCP"` Bandwidth string `json:"Bandwidth"` Burst int `json:"Burst"` }
EndpointGroupState implements the State interface for endpoint group implemented using vlans with ovs. The state is stored as Json objects.
func (*EndpointGroupState) Clear ¶
func (s *EndpointGroupState) Clear() error
Clear removes the state.
func (*EndpointGroupState) Read ¶
func (s *EndpointGroupState) Read(id string) error
Read the state for a given identifier
func (*EndpointGroupState) ReadAll ¶
func (s *EndpointGroupState) ReadAll() ([]core.State, error)
ReadAll state and return the collection.
func (*EndpointGroupState) WatchAll ¶
func (s *EndpointGroupState) WatchAll(rsps chan core.WatchState) error
WatchAll state transitions and send them through the channel.
type EpgPolicy ¶
type EpgPolicy struct { core.CommonState EpgPolicyKey string // Key for this epg policy EndpointGroupID int // Endpoint group where this policy is attached to RuleMaps map[string]*RuleMap // rules associated with this policy }
EpgPolicy has an instance of policy attached to an endpoint group
func FindEpgPolicy ¶
FindEpgPolicy finds an epg policy
func NewEpgPolicy ¶
NewEpgPolicy creates a new policy instance attached to an endpoint group
type GlobConfig ¶
type GlobConfig struct { core.CommonState NwInfraType string `json:"nw-infra-type"` FwdMode string `json:"fwd-mode"` ArpMode string `json:"arp-mode"` }
GlobConfig is the global configuration applicable to everything
func (*GlobConfig) Clear ¶
func (s *GlobConfig) Clear() error
Clear removes the configuration from the state store.
func (*GlobConfig) Read ¶
func (s *GlobConfig) Read(id string) error
Read the state in for a given ID.
func (*GlobConfig) ReadAll ¶
func (s *GlobConfig) ReadAll() ([]core.State, error)
ReadAll reads all the state for master global configurations and returns it.
func (*GlobConfig) WatchAll ¶
func (s *GlobConfig) WatchAll(rsps chan core.WatchState) error
WatchAll state transitions and send them through the channel.
type OldResState ¶
OldResState is used for global resource update
type Provider ¶
type Provider struct { IPAddress string // provider IP ContainerID string // container id Labels map[string]string // lables Tenant string Network string Services []string Container string //container endpoint id EpIDKey string }
Provider has providers info
type RuleMap ¶
type RuleMap struct { Rule *contivModel.Rule // policy rule OfnetRules map[string]*ofnet.OfnetPolicyRule // Ofnet rules associated with this policy rule }
RuleMap maps a policy rule to list of ofnet rules
type ServiceLBInfo ¶
type ServiceLBInfo struct { ServiceName string //Service name IPAddress string //Service IP Tenant string //Tenant name of the service Network string // service network Ports []string //Service_port:Provider_port:protocol Selectors map[string]string // selector labels associated with a service Providers map[string]*Provider //map of providers for a service keyed by provider ip }
ServiceLBInfo holds service information
type SvcProvider ¶
type SvcProvider struct { core.CommonState ServiceName string Providers []string }
SvcProvider holds service information
func (*SvcProvider) Clear ¶
func (s *SvcProvider) Clear() error
Clear removes the configuration from the state store.
func (*SvcProvider) Read ¶
func (s *SvcProvider) Read(id string) error
Read the state in for a given ID.
func (*SvcProvider) ReadAll ¶
func (s *SvcProvider) ReadAll() ([]core.State, error)
ReadAll reads all the state for master bgp configurations and returns it.
func (*SvcProvider) WatchAll ¶
func (s *SvcProvider) WatchAll(rsps chan core.WatchState) error
WatchAll state transitions and send them through the channel.