translib

package
v0.0.0-...-562cd84 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TABLE_SEPARATOR          = "|"
	KEY_SEPARATOR            = "|"
	ACL_TABLE                = "ACL_TABLE"
	RULE_TABLE               = "ACL_RULE"
	ACL_COUNTERS             = "ACL_COUNTERS"
	ACL_TYPE                 = "type"
	ACL_DESCRIPTION          = "policy_desc"
	SONIC_ACL_TYPE_L2        = "L2"
	SONIC_ACL_TYPE_IPV4      = "L3"
	SONIC_ACL_TYPE_IPV6      = "L3V6"
	OPENCONFIG_ACL_TYPE_IPV4 = "ACL_IPV4"
	OPENCONFIG_ACL_TYPE_IPV6 = "ACL_IPV6"
	OPENCONFIG_ACL_TYPE_L2   = "ACL_L2"
	OC_ACL_APP_MODULE_NAME   = "/openconfig-acl:acl"
	OC_ACL_YANG_PATH_PREFIX  = "/device/acl"

	MIN_PRIORITY = 1
	MAX_PRIORITY = 65536
)
View Source
const (
	LLDP_REMOTE_CAP_ENABLED      = "lldp_rem_sys_cap_enabled"
	LLDP_REMOTE_SYS_NAME         = "lldp_rem_sys_name"
	LLDP_REMOTE_PORT_DESC        = "lldp_rem_port_desc"
	LLDP_REMOTE_CHASS_ID         = "lldp_rem_chassis_id"
	LLDP_REMOTE_CAP_SUPPORTED    = "lldp_rem_sys_cap_supported"
	LLDP_REMOTE_PORT_ID_SUBTYPE  = "lldp_rem_port_id_subtype"
	LLDP_REMOTE_SYS_DESC         = "lldp_rem_sys_desc"
	LLDP_REMOTE_REM_TIME         = "lldp_rem_time_mark"
	LLDP_REMOTE_PORT_ID          = "lldp_rem_port_id"
	LLDP_REMOTE_REM_ID           = "lldp_rem_index"
	LLDP_REMOTE_CHASS_ID_SUBTYPE = "lldp_rem_chassis_id_subtype"
	LLDP_REMOTE_MAN_ADDR         = "lldp_rem_man_addr"
)
View Source
const (
	GET = 1 + iota
	CREATE
	REPLACE
	UPDATE
	DELETE
)
View Source
const (
	STP_GLOBAL_TABLE         = "STP"
	STP_VLAN_TABLE           = "STP_VLAN"
	STP_VLAN_PORT_TABLE      = "STP_VLAN_PORT"
	STP_PORT_TABLE           = "STP_PORT"
	STP_VLAN_OPER_TABLE      = "_STP_VLAN_TABLE"
	STP_VLAN_PORT_OPER_TABLE = "_STP_VLAN_PORT_TABLE"
	STP_PORT_OPER_TABLE      = "_STP_PORT_TABLE"
	STP_MODE                 = "mode"
	OC_STP_APP_MODULE_NAME   = "/openconfig-spanning-tree:stp"
	OC_STP_YANG_PATH_PREFIX  = "/device/stp"
	PVST_MAX_INSTANCES       = 255

	STP_DEFAULT_ROOT_GUARD_TIMEOUT = "30"
	STP_DEFAULT_FORWARD_DELAY      = "15"
	STP_DEFAULT_HELLO_INTERVAL     = "2"
	STP_DEFAULT_MAX_AGE            = "20"
	STP_DEFAULT_BRIDGE_PRIORITY    = "32768"
	STP_DEFAULT_BPDU_FILTER        = "false"
)

Variables

Functions

func GetYangPath

func GetYangPath() string

GetYangPath returns directory containing yang files. Use transformer.YangPath for now.

Types

type AclApp

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

type ActionRequest

type ActionRequest struct {
	Path        string
	Payload     []byte
	User        UserRoles
	AuthEnabled bool
}

type ActionResponse

type ActionResponse struct {
	Payload []byte
	ErrSrc  ErrSource
}

func Action

func Action(req ActionRequest) (ActionResponse, error)

type BulkRequest

type BulkRequest struct {
	DeleteRequest  []SetRequest
	ReplaceRequest []SetRequest
	UpdateRequest  []SetRequest
	CreateRequest  []SetRequest
	User           UserRoles
	AuthEnabled    bool
}

type BulkResponse

type BulkResponse struct {
	DeleteResponse  []SetResponse
	ReplaceResponse []SetResponse
	UpdateResponse  []SetResponse
	CreateResponse  []SetResponse
}

func Bulk

func Bulk(req BulkRequest) (BulkResponse, error)

type CommonApp

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

type ErrSource

type ErrSource int
const (
	ProtoErr ErrSource = iota
	AppErr
)

type GetRequest

type GetRequest struct {
	Path        string
	User        UserRoles
	AuthEnabled bool
	// Depth limits the depth of data subtree in the response
	// payload. Default value 0 indicates there is no limit.
	Depth uint
}

type GetResponse

type GetResponse struct {
	Payload []byte
	ErrSrc  ErrSource
}

func Get

func Get(req GetRequest) (GetResponse, error)

Gets data from the redis DB and converts it to northbound format

type IsSubscribeRequest

type IsSubscribeRequest struct {
	Paths       []string
	User        UserRoles
	AuthEnabled bool
}

type IsSubscribeResponse

type IsSubscribeResponse struct {
	Path                string
	IsOnChangeSupported bool
	MinInterval         int
	Err                 error
	PreferredType       NotificationType
}

func IsSubscribeSupported

func IsSubscribeSupported(req IsSubscribeRequest) ([]*IsSubscribeResponse, error)

Check if subscribe is supported on the given paths

func Subscribe

func Subscribe(req SubscribeRequest) ([]*IsSubscribeResponse, error)

Subscribes to the paths requested and sends notifications when the data changes in DB

type JSONEeprom

type JSONEeprom struct {
	Product_Name        string `json:"Product Name"`
	Part_Number         string `json:"Part Number"`
	Serial_Number       string `json:"Serial Number"`
	Base_MAC_Address    string `json:"Base MAC Address"`
	Manufacture_Date    string `json:"Manufacture Date"`
	Device_Version      string `json:"Device Version"`
	Label_Revision      string `json:"Label Revision"`
	Platform_Name       string `json:"Platform Name"`
	ONIE_Version        string `json:"ONIE Version"`
	MAC_Addresses       int    `json:"MAC Addresses"`
	Manufacturer        string `json:"Manufacturer"`
	Manufacture_Country string `json:"Manufacture Country"`
	Vendor_Name         string `json:"Vendor Name"`
	Diag_Version        string `json:"Diag Version"`
	Service_Tag         string `json:"Service Tag"`
	Vendor_Extension    string `json:"Vendor Extension"`
	Magic_Number        int    `json:"Magic Number"`
	Card_Type           string `json:"Card Type"`
	Hardware_Version    string `json:"Hardware Version"`
	Software_Version    string `json:"Software Version"`
	Model_Name          string `json:"Model Name"`
}

* Structures to read syseeprom from json file

type ModelData

type ModelData struct {
	Name string
	Org  string
	Ver  string
}

func GetModels

func GetModels() ([]ModelData, error)

Gets all the models supported by Translib

type NotificationType

type NotificationType int
const (
	Sample NotificationType = iota
	OnChange
)

type PathInfo

type PathInfo struct {
	Path     string
	Template string
	Vars     map[string]string
}

PathInfo structure contains parsed path information.

func NewPathInfo

func NewPathInfo(path string) *PathInfo

NewPathInfo parses given path string into a PathInfo structure.

func (*PathInfo) HasPrefix

func (p *PathInfo) HasPrefix(s string) bool

HasPrefix checks if this path template starts with given prefix.. Shorthand for strings.HasPrefix(p.Template, s)

func (*PathInfo) HasSuffix

func (p *PathInfo) HasSuffix(s string) bool

HasSuffix checks if this path template ends with given suffix.. Shorthand for strings.HasSuffix(p.Template, s)

func (*PathInfo) HasVar

func (p *PathInfo) HasVar(name string) bool

HasVar checks if the PathInfo contains given variable.

func (*PathInfo) IntVar

func (p *PathInfo) IntVar(name string) (int, error)

IntVar returns the value for a path variable as an int. Returns 0 if no such variable exists. Returns an error if the value is not an integer.

func (*PathInfo) Var

func (p *PathInfo) Var(name string) string

Var returns the string value for a path variable. Returns empty string if no such variable exists.

type PlatformApp

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

type SetRequest

type SetRequest struct {
	Path        string
	Payload     []byte
	User        UserRoles
	AuthEnabled bool
}

type SetResponse

type SetResponse struct {
	ErrSrc ErrSource
	Err    error
}

func Create

func Create(req SetRequest) (SetResponse, error)

Creates entries in the redis DB pertaining to the path and payload

func Delete

func Delete(req SetRequest) (SetResponse, error)

Deletes entries in the redis DB pertaining to the path

func Replace

func Replace(req SetRequest) (SetResponse, error)

Replaces entries in the redis DB pertaining to the path and payload

func Update

func Update(req SetRequest) (SetResponse, error)

Updates entries in the redis DB pertaining to the path and payload

type StpApp

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

type SubscribeRequest

type SubscribeRequest struct {
	Paths       []string
	Q           *queue.PriorityQueue
	Stop        chan struct{}
	User        UserRoles
	AuthEnabled bool
}

type SubscribeResponse

type SubscribeResponse struct {
	Path         string
	Payload      []byte
	Timestamp    int64
	SyncComplete bool
	IsTerminated bool
}

func (SubscribeResponse) Compare

func (val SubscribeResponse) Compare(other queue.Item) int

Implement Compare method for priority queue for SubscribeResponse struct

type UserRoles

type UserRoles struct {
	Name  string
	Roles []string
}

Directories

Path Synopsis
db
Package db implements a wrapper over the go-redis/redis.
Package db implements a wrapper over the go-redis/redis.
Package tlerr defines the errors of the translib library.
Package tlerr defines the errors of the translib library.

Jump to

Keyboard shortcuts

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