segment

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PathStepWithIALen = 2 + 2 + 8

PathStepWithIALen amounts for Ingress+Egress+IA.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanupReq

type CleanupReq struct {
	Request
}

CleanupReq is used to clean an index.

type Index

type Index struct {
	Idx        reservation.IndexNumber
	Expiration time.Time

	MinBW   reservation.BWCls
	MaxBW   reservation.BWCls
	AllocBW reservation.BWCls
	Token   *reservation.Token
	// contains filtered or unexported fields
}

Index is a segment reservation index.

func NewIndex

func NewIndex(idx reservation.IndexNumber, expiration time.Time, state IndexState,
	minBW, maxBW, allocBW reservation.BWCls, token *reservation.Token) *Index

NewIndex creates a new Index without yet linking it to any reservation.

func (*Index) State

func (index *Index) State() IndexState

State returns the read-only state.

type IndexConfirmationReq

type IndexConfirmationReq struct {
	Request
	State IndexState
}

IndexConfirmationReq is used to change the state on an index (e.g. from temporary to pending).

type IndexState

type IndexState uint8
const (
	IndexTemporary IndexState = iota
	IndexPending              // the index is confirmed, but not yet activated.
	IndexActive
)

possible states of a segment reservation index.

type Indices

type Indices []Index

Indices is a collection of Index that implements IndicesInterface.

func (Indices) GetAllocBW

func (idxs Indices) GetAllocBW(i int) reservation.BWCls

func (Indices) GetExpiration

func (idxs Indices) GetExpiration(i int) time.Time

func (Indices) GetIndexNumber

func (idxs Indices) GetIndexNumber(i int) reservation.IndexNumber

func (Indices) GetToken

func (idxs Indices) GetToken(i int) *reservation.Token

func (Indices) Len

func (idxs Indices) Len() int

func (Indices) Rotate

func (idxs Indices) Rotate(i int) base.IndicesInterface

type PathStep

type PathStep struct {
	Ingress uint16
	Egress  uint16
}

PathStep is one hop of the ReservationTransparentPath. For a source AS Ingress will be invalid. Conversely for dst.

type PathStepWithIA

type PathStepWithIA struct {
	PathStep
	IA addr.IA
}

PathStepWithIA is a step in a reservation path as seen from the source AS.

func (*PathStepWithIA) String

func (s *PathStepWithIA) String() string

type Request

type Request struct {
	base.RequestMetadata                         // information about the request (forwarding path)
	ID                   reservation.SegmentID   // the ID this request refers to
	Index                reservation.IndexNumber // the index this request refers to
	Timestamp            time.Time               // the mandatory timestamp
	Ingress              uint16                  // the interface the traffic uses to enter the AS
	Egress               uint16                  // the interface the traffic uses to leave the AS
	Reservation          *Reservation            // nil if no reservation yet
}

Request is the base struct for any type of COLIBRI segment request. It contains a reference to the reservation it requests, or nil if not yet created.

func NewRequest

NewRequest constructs the segment Request type.

type Reservation

type Reservation struct {
	ID      reservation.SegmentID
	Indices Indices // existing indices in this reservation

	Ingress      uint16                     // igress interface ID: reservation packets enter
	Egress       uint16                     // egress interface ID: reservation packets leave
	Path         ReservationTransparentPath // empty if not at the source of the reservation
	PathType     reservation.PathType       // the type of path (up,core,down)
	PathEndProps reservation.PathEndProps   // the properties for stitching and start/end
	TrafficSplit reservation.SplitCls       // the traffic split between control and data planes
	// contains filtered or unexported fields
}

Reservation represents a segment reservation.

func NewReservation

func NewReservation() *Reservation

func (*Reservation) ActiveIndex

func (r *Reservation) ActiveIndex() *Index

ActiveIndex returns the currently active Index for this reservation, or nil if none.

func (*Reservation) Index

func (r *Reservation) Index(idx reservation.IndexNumber) *Index

Index finds the Index with that IndexNumber and returns a pointer to it.

func (*Reservation) MaxBlockedBW

func (r *Reservation) MaxBlockedBW() uint64

MaxBlockedBW returns the maximum bandwidth blocked by this reservation, which is the same as the maximum allocated bandwidth indicated by its indices.

func (*Reservation) MaxRequestedBW

func (r *Reservation) MaxRequestedBW() uint64

MaxRequestedBW returns the maximum bandwidth requested by this reservation.

func (*Reservation) NewIndexAtSource

func (r *Reservation) NewIndexAtSource(expTime time.Time, minBW, maxBW, allocBW reservation.BWCls,
	rlc reservation.RLC, pathType reservation.PathType) (reservation.IndexNumber, error)

NewIndexAtSource creates a new index. The associated token is created from the arguments, and automatically linked to the index. This function should be called only from the AS originating the reservation. The expiration times must always be greater or equal than those in previous indices.

func (*Reservation) NewIndexFromToken

func (r *Reservation) NewIndexFromToken(tok *reservation.Token, minBW, maxBW reservation.BWCls) (
	reservation.IndexNumber, error)

NewIndexFromToken creates a new index. The token argument is used to populate several fields of the index. The token is not stored (on-path ASes don't need the token). This function should be called from an AS that is on the reservation path but not the originating one.

func (*Reservation) RemoveIndex

func (r *Reservation) RemoveIndex(idx reservation.IndexNumber) error

RemoveIndex removes all indices from the beginning until this one, inclusive.

func (*Reservation) SetIndexActive

func (r *Reservation) SetIndexActive(idx reservation.IndexNumber) error

SetIndexActive sets the index as active. If the reservation had already an active state, it will remove all previous indices.

func (*Reservation) SetIndexConfirmed

func (r *Reservation) SetIndexConfirmed(idx reservation.IndexNumber) error

SetIndexConfirmed sets the index as IndexPending (confirmed but not active). If the requested index has state active, it will emit an error.

func (*Reservation) Validate

func (r *Reservation) Validate() error

Validate will return an error for invalid values.

type ReservationTransparentPath

type ReservationTransparentPath []PathStepWithIA

ReservationTransparentPath represents a reservation path, in the reservation order. This path is seen only in the source of a segment reservation. TODO(juagargi) there exists a ColibriPath that could be used instead, if we only need equality. If we need to know the IDs of the transit ASes, it won't be possible.

func NewPathFromRaw

func NewPathFromRaw(buff []byte) (ReservationTransparentPath, error)

NewPathFromRaw constructs a new Path from the byte representation.

func (ReservationTransparentPath) Equal

Equal returns true if both ReservationTransparentPath contain the same values.

func (ReservationTransparentPath) GetDstIA

func (p ReservationTransparentPath) GetDstIA() addr.IA

GetDstIA returns the source IA in the path or a zero IA if the path is nil (it's not the source AS of the reservation and has no access to the path of the reservation). If the path is not nil, it assumes is valid, i.e. it has at least length 2.

func (ReservationTransparentPath) GetSrcIA

func (p ReservationTransparentPath) GetSrcIA() addr.IA

GetSrcIA returns the source IA in the path or a zero IA if the path is nil (it's not the source AS of the reservation and has no access to the path of the reservation). If the Path is not nil, it assumes is valid, i.e. it has at least length 2.

func (ReservationTransparentPath) Len

Len returns the length of this path in bytes, when serialized.

func (ReservationTransparentPath) Read

func (p ReservationTransparentPath) Read(buff []byte) (int, error)

func (ReservationTransparentPath) String

func (ReservationTransparentPath) ToRaw

func (p ReservationTransparentPath) ToRaw() []byte

ToRaw returns a buffer representing this ReservationTransparentPath.

func (ReservationTransparentPath) Validate

func (p ReservationTransparentPath) Validate() error

Validate returns an error if there is invalid data.

type Response

type Response struct {
	base.RequestMetadata                         // information about the request (forwarding path)
	ID                   reservation.SegmentID   // the ID this request refers to
	Index                reservation.IndexNumber // the index this request refers to
	Accepted             bool                    // success or failure type of response
	FailedHop            uint8                   // if accepted is false, the AS that failed it
}

Response is the base struct for any type of COLIBRI segment response.

func NewResponse

func NewResponse(ts time.Time, id *reservation.SegmentID, idx reservation.IndexNumber,
	path base.ColibriPath, accepted bool, failedHop uint8) (*Response, error)

NewResponse contructs the segment Response type.

type ResponseCleanupFailure

type ResponseCleanupFailure struct {
	Response
	ErrorCode uint8
}

ResponseCleanupFailure is a failed index cleanup.

type ResponseCleanupSuccess

type ResponseCleanupSuccess struct {
	Response
}

ResponseCleanupSuccess is a response to a successful cleanup request.

type ResponseIndexConfirmationFailure

type ResponseIndexConfirmationFailure struct {
	Response
	ErrorCode uint8
}

ResponseIndexConfirmationFailure is a failed index confirmation.

type ResponseIndexConfirmationSuccess

type ResponseIndexConfirmationSuccess struct {
	Response
	State IndexState
}

ResponseIndexConfirmationSuccess is a successful index confirmation. The target state is echoed in the response.

type ResponseSetupFailure

type ResponseSetupFailure struct {
	Response
	FailedSetup *SetupReq
}

ResponseSetupFailure is the response to a failed setup. It's sent on the reverse direction.

type ResponseSetupSuccess

type ResponseSetupSuccess struct {
	Response
	Token reservation.Token
}

ResponseSetupSuccess is the response to a success setup. It's sent on the reverse direction.

type ResponseTeardownFailure

type ResponseTeardownFailure struct {
	Response
	ErrorCode uint8
}

ResponseTeardownFailure is sent in the reverse path.

type ResponseTeardownSuccess

type ResponseTeardownSuccess struct {
	Response
}

ResponseTeardownSuccess is sent by the last AS in the reverse path.

type SetupReq

type SetupReq struct {
	Request
	InfoField  reservation.InfoField
	MinBW      reservation.BWCls
	MaxBW      reservation.BWCls
	SplitCls   reservation.SplitCls
	PathProps  reservation.PathEndProps
	AllocTrail reservation.AllocationBeads
}

SetupReq is a segment reservation setup request. This same type is used for renewal of the segment reservation.

type SetupTelesReq

type SetupTelesReq struct {
	SetupReq
	BaseID reservation.SegmentID
}

SetupTelesReq represents a telescopic segment setup.

type TeardownReq

type TeardownReq struct {
	Request
}

TeardownReq requests the AS to remove a given index from the DB. If this is the last index in the reservation, the reservation will be completely removed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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