Documentation ¶
Index ¶
- Constants
- Variables
- func GetYangModuleSetID() string
- func GetYangPath() string
- func SetSchemaRootURL(url string)
- func Stream(req SubscribeRequest) error
- func Subscribe(req SubscribeRequest) error
- type AclApp
- type ActionRequest
- type ActionResponse
- type Bits
- type BulkRequest
- type BulkResponse
- type CommonApp
- type Counter
- type EepromDb
- type ErrSource
- type GetRequest
- type GetResponse
- type IsSubscribePath
- type IsSubscribeRequest
- type IsSubscribeResponse
- type ModelData
- type NotificationType
- type PathInfo
- type PlatformApp
- type ProcessState
- type QueryParameters
- type SetRequest
- type SetResponse
- type SubscribeRequest
- type SubscribeResponse
- type SubscribeSession
- type SysApp
- type TranslibFmtType
- type UserRoles
- type Version
Constants ¶
const ( TABLE_SEPARATOR = "|" KEY_SEPARATOR = "|" ACL_TABLE = "ACL_TABLE" RULE_TABLE = "ACL_RULE" 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 )
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" )
const ( GET = 1 + iota CREATE REPLACE UPDATE DELETE )
const ( // MinSubscribeInterval is the lowest sample subscription interval supported by the system. // Value is in seconds. This is also used as the default value if apps do not provide one // or returns a lower value. MinSubscribeInterval = apis.SAMPLE_NOTIFICATION_MIN_INTERVAL )
Variables ¶
var ETHERTYPE_MAP = map[ocbinds.E_OpenconfigPacketMatchTypes_ETHERTYPE]uint32{ ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_LLDP: 0x88CC, ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_VLAN: 0x8100, ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_ROCE: 0x8915, ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_ARP: 0x0806, ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_IPV4: 0x0800, ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_IPV6: 0x86DD, ocbinds.OpenconfigPacketMatchTypes_ETHERTYPE_ETHERTYPE_MPLS: 0x8847, }
var IP_PROTOCOL_MAP = map[ocbinds.E_OpenconfigPacketMatchTypes_IP_PROTOCOL]uint8{ ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_ICMP: 1, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_IGMP: 2, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_TCP: 6, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_UDP: 17, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_RSVP: 46, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_GRE: 47, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_AUTH: 51, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_PIM: 103, ocbinds.OpenconfigPacketMatchTypes_IP_PROTOCOL_IP_L2TP: 115, }
Functions ¶
func GetYangModuleSetID ¶
func GetYangModuleSetID() string
GetYangModuleSetID returns the ietf-yang-library's module-set-id value.
func GetYangPath ¶
func GetYangPath() string
GetYangPath returns directory containing yang files. Use transformer.YangPath for now.
func SetSchemaRootURL ¶
func SetSchemaRootURL(url string)
SetSchemaRootURL sets root URL for yang file download URLs.
func Stream ¶
func Stream(req SubscribeRequest) error
Stream function streams the value for requested paths through a queue. Unlike Get, this function can return smaller chunks of response separately. Individual chunks are packed in a SubscribeResponse object and pushed to the req.Q. Pushes a SubscribeResponse with SyncComplete=true after data are pushed. Function will block until all values are returned. This can be used for handling "Sample" subscriptions (NotificationType.Sample). Client should be authorized to perform "subscribe" operation.
func Subscribe ¶
func Subscribe(req SubscribeRequest) error
Subscribe - Subscribes to the paths requested and sends notifications when the data changes in DB
Types ¶
type ActionRequest ¶
type ActionResponse ¶
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 ClientVersion Version }
type BulkResponse ¶
type BulkResponse struct { DeleteResponse []SetResponse ReplaceResponse []SetResponse UpdateResponse []SetResponse CreateResponse []SetResponse }
func Bulk ¶
func Bulk(req BulkRequest) (BulkResponse, error)
type EepromDb ¶
type EepromDb struct { Product_Name string Part_Number string Serial_Number string Base_MAC_Address string Manufacture_Date string Device_Version string Label_Revision string Platform_Name string ONIE_Version string MAC_Addresses int Manufacturer string Manufacture_Country string Vendor_Name string Diag_Version string Service_Tag string Vendor_Extension string Magic_Number int Card_Type string Hardware_Version string Software_Version string Model_Name string }
* Structures to read syseeprom from redis-db
type GetRequest ¶
type GetRequest struct { Path string FmtType TranslibFmtType User UserRoles AuthEnabled bool ClientVersion Version QueryParams QueryParameters Ctxt context.Context }
type GetResponse ¶
type GetResponse struct { Payload []byte ValueTree ygot.ValidatedGoStruct ErrSrc ErrSource }
func Get ¶
func Get(req GetRequest) (GetResponse, error)
Get - Gets data from the redis DB and converts it to northbound format
type IsSubscribePath ¶
type IsSubscribePath struct { ID uint32 // Path ID for correlating with IsSubscribeResponse Path string // Subscribe path Mode NotificationType // Requested subscribe mode }
type IsSubscribeRequest ¶
type IsSubscribeRequest struct { Paths []IsSubscribePath User UserRoles AuthEnabled bool ClientVersion Version Session *SubscribeSession }
type IsSubscribeResponse ¶
type IsSubscribeResponse struct { ID uint32 // Path ID Path string IsSubPath bool // Subpath of the requested path IsOnChangeSupported bool IsWildcardSupported bool // true if wildcard keys are supported in the path MinInterval int Err error PreferredType NotificationType }
func IsSubscribeSupported ¶
func IsSubscribeSupported(req IsSubscribeRequest) ([]*IsSubscribeResponse, error)
IsSubscribeSupported - Check if subscribe is supported on the given paths
type NotificationType ¶
type NotificationType int
const ( TargetDefined NotificationType = iota Sample OnChange )
func (NotificationType) String ¶
func (nt NotificationType) String() string
type PathInfo ¶
PathInfo structure contains parsed path information.
func NewPathInfo ¶
NewPathInfo parses given path string into a PathInfo structure.
func (*PathInfo) HasPrefix ¶
HasPrefix checks if this path template starts with given prefix.. Shorthand for strings.HasPrefix(p.Template, s)
func (*PathInfo) HasSuffix ¶
HasSuffix checks if this path template ends with given suffix.. Shorthand for strings.HasSuffix(p.Template, s)
func (*PathInfo) IntVar ¶
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.
type PlatformApp ¶
type PlatformApp struct {
// contains filtered or unexported fields
}
type ProcessState ¶
type QueryParameters ¶
type SetRequest ¶
type SetResponse ¶
func Create ¶
func Create(req SetRequest) (SetResponse, error)
Create - Creates entries in the redis DB pertaining to the path and payload
func Delete ¶
func Delete(req SetRequest) (SetResponse, error)
Delete - Deletes entries in the redis DB pertaining to the path
func Replace ¶
func Replace(req SetRequest) (SetResponse, error)
Replace - Replaces entries in the redis DB pertaining to the path and payload
func Update ¶
func Update(req SetRequest) (SetResponse, error)
Update - Updates entries in the redis DB pertaining to the path and payload
type SubscribeRequest ¶
type SubscribeRequest struct { Paths []string Q *queue.PriorityQueue Stop chan struct{} User UserRoles AuthEnabled bool ClientVersion Version Session *SubscribeSession }
SubscribeRequest holds the request data for Subscribe and Stream APIs.
type SubscribeResponse ¶
type SubscribeSession ¶
type SubscribeSession struct { ID string // session id // contains filtered or unexported fields }
SubscribeSession is used to share session data between subscription related APIs - IsSubscribeSupported, Subscribe and Stream.
func NewSubscribeSession ¶
func NewSubscribeSession() *SubscribeSession
NewSubscribeSession creates a new SubscribeSession. Caller MUST close the session object through CloseSubscribeSession call at the end.
func (*SubscribeSession) Close ¶
func (ss *SubscribeSession) Close()
Close a SubscribeSession and release all resources it held by it. API client MUST close the sessions it creates; and not reuse the session after closing.
type TranslibFmtType ¶
type TranslibFmtType int
const ( TRANSLIB_FMT_IETF_JSON TranslibFmtType = iota TRANSLIB_FMT_YGOT )
type Version ¶
type Version struct { Major uint32 // Major version number Minor uint32 // Minor version number Patch uint32 // Patch number }
Version represents the semantic version number in Major.Minor.Patch format.
func GetYangBaseVersion ¶
func GetYangBaseVersion() Version
GetYangBaseVersion returns the base version or min version of yang APIs supported by this server.
func GetYangBundleVersion ¶
func GetYangBundleVersion() Version
GetYangBundleVersion returns the API version for yang bundle hosted on this server.
func NewVersion ¶
NewVersion creates a Version object from given version string
func (*Version) GetCompatibleBaseVersion ¶
GetCompatibleBaseVersion returns the compatible base version for current version.
func (*Version) GreaterThan ¶
GreaterThan checks if the Version v is more than another version
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Config Session
|
Config Session |
Package db implements a wrapper over the go-redis/redis.
|
Package db implements a wrapper over the go-redis/redis. |
internal
|
|
Package path defines utilities to operate on translib path.
|
Package path defines utilities to operate on translib path. |
Package tlerr defines the errors of the translib library.
|
Package tlerr defines the errors of the translib library. |