managers

package
v0.0.0-...-b7e53b0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

The package "managers" provides the code for the various "manager" goroutines that comprise Tegu. These include:

Agent_mgr() - responsible for communications with the tegu_agent processes. These in turn communicate with the various OpenStack nodes to make switch changes.

Fq_mgr() - handles flow mods, etc. for bandwidth reservations.

Http_api() - provides the HTTP/S API interface for Tegu.

Network_mgr() - provides discovery and graphing of the underlying network.

Osif_mgr() - provides the interface to OpenStack.

Res_manager() - provides the repository for all reservations (Pledges) as well as scheduling of these pledges into the network.

Index

Constants

View Source
const (
	RMLU_NOOP int = -1 // no operation

	RMLU_GET         int // Get a reservation (pledge) and return it
	RMLU_GET_MIRRORS     // Get mirror pledge
)
View Source
const (
	// request types placed into channel messages. Primary receiver of each type is
	// indicated in parens (except for the more generic types).
	REQ_NOOP int = -1 // no operation

	REQ_SK_RESERVE   int // bandwidth reservation request for skoogie -- qfull (network)
	REQ_BW_RESERVE       // bandwidth endpoint reservation oriented request -- qlite
	REQ_BWOW_RESERVE     // create a one way bandwidth reservation
	REQ_IE_RESERVE       // fq-manager send ingress/egress reservations to skoogi
	REQ_ST_RESERVE       // fq-manager send traffic steering reservation fmods to agent
	REQ_NETGRAPH         // return the network graph as a jThing (json)
	REQ_HASCAP           // check for reservation capacity
	REQ_ADD              // generic requests may mean slightly different things based on the go-routine receiving the request
	REQ_DEL
	REQ_GET
	REQ_CHKPT                   // take a checkpoint (res_mgr)
	REQ_RTRY_CHKPT              // tickler sends this to checkpoint if one was missed
	REQ_LOAD                    // load checkpoint file data (res_mgr)
	REQ_NETUPDATE               // new network graph is attached (network)
	REQ_LISTCONNS               // user request a port list for named host	(network)
	REQ_GENMAPS                 // generate VM maps (osif) and send out
	REQ_GETIP                   // look up the VM name or ID and return the IP address
	REQ_GWMAP                   // map that translates mac to ip just for gateway nodes (not included in the vm list)
	REQ_PUSH                    // generic push depending on receiver
	REQ_PUSHNOW                 // force unpushed reservations out now
	REQ_LIST                    // generic list depending on receiver
	REQ_GETLMAX                 // get max link allocation across the network
	REQ_SETQUEUES               // fqmgr - tickle to cause queues to be set if needed
	REQ_CHOSTLIST               // get a list of compute hosts, or 'here is' a host list (network, fqmgr)
	REQ_LISTHOSTS               // network - build a host list that includes vm name, ip, switch(es) and port(s) for each host
	REQ_GEN_QMAP                // network - generate queue info needed by external process to set queues
	REQ_GEN_FMOD                // send generic flow-mod
	REQ_VM2IP                   // xlate map VM name | VM ID to IP map is in the request
	REQ_VMID2IP                 // xlate map VM-ID to ip is in request
	REQ_IP2VMID                 // xlate map IP address to VM-ID
	REQ_VMID2PHOST              // xlate map VM-ID to physical host name
	REQ_IP2MAC                  // xlate map IP address to mac
	REQ_GEN_EPQMAP              // generate queue map for end points only (no intermediate queues are generated)
	REQ_SENDALL                 // send message to all
	REQ_SENDSHORT               // send a long running request to a single agent (uses only one agent to handle all long running requests
	REQ_SENDLONG                // send a short running request to a single agent (will round robin between all attached agents)
	REQ_IP2MACMAP               // generate an ip to mac translation table and return to requester
	REQ_MAC2PHOST               // request contains mac to physical host data
	REQ_INTERMEDQ               // setup queues and flowmods on intermediate switches
	REQ_IP2FIP                  // request contains a translation of tenant/ip to floating ip
	REQ_FIP2IP                  // request contains a translation of floating ip to tenant/ip
	REQ_STATE                   // generate some kind of state data back to message sender
	REQ_PAUSE                   // put things into a paused mode
	REQ_RESUME                  // take things out of a paused mode and resume normal reservation operation.
	REQ_VALIDATE_HOST           // validate a [token/][project/]hostname string
	REQ_GENCREDS                // generate credentials
	REQ_PROJNAME2ID             // translate project name to ID
	REQ_HOSTINFO                // given a vm name generate a *string with ip, mac, switch-id and switch port
	REQ_VALIDATE_TOKEN          // given a token/user-space  string, validate the token and translate user-space name to ID
	REQ_VALIDATE_TEGU_ADMIN     // given a token validate that it is for the tegu user defined in our config
	REQ_PNAME2ID                // translate project (user, tenant, etc.) to ID
	REQ_SETULCAP                // set a user link capacity
	REQ_GETGW                   // give a tenant ID and get it's gateway
	REQ_GETPHOST                // givn an IP address, get it's physical host
	REQ_XLATE_HOST              // translate a [token/][project/]hostname into ID/hostname without validation of token if it exits.
	REQ_PLEDGE_LIST             // causes res mgr to generate a list of pledges based on a host name
	REQ_YANK_RES                // yank out a reservation causing flow-mods to drop
	REQ_LISTULCAP               // user link capacity list
	REQ_ALLUP                   // signal that all initialisation has been completed
	REQ_GET_HOSTINFO            // request a full set of host info from the maps
	REQ_GET_MIRRORS             // get a list of mirrors from res mgr
	REQ_GET_DEFGW               // given a project[/junk] string, return the default (first in list) gateway (router)
	REQ_GET_PHOST_FROM_MAC      // used by mirroring to find the phost that goes with a MAC
	REQ_GET_PHOST_FROM_PORTUUID // used by mirroring to find the phost that goes with a neutron UUID
	REQ_GET_PROJ_HOSTS          // get a list of all VMs for a project for block insertion into network graph
	REQ_HAS_ANY_ROLE            // given token and role list return true if token lists any role presented
	REQ_HAS_ANY_ROLE2           // given token and role list return user,project if token lists any role presented
	REQ_SETDISC                 // set the discount value
	REQ_DUPCHECK                // check for duplicate (resmgr)
	REQ_SWITCHINFO              // request switch info from all hosts
	REQ_GENPLAN                 // (re)generate a steering plan for a new/modified chain request
	REQ_PT_RESERVE              // passthru reservation
	REQ_VET_RETRY               // run the reservation retry queue if it has size
)
View Source
const (
	ONE_GIG int64 = 1024 * 1024 * 1024

	// defaults
	DEF_ALT_TABLE int = 90 // alternate table in OVS for metadata marking
)
View Source
const (
	DS_ADD     int = iota // pledge vetted, add to cache
	DS_RETRY              // unable to vet pledge, retry later
	DS_DISCARD            // hard failure vetting pledge, drop from cache
)

res_mgr disposition state constants

View Source
const (
	/*
					// offsets into the array of data passed to fq_mgr on requests
		FQ_IP1		int = iota		// ip address of host 1					(ie proactive reservation request)
		FQ_IP2						// ip address of host 2
		FQ_EXPIRY					// reservation expiry time
		FQ_SPQ						// queue to map traffic to
		FQ_ID						// id used if reporting error asynch
		FQ_DIR_IN					// bool flag that indicates whether the flowmod direction is into switch or out of switch
		FQ_DSCP						// user supplied dscp that the data should have on egress
		FQ_EXTIP					// an external IP that is needed to setup flow mods when session traveling through a gateway
		FQ_EXTTY					// external IP type used in fmod command (either -D or -S)
		FQ_TPSPORT					// transport source port number
		FQ_TPDPORT					// transport dest port number
		FQ_SMAC						// mac addresses (src and dest)
		FQ_DMAC
		FQ_NEXT_MAC					// mac address of next hop
		FQ_SWID						// switch ID
		FQ_PRI						// priority
		FQ_META_M
		FQ_META_S

		FQ_SIZE						// CAUTION:  this must be LAST as it indicates the size of the array needed
	*/
	FQ_QLIST int = 0 // the list of current queue settings 	(set queues)
)

fq_mgr constants (resets iota)

Variables

This section is empty.

Functions

func Agent_mgr

func Agent_mgr(ach chan *ipc.Chmsg)

func Fq_mgr

func Fq_mgr(my_chan chan *ipc.Chmsg, sdn_host *string)

the main go routine to act on messages sent to our channel. We expect messages from the reservation manager, and from a tickler that causes us to evaluate the need to resize ovs queues.

DSCP values: Dscp values range from 0-64 decimal, but when described on or by

flow-mods are shifted two bits to the left. The send flow mod function will
do the needed shifting so all values outside of that one funciton should assume/use
decimal values in the range of 0-64.

func Http_api

func Http_api(api_port *string, nwch chan *ipc.Chmsg, rmch chan *ipc.Chmsg)

start an http listener. we expect channels and the port to be in globals.

func Initialise

func Initialise(cfg_fname *string, ver *string, nwch chan *ipc.Chmsg, rmch chan *ipc.Chmsg, rmluch chan *ipc.Chmsg, osifch chan *ipc.Chmsg, fqch chan *ipc.Chmsg, amch chan *ipc.Chmsg) (err error)

Sets up the global variables needed by the whole package. This should be invoked by the main tegu function (main/tegu.go).

CAUTION: this is not implemented as an init() function as we must pass information from the

main to here.

func Log_Restart

func Log_Restart(version string)

func Mk_osif_project

func Mk_osif_project(name string) (p *osif_project, err error)

Make a new project map management block.

func Network_mgr

func Network_mgr(nch chan *ipc.Chmsg, sdn_host *string)

to be executed as a go routine. nch is the channel we are expected to listen on for api requests etc. sdn_host is the host name and port number where the sdn controller is running. (for now we assume the sdn-host is a floodlight host and invoke FL_ to build our graph)

func Osif_mgr

func Osif_mgr(my_chan chan *ipc.Chmsg)

executed as a goroutine this loops waiting for messages from the tickler and takes action based on what is needed.

func Res_manager

func Res_manager(my_chan chan *ipc.Chmsg, cookie *string)

Executes as a goroutine to drive the reservation manager portion of tegu.

func Set_accept_state

func Set_accept_state(state bool)

Allows the setting of accept requests to be toggled.

Types

type Fq_parms

type Fq_parms struct {
	Ip1     *string // ip of hosts or endpoints. if order is important ip1 is src
	Ip2     *string
	Tpsport *string // transport layer source port (strings to allow mask)
	Tpdport *string // transport layer dest port
	Swport  int     // the switch port
	Smac    *string // source mac
	Dmac    *string // dest mac
	Dscp    int     // dscp mask to match if non-zero
	Meta    *string // meta
	Resub   *string // list of tables to resubmit to
	Vlan_id *string // either a vlan ID or a mac address; mac is looked up by agent
}

Parameters that may need to be passed to fq-mgr for either matching or setting in the action. All fields are public for easier access and eventual conversion to json as a means to pass to the agent.

type Fq_req

type Fq_req struct {
	Pri    int     // fmod priority
	Cookie int     // cookie that is added to the flow-mod (not a reservation cookie)
	Expiry int64   // either a hard time or a timeout depending on the situation
	Id     *string // id that fq-mgr will pass back if it indicates an error
	Table  int     // table to put the fmod into
	Output *string // output directive: none, normal, drop (resub will force none)

	Dir_in   bool    // true if direction is inbound (bandwidth fmods)
	Spq      int     // switch's port for queue
	Extip    *string // exterior IP address necessary for inter-tenant reservations
	Exttyp   *string // external IP type (either -D or -S)
	Protocol *string // protocol (steering) udp[4|6]:port or tcp[4|6]:port, port may be 0

	Tptype   *string // transport type (i.e. protocol: tcp, udp, etc)
	Resub    *string // list of tables (space sep numbers) to resubmit to
	Dscp     int     // dscp value that should be used for the traffic
	Dscp_koe bool    // true if the value is to be kept on the packet as it leaves the environment
	Ipv6     bool    // set to true to force ipv6 packet matching

	Nxt_mac       *string     // mac of next hop (steering)
	Lbmac         *string     // late binding mac
	Swid          *string     // switch ID (either a dpid or host name for ovs)
	Espq          *gizmos.Spq // a collection of switch, port, queue information (might replace spq and swid)
	Single_switch bool        // indicates that only one switch is involved (dscp handling is different)

	Match  *Fq_parms // things to match on
	Action *Fq_parms // things to set in action
}

Main struct passed to fq-mgr that references the set of match and action parameters

func Mk_fqreq

func Mk_fqreq(id *string) (np *Fq_req)

Create a structure that is initialised such that the default is to not actually cause a match to be generated and forces output to none.

func (*Fq_req) Clone

func (src *Fq_req) Clone() (nr *Fq_req)

Makes a deep copy (copies the match and action structs too) of a fq request structure. Returns a pointer to the new struct.

func (*Fq_req) To_bw_map

func (fq *Fq_req) To_bw_map() (fmap map[string]string)

Build a map suitable for use as parms for a bandwidth request to the agent manager. The agent bandwidth flow-mod generator takes a more generic set of parameters and the match/action information is "compressed".

OVS doesn't accept DSCP values, but shifted values (e.g. 46 == 184), so we shift the DSCP value given to be what OVS might want as a parameter.

func (*Fq_req) To_bwow_map

func (fq *Fq_req) To_bwow_map() (fmap map[string]string)

Build a map suitable for use as parms for a oneway bandwidth request to the agent manager. The agent bandwidth flow-mod generator takes a more generic set of parameters and the match/action information is "compressed".

OVS doesn't accept DSCP values, but shifted values (e.g. 46 == 184), so we shift the DSCP value given to be what OVS might want as a parameter.

func (*Fq_req) To_json

func (fq *Fq_req) To_json() (*string, error)

func (*Fq_req) To_pt_map

func (fq *Fq_req) To_pt_map() (fmap map[string]string)

Build a map suitable for use as parms for a passthrough request to the agent manager.

build_opt( parms["smac"], "-s" ) +				// smac can (and should) be an endpoint UUID which is converted to mac/bridge on the host
build_opt( parms["sip"], "-S" ) +				// sip is [proto:][addr:][port] where either proto or address must be supplied
build_opt( parms["timeout"],  "-t" )

type Inventory

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

Manages the reservation inventory

func Mk_inventory

func Mk_inventory() (inv *Inventory)

--- Public ---------------------------------------------------------------------------

constructor

func (*Inventory) Add_res

func (inv *Inventory) Add_res(pi interface{}) (err error)

Stuff the pledge into the cache erroring if the pledge already exists. Expect either a Pledge, or a pointer to a pledge.

func (*Inventory) Add_retry

func (inv *Inventory) Add_retry(pi interface{}) (err error)

Stuff the pledge into the retry cache erroring if the pledge already exists. Expect either a Pledge, or a pointer to a pledge.

func (*Inventory) Del_all_res

func (inv *Inventory) Del_all_res(cookie *string) (ndel int)

delete all of the reservations provided that the cookie is the super cookie. If cookie is a user cookie, then deletes all reservations that match the cookie.

func (*Inventory) Del_res

func (inv *Inventory) Del_res(name *string, cookie *string) (state error)

Looks for the named reservation and deletes it if found. The cookie must be either the supper cookie, or the cookie that the user supplied when the reservation was created. Deletion is affected by resetting the expiry time on the pledge to now + a few seconds. This will cause a new set of flow-mods to be sent out with an expiry time that will take them out post haste and without the need to send "delete" flow-mods out.

This function sends a request to the network manager to delete the related queues. This must be done here so as to prevent any issues with the loosely coupled management of reservation and queue settings. It is VERY IMPORTANT to delete the reservation from the network perspective BEFORE the expiry time is reset. If it is reset first then the network splits timeslices based on the new expiry and queues end up dangling.

func (*Inventory) Get_mirrorlist

func (inv *Inventory) Get_mirrorlist() string

func (*Inventory) Get_res

func (inv *Inventory) Get_res(name *string, cookie *string) (p *gizmos.Pledge, state error)

Return the reservation that matches the name passed in provided that the cookie supplied matches the cookie on the reservation as well. The cookie may be either the cookie that the user supplied when the reservation was created, or may be the 'super cookie' admin 'root' as you will, which allows access to all reservations. The return will be nil,nil if it's not found; nil,state indicates an error.

func (*Inventory) Get_retry_res

func (inv *Inventory) Get_retry_res(name *string, cookie *string) (p *gizmos.Pledge, state error)

Search the retry cache for the reservation and return if it is found and the given cookie matches, or the super cookie is given.

type MirrorInfo

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

type Net_vm

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

func Mk_netreq_vm

func Mk_netreq_vm(name *string, id *string, ip4 *string, ip6 *string, phost *string, mac *string, gw *string, fip *string, gwmap map[string]*string) (np *Net_vm)

Create a vm insertion structure. Not a good idea to create a nil named structure, but we'll allow it and subs in the ip4 value as its name if provided, otherwise the string unnamed.

func (*Net_vm) Add2graph

func (vm *Net_vm) Add2graph(nw_ch chan *ipc.Chmsg)

Send the vm struct to network manager as an insert to it's maps

func (*Net_vm) Get_gwmap

func (vm *Net_vm) Get_gwmap() map[string]*string

Returns the map.

func (*Net_vm) Get_values

func (vm *Net_vm) Get_values() (name *string, id *string, ip4 *string, ip6 *string, gw *string, phost *string, mac *string, fip *string)

Returns all values except the gateway map.

func (*Net_vm) Put_id

func (vm *Net_vm) Put_id(nv *string)

Replaces the id with the new value

func (*Net_vm) Put_ip4

func (vm *Net_vm) Put_ip4(nv *string)

Replaces the id with the new value

func (*Net_vm) Put_ip6

func (vm *Net_vm) Put_ip6(nv *string)

Replaces the id with the new value

func (*Net_vm) Put_name

func (vm *Net_vm) Put_name(nv *string)

Replaces the name in the struct with the new value if nv isn't nil;

func (*Net_vm) Put_phost

func (vm *Net_vm) Put_phost(nv *string)

Replace the physical host with the supplied value.

func (*Net_vm) To_str

func (vm *Net_vm) To_str() string

Output in human readable form.

type Network

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

Defines everything we need to know about a network.

func (*Network) Is_relaxed

func (n *Network) Is_relaxed() bool

func (*Network) Set_relaxed

func (n *Network) Set_relaxed(state bool)

-------------- map management (mostly tegu-lite) -----------------------------------------------------------

Set the relaxed mode in the network.

Jump to

Keyboard shortcuts

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