api

package
v0.0.0-...-2820c43 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQ_NEIGHBOR
	REQ_NEIGHBORS
	REQ_ADJ_RIB_IN
	REQ_ADJ_RIB_OUT
	REQ_LOCAL_RIB
	REQ_NEIGHBOR_SHUTDOWN
	REQ_NEIGHBOR_RESET
	REQ_NEIGHBOR_SOFT_RESET
	REQ_NEIGHBOR_SOFT_RESET_IN
	REQ_NEIGHBOR_SOFT_RESET_OUT
)
View Source
const (
	BASE_VERSION = "/v1"
	NEIGHBOR     = "/bgp/neighbor"
	NEIGHBORS    = "/bgp/neighbors"

	PARAM_REMOTE_PEER_ADDR = "remotePeerAddr"
	STATS                  = "/stats"
)
View Source
const REST_PORT = 8080

Variables

This section is empty.

Functions

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, r *http.Request)

Types

type RestRequest

type RestRequest struct {
	RequestType int
	RemoteAddr  string
	ResponseCh  chan *RestResponse
	Err         error
}

func NewRestRequest

func NewRestRequest(reqType int, remoteAddr string) *RestRequest

type RestResponse

type RestResponse struct {
	ResponseErr error
	Data        []byte
}

func (*RestResponse) Err

func (r *RestResponse) Err() error

type RestServer

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

func NewRestServer

func NewRestServer(port int, bgpServerCh chan *RestRequest) *RestServer

func (*RestServer) Neighbor

func (rs *RestServer) Neighbor(w http.ResponseWriter, r *http.Request)

func (*RestServer) NeighborAdjRibIn

func (rs *RestServer) NeighborAdjRibIn(w http.ResponseWriter, r *http.Request)

func (*RestServer) NeighborAdjRibOut

func (rs *RestServer) NeighborAdjRibOut(w http.ResponseWriter, r *http.Request)

func (*RestServer) NeighborLocalRib

func (rs *RestServer) NeighborLocalRib(w http.ResponseWriter, r *http.Request)

func (*RestServer) NeighborPostHandler

func (rs *RestServer) NeighborPostHandler(w http.ResponseWriter, r *http.Request)

func (*RestServer) Neighbors

func (rs *RestServer) Neighbors(w http.ResponseWriter, r *http.Request)

func (*RestServer) Serve

func (rs *RestServer) Serve()

Main thread of rest service. URL than can receive.

get state of neighbors.
  -- curl -i -X GET http://<ownIP>:8080/v1/bgp/neighbors
get state of neighbor.
  -- curl -i -X GET http://<ownIP>:8080/v1/bgp/neighbor/<remote address of target neighbor>
get adj-rib-in of each neighbor.
  -- curl -i -X GET http://<ownIP>:8080/v1/bgp/neighbor/<remote address of target neighbor>/adj-rib-in
get adj-rib-out of each neighbor.
  -- curl -i -X GET http://<ownIP>:8080/v1/bgp/neighbor/<remote address of target neighbor>/adj-rib-out
get local-rib of each neighbor.
  -- curl -i -X GET http://<ownIP>:8080/v1/bgp/neighbor/<remote address of target neighbor>/local-rib

Jump to

Keyboard shortcuts

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