mastercfg

package
v1.0.0-alpha-01-28-201... Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var ProviderDb = make(map[string]*Provider)

ProviderDb is map of providers for a service keyed by provider ip

View Source
var ServiceLBDb = make(map[string]*ServiceLBInfo) //DB for all services keyed by servicename.tenant

ServiceLBDb is map of all services

View Source
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

func GetEndpointGroupKey(groupName, tenantName string) string

GetEndpointGroupKey returns endpoint group key

func GetNwCfgKey

func GetNwCfgKey(network, tenant string) string

GetNwCfgKey returns the key for network state

func InitPolicyMgr

func InitPolicyMgr(stateDriver core.StateDriver, ofm *ofnet.OfnetMaster) error

InitPolicyMgr initializes the policy manager

func NotifyEpgChanged

func NotifyEpgChanged(epgID int)

NotifyEpgChanged triggers GARPs.

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.

func (*CfgBgpState) Write

func (s *CfgBgpState) Write() error

Write the state

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) Clear

func (s *CfgEndpointState) Clear() error

Clear removes the state.

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.

func (*CfgEndpointState) Write

func (s *CfgEndpointState) Write() error

Write the state.

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) Clear

func (s *CfgNetworkState) Clear() error

Clear removes the state.

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.

func (*CfgNetworkState) Write

func (s *CfgNetworkState) Write() error

Write the state.

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.

func (*CfgServiceLBState) Write

func (s *CfgServiceLBState) Write() error

Write the state

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.

func (*EndpointGroupState) Write

func (s *EndpointGroupState) Write() error

Write the state.

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

func FindEpgPolicy(epgpKey string) *EpgPolicy

FindEpgPolicy finds an epg policy

func NewEpgPolicy

func NewEpgPolicy(epgpKey string, epgID int, policy *contivModel.Policy) (*EpgPolicy, error)

NewEpgPolicy creates a new policy instance attached to an endpoint group

func (*EpgPolicy) AddRule

func (gp *EpgPolicy) AddRule(rule *contivModel.Rule) error

AddRule adds a rule to epg policy

func (*EpgPolicy) Clear

func (gp *EpgPolicy) Clear() error

Clear removes the state.

func (*EpgPolicy) DelRule

func (gp *EpgPolicy) DelRule(rule *contivModel.Rule) error

DelRule removes a rule from epg policy

func (*EpgPolicy) Delete

func (gp *EpgPolicy) Delete() error

Delete deletes the epg policy

func (*EpgPolicy) Read

func (gp *EpgPolicy) Read(id string) error

Read the state for a given identifier

func (*EpgPolicy) ReadAll

func (gp *EpgPolicy) ReadAll() ([]core.State, error)

ReadAll state and return the collection.

func (*EpgPolicy) WatchAll

func (gp *EpgPolicy) WatchAll(rsps chan core.WatchState) error

WatchAll state transitions and send them through the channel.

func (*EpgPolicy) Write

func (gp *EpgPolicy) Write() error

Write the state.

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.

func (*GlobConfig) Write

func (s *GlobConfig) Write() error

Write the state

type OldResState

type OldResState struct {
	VLANs  string
	VXLANs string
}

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.

func (*SvcProvider) Write

func (s *SvcProvider) Write() error

Write the state

Jump to

Keyboard shortcuts

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