api

package
v0.0.0-...-a7b7eb4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package api implements the oftee API that can be used for injecting packets to the open flow devices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	DPIDMappingListener chan DPIDMapping
	ListenOn            string

	MemProfile string
	CPUProfile string
	// contains filtered or unexported fields
}

API maintains the configuration and runtime information for the API

func NewAPI

func NewAPI(listenOn string, cpuProfile string, memProfile string) *API

NewAPI properly instantiates a new API instance.

func (*API) ListDevicesHandler

func (api *API) ListDevicesHandler(resp http.ResponseWriter, req *http.Request)

ListDevicesHandler returns a list of DPIDs known to the system as a JSON array

func (*API) ListenAndServe

func (api *API) ListenAndServe()

ListenAndServe implements the API service loop

func (*API) MemProfileHandler

func (api *API) MemProfileHandler(resp http.ResponseWriter, req *http.Request)

MemProfileHandler creates a snapshot memory profile

func (*API) PacketOutHandler

func (api *API) PacketOutHandler(resp http.ResponseWriter, req *http.Request)

PacketOutHandler handles an HTTP request to packet out to a given switch port. The payload to the request should be the []byte of a OpenFlow packet out message, including the open flow header, the packet out header, and the packet.

func (*API) StartCPUProfileHandler

func (api *API) StartCPUProfileHandler(resp http.ResponseWriter, req *http.Request)

StartCPUProfileHandler starts a CPU profile session

func (*API) StopCPUProfileHandler

func (api *API) StopCPUProfileHandler(resp http.ResponseWriter, req *http.Request)

StopCPUProfileHandler stops a CPU profile session

type DPIDMapping

type DPIDMapping struct {
	Action MappingAction
	DPID   uint64
	Inject injector.Injector
}

DPIDMapping is used to associate a DPID with an injecting packet processor

type DevicesResponse

type DevicesResponse struct {
	Devices []string `json:"devices"`
}

DevicesResponse is used to create a HTTP response that lists all the known DPIDs

type MappingAction

type MappingAction uint8

MappingAction defines DPID mapping actions

const (
	// MapActionNone no op action
	MapActionNone MappingAction = 0x0
	// MapActionAdd indicates addition of mapping
	MapActionAdd MappingAction = 1 << 0
	// MapActionDelete indicated deletion of mapping
	MapActionDelete MappingAction = 1 << 1
)

Jump to

Keyboard shortcuts

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