api

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InterfaceKind              = reflect.TypeOf(Interface{}).Name()
	InterfaceListKind          = reflect.TypeOf(InterfaceList{}).Name()
	LoadBalancerKind           = reflect.TypeOf(LoadBalancer{}).Name()
	LoadBalancerTargetKind     = reflect.TypeOf(LoadBalancerTarget{}).Name()
	LoadBalancerTargetListKind = reflect.TypeOf(LoadBalancerTargetList{}).Name()
	LoadBalancerPrefixKind     = reflect.TypeOf(LoadBalancerPrefix{}).Name()
	PrefixKind                 = reflect.TypeOf(Prefix{}).Name()
	PrefixListKind             = reflect.TypeOf(PrefixList{}).Name()
	VirtualIPKind              = reflect.TypeOf(VirtualIP{}).Name()
	RouteKind                  = reflect.TypeOf(Route{}).Name()
	RouteListKind              = reflect.TypeOf(RouteList{}).Name()
	NatKind                    = reflect.TypeOf(Nat{}).Name()
	NatListKind                = reflect.TypeOf(NatList{}).Name()
	NeighborNatKind            = reflect.TypeOf(NeighborNat{}).Name()
	FirewallRuleKind           = reflect.TypeOf(FirewallRule{}).Name()
	FirewallRuleListKind       = reflect.TypeOf(FirewallRuleList{}).Name()
	InitializedKind            = reflect.TypeOf(Initialized{}).Name()
	VniKind                    = reflect.TypeOf(Vni{}).Name()
	VersionKind                = reflect.TypeOf(Version{}).Name()
	CaptureStartKind           = reflect.TypeOf(CaptureStart{}).Name()
	CaptureStopKind            = reflect.TypeOf(CaptureStop{}).Name()
	CaptureStatusKind          = reflect.TypeOf(CaptureStatus{}).Name()
)

Functions

func CaptureIfaceTypeToProtoIfaceType

func CaptureIfaceTypeToProtoIfaceType(interfaceType string) (proto.CaptureInterfaceType, error)

func FillCaptureIfaceInfo

func FillCaptureIfaceInfo(interfaceInfo string, request *proto.CapturedInterface) error

func InterfaceMeteringParamsToProtoMeteringParams added in v0.3.1

func InterfaceMeteringParamsToProtoMeteringParams(meteringParams *MeteringParams) *proto.MeteringParams

func NetIPAddrToProtoIPConfig

func NetIPAddrToProtoIPConfig(addr *netip.Addr) *proto.IpConfig

func NetIPAddrToProtoIPVersion

func NetIPAddrToProtoIPVersion(addr *netip.Addr) proto.IpVersion

func NetIPAddrToProtoIpAddress

func NetIPAddrToProtoIpAddress(addr *netip.Addr) *proto.IpAddress

func ProtoIfaceInfoToCaptureIfaceInfo

func ProtoIfaceInfoToCaptureIfaceInfo(request *proto.CapturedInterface) (string, error)

func ProtoIfaceTypeToCaptureIfaceType

func ProtoIfaceTypeToCaptureIfaceType(interfaceType proto.CaptureInterfaceType) (string, error)

func ProtoIpAddressToNetIPAddr

func ProtoIpAddressToNetIPAddr(protoIP *proto.IpAddress) (*netip.Addr, error)

func ProtoLBPrefixToProtoPrefix

func ProtoLBPrefixToProtoPrefix(lbprefix *proto.Prefix) *proto.Prefix

Types

type CaptureConfig

type CaptureConfig struct {
	SinkNodeIP *netip.Addr `json:"sink_node_ipv6,omitempty"`
	UdpSrcPort uint32      `json:"udp_src_port,omitempty"`
	UdpDstPort uint32      `json:"udp_dst_port,omitempty"`
}

type CaptureGetStatusSpec

type CaptureGetStatusSpec struct {
	OperationStatus bool               `json:"operation_status"`
	Config          CaptureConfig      `json:"capture_config"`
	Interfaces      []CaptureInterface `json:"interfaces,omitempty"`
}

type CaptureInterface

type CaptureInterface struct {
	InterfaceType string `json:"interface_type"`
	InterfaceInfo string `json:"interface_info"`
}

type CaptureStart

type CaptureStart struct {
	TypeMeta         `json:",inline"`
	CaptureStartMeta `json:"metadata"`
	Spec             CaptureStartSpec `json:"spec"`
	Status           Status           `json:"status"`
}

func (*CaptureStart) GetStatus

func (m *CaptureStart) GetStatus() Status

type CaptureStartMeta

type CaptureStartMeta struct {
	Config *CaptureConfig `json:"capture_config"`
}

func (*CaptureStartMeta) GetName

func (m *CaptureStartMeta) GetName() string

type CaptureStartSpec

type CaptureStartSpec struct {
	Interfaces []CaptureInterface `json:"interfaces,omitempty"`
}

type CaptureStatus

type CaptureStatus struct {
	TypeMeta          `json:",inline"`
	CaptureStatusMeta `json:"metadata"`
	Spec              CaptureGetStatusSpec `json:"spec"`
	Status            Status               `json:"status"`
}

func (*CaptureStatus) GetStatus

func (m *CaptureStatus) GetStatus() Status

type CaptureStatusMeta

type CaptureStatusMeta struct {
}

func (*CaptureStatusMeta) GetName

func (m *CaptureStatusMeta) GetName() string

type CaptureStop

type CaptureStop struct {
	TypeMeta        `json:",inline"`
	CaptureStopMeta `json:"metadata"`
	Spec            CaptureStopSpec `json:"spec"`
	Status          Status          `json:"status"`
}

func (*CaptureStop) GetStatus

func (m *CaptureStop) GetStatus() Status

type CaptureStopMeta

type CaptureStopMeta struct {
}

func (*CaptureStopMeta) GetName

func (m *CaptureStopMeta) GetName() string

type CaptureStopSpec

type CaptureStopSpec struct {
	InterfaceCount uint32 `json:"iface_cnt"`
}

type FirewallRule

type FirewallRule struct {
	TypeMeta         `json:",inline"`
	FirewallRuleMeta `json:"metadata"`
	Spec             FirewallRuleSpec `json:"spec"`
	Status           Status           `json:"status"`
}

FirewallRule section

func ProtoFwRuleToFwRule

func ProtoFwRuleToFwRule(dpdkFwRule *proto.FirewallRule, interfaceID string) (*FirewallRule, error)

func (*FirewallRule) GetName

func (m *FirewallRule) GetName() string

func (*FirewallRule) GetStatus

func (m *FirewallRule) GetStatus() Status

type FirewallRuleList

type FirewallRuleList struct {
	TypeMeta             `json:",inline"`
	FirewallRuleListMeta `json:"metadata"`
	Status               Status         `json:"status"`
	Items                []FirewallRule `json:"items"`
}

func (*FirewallRuleList) GetItems

func (l *FirewallRuleList) GetItems() []Object

func (*FirewallRuleList) GetStatus

func (m *FirewallRuleList) GetStatus() Status

type FirewallRuleListMeta

type FirewallRuleListMeta struct {
	InterfaceID string `json:"interface_id"`
}

type FirewallRuleMeta

type FirewallRuleMeta struct {
	InterfaceID string `json:"interface_id"`
}

type FirewallRuleSpec

type FirewallRuleSpec struct {
	RuleID            string                `json:"id"`
	TrafficDirection  string                `json:"direction,omitempty"`
	FirewallAction    string                `json:"action,omitempty"`
	Priority          uint32                `json:"priority"`
	SourcePrefix      *netip.Prefix         `json:"source_prefix,omitempty"`
	DestinationPrefix *netip.Prefix         `json:"destination_prefix,omitempty"`
	ProtocolFilter    *proto.ProtocolFilter `json:"protocol_filter,omitempty"`
}

type Initialized

type Initialized struct {
	TypeMeta        `json:",inline"`
	InitializedMeta `json:"metadata"`
	Spec            InitializedSpec `json:"spec"`
	Status          Status          `json:"status"`
}

Initialized section

func (*Initialized) GetStatus

func (m *Initialized) GetStatus() Status

type InitializedMeta

type InitializedMeta struct {
}

func (*InitializedMeta) GetName

func (m *InitializedMeta) GetName() string

type InitializedSpec

type InitializedSpec struct {
	UUID string `json:"uuid"`
}

type Interface

type Interface struct {
	TypeMeta      `json:",inline"`
	InterfaceMeta `json:"metadata"`
	Spec          InterfaceSpec `json:"spec"`
	Status        Status        `json:"status"`
}

Interface section

func ProtoInterfaceToInterface

func ProtoInterfaceToInterface(dpdkIface *proto.Interface) (*Interface, error)

func (*Interface) GetStatus

func (m *Interface) GetStatus() Status

type InterfaceList

type InterfaceList struct {
	TypeMeta          `json:",inline"`
	InterfaceListMeta `json:"metadata"`
	Status            Status      `json:"status"`
	Items             []Interface `json:"items"`
}

func (*InterfaceList) GetItems

func (l *InterfaceList) GetItems() []Object

func (*InterfaceList) GetStatus

func (m *InterfaceList) GetStatus() Status

type InterfaceListMeta

type InterfaceListMeta struct {
}

type InterfaceMeta

type InterfaceMeta struct {
	ID string `json:"id"`
}

func (*InterfaceMeta) GetName

func (m *InterfaceMeta) GetName() string

type InterfaceSpec

type InterfaceSpec struct {
	VNI             uint32           `json:"vni"`
	Device          string           `json:"device,omitempty"`
	IPv4            *netip.Addr      `json:"primary_ipv4,omitempty"`
	IPv6            *netip.Addr      `json:"primary_ipv6,omitempty"`
	UnderlayRoute   *netip.Addr      `json:"underlay_route,omitempty"`
	VirtualFunction *VirtualFunction `json:"virtual_function,omitempty"`
	PXE             *PXE             `json:"pxe,omitempty"`
	Nat             *Nat             `json:"-"`
	VIP             *VirtualIP       `json:"-"`
	Metering        *MeteringParams  `json:"metering,omitempty"`
}

type LBPort

type LBPort struct {
	Protocol uint32 `json:"protocol"`
	Port     uint32 `json:"port"`
}

func StringLbportToLbport

func StringLbportToLbport(lbport string) (LBPort, error)

type List

type List interface {
	GetItems() []Object
	GetStatus() Status
}

type LoadBalancer

type LoadBalancer struct {
	TypeMeta         `json:",inline"`
	LoadBalancerMeta `json:"metadata"`
	Spec             LoadBalancerSpec `json:"spec"`
	Status           Status           `json:"status"`
}

LoadBalancer section

func ProtoLoadBalancerToLoadBalancer

func ProtoLoadBalancerToLoadBalancer(dpdkLB *proto.GetLoadBalancerResponse, lbID string) (*LoadBalancer, error)

func (*LoadBalancer) GetStatus

func (m *LoadBalancer) GetStatus() Status

type LoadBalancerMeta

type LoadBalancerMeta struct {
	ID string `json:"id"`
}

func (*LoadBalancerMeta) GetName

func (m *LoadBalancerMeta) GetName() string

type LoadBalancerPrefix

type LoadBalancerPrefix struct {
	TypeMeta               `json:",inline"`
	LoadBalancerPrefixMeta `json:"metadata"`
	Spec                   LoadBalancerPrefixSpec `json:"spec"`
	Status                 Status                 `json:"status"`
}

func (*LoadBalancerPrefix) GetName

func (m *LoadBalancerPrefix) GetName() string

func (*LoadBalancerPrefix) GetStatus

func (m *LoadBalancerPrefix) GetStatus() Status

type LoadBalancerPrefixMeta

type LoadBalancerPrefixMeta struct {
	InterfaceID string `json:"interface_id"`
}

type LoadBalancerPrefixSpec

type LoadBalancerPrefixSpec struct {
	Prefix        netip.Prefix `json:"prefix"`
	UnderlayRoute *netip.Addr  `json:"underlay_route,omitempty"`
}

type LoadBalancerSpec

type LoadBalancerSpec struct {
	VNI           uint32      `json:"vni"`
	LbVipIP       *netip.Addr `json:"loadbalanced_ip,omitempty"`
	Lbports       []LBPort    `json:"loadbalanced_ports,omitempty"`
	UnderlayRoute *netip.Addr `json:"underlay_route,omitempty"`
}

type LoadBalancerTarget

type LoadBalancerTarget struct {
	TypeMeta               `json:",inline"`
	LoadBalancerTargetMeta `json:"metadata"`
	Spec                   LoadBalancerTargetSpec `json:"spec"`
	Status                 Status                 `json:"status"`
}

func (*LoadBalancerTarget) GetName

func (m *LoadBalancerTarget) GetName() string

func (*LoadBalancerTarget) GetStatus

func (m *LoadBalancerTarget) GetStatus() Status

type LoadBalancerTargetList

type LoadBalancerTargetList struct {
	TypeMeta                   `json:",inline"`
	LoadBalancerTargetListMeta `json:"metadata"`
	Status                     Status               `json:"status"`
	Items                      []LoadBalancerTarget `json:"items"`
}

func (*LoadBalancerTargetList) GetItems

func (l *LoadBalancerTargetList) GetItems() []Object

func (*LoadBalancerTargetList) GetStatus

func (m *LoadBalancerTargetList) GetStatus() Status

type LoadBalancerTargetListMeta

type LoadBalancerTargetListMeta struct {
	LoadBalancerID string `json:"loadbalancer_id"`
}

type LoadBalancerTargetMeta

type LoadBalancerTargetMeta struct {
	LoadbalancerID string `json:"loadbalancer_id"`
}

type LoadBalancerTargetSpec

type LoadBalancerTargetSpec struct {
	TargetIP *netip.Addr `json:"target_ip,omitempty"`
}

type MeteringParams added in v0.3.1

type MeteringParams struct {
	TotalRate  uint64 `json:"total_rate,omitempty"`
	PublicRate uint64 `json:"public_rate,omitempty"`
}

func ProtoMeteringParamsToInterfaceMeteringParams added in v0.3.1

func ProtoMeteringParamsToInterfaceMeteringParams(meteringParams *proto.MeteringParams) *MeteringParams

type Nat

type Nat struct {
	TypeMeta `json:",inline"`
	NatMeta  `json:"metadata"`
	Spec     NatSpec `json:"spec"`
	Status   Status  `json:"status"`
}

NAT section

func ProtoNatToNat

func ProtoNatToNat(dpdkNat *proto.GetNatResponse, interfaceID string) (*Nat, error)

func (*Nat) GetStatus

func (m *Nat) GetStatus() Status

func (*Nat) String

func (m *Nat) String() string

type NatList

type NatList struct {
	TypeMeta    `json:",inline"`
	NatListMeta `json:"metadata"`
	Status      Status `json:"status"`
	Items       []Nat  `json:"items"`
}

func (*NatList) GetItems

func (l *NatList) GetItems() []Object

func (*NatList) GetStatus

func (m *NatList) GetStatus() Status

type NatListMeta

type NatListMeta struct {
	NatIP   *netip.Addr `json:"nat_ip,omitempty"`
	NatType string      `json:"nat_type,omitempty"`
}

type NatMeta

type NatMeta struct {
	InterfaceID string `json:"interface_id,omitempty"`
}

func (*NatMeta) GetName

func (m *NatMeta) GetName() string

type NatSpec

type NatSpec struct {
	NatIP         *netip.Addr `json:"nat_ip,omitempty"`
	MinPort       uint32      `json:"min_port"`
	MaxPort       uint32      `json:"max_port"`
	UnderlayRoute *netip.Addr `json:"underlay_route,omitempty"`
	Vni           uint32      `json:"vni"`
}

type NeighborNat

type NeighborNat struct {
	TypeMeta        `json:",inline"`
	NeighborNatMeta `json:"metadata"`
	Spec            NeighborNatSpec `json:"spec"`
	Status          Status          `json:"status"`
}

func (*NeighborNat) GetStatus

func (m *NeighborNat) GetStatus() Status

type NeighborNatMeta

type NeighborNatMeta struct {
	NatIP *netip.Addr `json:"nat_ip"`
}

func (*NeighborNatMeta) GetName

func (m *NeighborNatMeta) GetName() string

type NeighborNatSpec

type NeighborNatSpec struct {
	Vni           uint32      `json:"vni"`
	MinPort       uint32      `json:"min_port"`
	MaxPort       uint32      `json:"max_port"`
	UnderlayRoute *netip.Addr `json:"underlay_route,omitempty"`
}

type Object

type Object interface {
	GetKind() string
	GetName() string
	GetStatus() Status
}

type PXE

type PXE struct {
	Server   string `json:"next_server,omitempty"`
	FileName string `json:"boot_filename,omitempty"`
}

type Prefix

type Prefix struct {
	TypeMeta   `json:",inline"`
	PrefixMeta `json:"metadata"`
	Spec       PrefixSpec `json:"spec"`
	Status     Status     `json:"status"`
}

func ProtoPrefixToPrefix

func ProtoPrefixToPrefix(interfaceID string, dpdkPrefix *proto.Prefix) (*Prefix, error)

func (*Prefix) GetName

func (m *Prefix) GetName() string

func (*Prefix) GetStatus

func (m *Prefix) GetStatus() Status

type PrefixList

type PrefixList struct {
	TypeMeta       `json:",inline"`
	PrefixListMeta `json:"metadata"`
	Status         Status   `json:"status"`
	Items          []Prefix `json:"items"`
}

Prefix section

func (*PrefixList) GetItems

func (l *PrefixList) GetItems() []Object

func (*PrefixList) GetStatus

func (m *PrefixList) GetStatus() Status

type PrefixListMeta

type PrefixListMeta struct {
	InterfaceID string `json:"interface_id"`
}

type PrefixMeta

type PrefixMeta struct {
	InterfaceID string `json:"interface_id"`
}

type PrefixSpec

type PrefixSpec struct {
	Prefix        netip.Prefix `json:"prefix"`
	UnderlayRoute *netip.Addr  `json:"underlay_route,omitempty"`
}

type Route

type Route struct {
	TypeMeta  `json:",inline"`
	RouteMeta `json:"metadata"`
	Spec      RouteSpec `json:"spec"`
	Status    Status    `json:"status"`
}

func ProtoRouteToRoute

func ProtoRouteToRoute(vni uint32, dpdkRoute *proto.Route) (*Route, error)

func (*Route) GetName

func (m *Route) GetName() string

func (*Route) GetStatus

func (m *Route) GetStatus() Status

type RouteList

type RouteList struct {
	TypeMeta      `json:",inline"`
	RouteListMeta `json:"metadata"`
	Status        Status  `json:"status"`
	Items         []Route `json:"items"`
}

Route section

func (*RouteList) GetItems

func (l *RouteList) GetItems() []Object

func (*RouteList) GetStatus

func (m *RouteList) GetStatus() Status

type RouteListMeta

type RouteListMeta struct {
	VNI uint32 `json:"vni"`
}

type RouteMeta

type RouteMeta struct {
	VNI uint32 `json:"vni"`
}

type RouteNextHop

type RouteNextHop struct {
	VNI uint32      `json:"vni"`
	IP  *netip.Addr `json:"address,omitempty"`
}

type RouteSpec

type RouteSpec struct {
	Prefix  *netip.Prefix `json:"prefix,omitempty"`
	NextHop *RouteNextHop `json:"next_hop,omitempty"`
}

type Status

type Status struct {
	Code    uint32 `json:"code"`
	Message string `json:"message"`
}

func ProtoStatusToStatus

func ProtoStatusToStatus(dpdkStatus *proto.Status) Status

func (*Status) String

func (status *Status) String() string

type TypeMeta

type TypeMeta struct {
	Kind string `json:"kind"`
}

func (*TypeMeta) GetKind

func (m *TypeMeta) GetKind() string

type Version

type Version struct {
	TypeMeta    `json:",inline"`
	VersionMeta `json:"metadata"`
	Spec        VersionSpec `json:"spec"`
	Status      Status      `json:"status"`
}

Version section

func (*Version) GetStatus

func (m *Version) GetStatus() Status

type VersionMeta

type VersionMeta struct {
	ClientProtocol string `json:"client_protocol"`
	ClientName     string `json:"client_name"`
	ClientVersion  string `json:"client_version"`
}

func (*VersionMeta) GetName

func (m *VersionMeta) GetName() string

type VersionSpec

type VersionSpec struct {
	ServiceProtocol string `json:"service_protocol"`
	ServiceVersion  string `json:"service_version"`
}

type VirtualFunction

type VirtualFunction struct {
	Name string `json:"name"`
}

type VirtualIP

type VirtualIP struct {
	TypeMeta      `json:",inline"`
	VirtualIPMeta `json:"metadata"`
	Spec          VirtualIPSpec `json:"spec"`
	Status        Status        `json:"status"`
}

VirtualIP section

func ProtoVirtualIPToVirtualIP

func ProtoVirtualIPToVirtualIP(interfaceID string, dpdkVIP *proto.GetVipResponse) (*VirtualIP, error)

func (*VirtualIP) GetName

func (m *VirtualIP) GetName() string

func (*VirtualIP) GetStatus

func (m *VirtualIP) GetStatus() Status

type VirtualIPMeta

type VirtualIPMeta struct {
	InterfaceID string `json:"interface_id"`
}

type VirtualIPSpec

type VirtualIPSpec struct {
	IP            *netip.Addr `json:"vip_ip"`
	UnderlayRoute *netip.Addr `json:"underlay_route,omitempty"`
}

type Vni

type Vni struct {
	TypeMeta `json:",inline"`
	VniMeta  `json:"metadata"`
	Spec     VniSpec `json:"spec"`
	Status   Status  `json:"status"`
}

VNI section

func (*Vni) GetStatus

func (m *Vni) GetStatus() Status

type VniMeta

type VniMeta struct {
	VNI     uint32 `json:"vni"`
	VniType uint8  `json:"vni_type"`
}

func (*VniMeta) GetName

func (m *VniMeta) GetName() string

type VniSpec

type VniSpec struct {
	InUse bool `json:"in_use"`
}

Jump to

Keyboard shortcuts

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