Documentation ¶
Overview ¶
* Copyright 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- func SetKVClient(ctx context.Context, Technology string, Backend string, Addr string, ...) *db.Backend
- func ToByte(value interface{}) ([]byte, error)
- func ToString(value interface{}) (string, error)
- type PONResourceManager
- func (PONRMgr *PONResourceManager) ClearDeviceResourcePool(ctx context.Context) error
- func (PONRMgr *PONResourceManager) ClearDeviceResourcePoolForIntf(ctx context.Context, intfID uint32) error
- func (PONRMgr *PONResourceManager) ClearResourceIDPool(ctx context.Context, contIntfID uint32, ResourceType string) bool
- func (PONRMgr *PONResourceManager) CloseKVClient(ctx context.Context)
- func (PONRMgr *PONResourceManager) FormatResource(ctx context.Context, IntfID uint32, StartIDx uint32, EndIDx uint32, ...) ([]byte, error)
- func (PONRMgr *PONResourceManager) FreeResourceID(ctx context.Context, IntfID uint32, ResourceType string, ...) error
- func (PONRMgr *PONResourceManager) GenerateNextID(ctx context.Context, Resource map[string]interface{}) (uint32, error)
- func (PONRMgr *PONResourceManager) GetCurrentAllocIDForOnu(ctx context.Context, IntfONUID string) []uint32
- func (PONRMgr *PONResourceManager) GetCurrentFlowIDsForOnu(ctx context.Context, IntfONUID string) []uint32
- func (PONRMgr *PONResourceManager) GetCurrentGEMPortIDsForOnu(ctx context.Context, IntfONUID string) []uint32
- func (PONRMgr *PONResourceManager) GetFlowIDInfo(ctx context.Context, IntfONUID string, FlowID uint32, Data interface{}) error
- func (PONRMgr *PONResourceManager) GetPath(ctx context.Context, IntfID uint32, ResourceType string) string
- func (PONRMgr *PONResourceManager) GetResource(ctx context.Context, Path string) (map[string]interface{}, error)
- func (PONRMgr *PONResourceManager) GetResourceID(ctx context.Context, IntfID uint32, ResourceType string, NumIDs uint32) ([]uint32, error)
- func (PONRMgr *PONResourceManager) GetResourceTypeAllocID() string
- func (PONRMgr *PONResourceManager) GetResourceTypeGemPortID() string
- func (PONRMgr *PONResourceManager) GetResourceTypeOnuID() string
- func (PONRMgr *PONResourceManager) GetTechnology() string
- func (PONRMgr *PONResourceManager) InitDefaultPONResourceRanges(ctx context.Context, ONUIDStart uint32, ONUIDEnd uint32, ...) bool
- func (PONRMgr *PONResourceManager) InitDeviceResourcePool(ctx context.Context) error
- func (PONRMgr *PONResourceManager) InitDeviceResourcePoolForIntf(ctx context.Context, intfID uint32) error
- func (PONRMgr *PONResourceManager) InitResourceIDPool(ctx context.Context, Intf uint32, ResourceType string, StartID uint32, ...) error
- func (PONRMgr PONResourceManager) InitResourceMap(ctx context.Context, PONIntfONUID string)
- func (PONRMgr *PONResourceManager) InitResourceRangesFromKVStore(ctx context.Context) bool
- func (PONRMgr *PONResourceManager) ReleaseID(ctx context.Context, Resource map[string]interface{}, Id uint32) bool
- func (PONRMgr *PONResourceManager) RemoveAllFlowIDInfo(ctx context.Context, IntfONUID string) bool
- func (PONRMgr *PONResourceManager) RemoveFlowIDInfo(ctx context.Context, IntfONUID string, FlowID uint32) bool
- func (PONRMgr PONResourceManager) RemoveResourceMap(ctx context.Context, PONIntfONUID string) bool
- func (PONRMgr *PONResourceManager) UpdateAllocIdsForOnu(ctx context.Context, IntfONUID string, AllocIDs []uint32) error
- func (PONRMgr *PONResourceManager) UpdateFlowIDForOnu(ctx context.Context, IntfONUID string, FlowID uint32, Add bool) error
- func (PONRMgr *PONResourceManager) UpdateFlowIDInfoForOnu(ctx context.Context, IntfONUID string, FlowID uint32, FlowData interface{}) error
- func (PONRMgr *PONResourceManager) UpdateGEMPortIDsForOnu(ctx context.Context, IntfONUID string, GEMPortIDs []uint32) error
- func (PONRMgr *PONResourceManager) UpdateRanges(ctx context.Context, StartIDx string, StartID uint32, EndIDx string, ...)
- func (PONRMgr *PONResourceManager) UpdateResource(ctx context.Context, Path string, Resource map[string]interface{}) error
Constants ¶
const ( //Constants to identify resource pool UNI_ID = "UNI_ID" ONU_ID = "ONU_ID" ALLOC_ID = "ALLOC_ID" GEMPORT_ID = "GEMPORT_ID" FLOW_ID = "FLOW_ID" //Constants for passing command line arguments OLT_MODEL_ARG = "--olt_model" PATH_PREFIX = "%s/resource_manager/{%s}" PATH_PREFIX_FOR_CONFIG = "%s/resource_manager/config" /*The resource ranges for a given device model should be placed at 'resource_manager/<technology>/resource_ranges/<olt_model_type>' path on the KV store. If Resource Range parameters are to be read from the external KV store, they are expected to be stored in the following format. Note: All parameters are MANDATORY for now. constants used as keys to reference the resource range parameters from and external KV store. */ UNI_ID_START_IDX = "uni_id_start" UNI_ID_END_IDX = "uni_id_end" ONU_ID_START_IDX = "onu_id_start" ONU_ID_END_IDX = "onu_id_end" ONU_ID_SHARED_IDX = "onu_id_shared" ALLOC_ID_START_IDX = "alloc_id_start" ALLOC_ID_END_IDX = "alloc_id_end" ALLOC_ID_SHARED_IDX = "alloc_id_shared" GEMPORT_ID_START_IDX = "gemport_id_start" GEMPORT_ID_END_IDX = "gemport_id_end" GEMPORT_ID_SHARED_IDX = "gemport_id_shared" FLOW_ID_START_IDX = "flow_id_start" FLOW_ID_END_IDX = "flow_id_end" FLOW_ID_SHARED_IDX = "flow_id_shared" NUM_OF_PON_PORT = "pon_ports" /* The KV store backend is initialized with a path prefix and we need to provide only the suffix. */ PON_RESOURCE_RANGE_CONFIG_PATH = "resource_ranges/%s" //resource path suffix //Path on the KV store for storing alloc id ranges and resource pool for a given interface //Format: <device_id>/alloc_id_pool/<pon_intf_id> ALLOC_ID_POOL_PATH = "{%s}/alloc_id_pool/{%d}" //Path on the KV store for storing gemport id ranges and resource pool for a given interface //Format: <device_id>/gemport_id_pool/<pon_intf_id> GEMPORT_ID_POOL_PATH = "{%s}/gemport_id_pool/{%d}" //Path on the KV store for storing onu id ranges and resource pool for a given interface //Format: <device_id>/onu_id_pool/<pon_intf_id> ONU_ID_POOL_PATH = "{%s}/onu_id_pool/{%d}" //Path on the KV store for storing flow id ranges and resource pool for a given interface //Format: <device_id>/flow_id_pool/<pon_intf_id> FLOW_ID_POOL_PATH = "{%s}/flow_id_pool/{%d}" //Path on the KV store for storing list of alloc IDs for a given ONU //Format: <device_id>/<(pon_intf_id, onu_id)>/alloc_ids ALLOC_ID_RESOURCE_MAP_PATH = "{%s}/{%s}/alloc_ids" //Path on the KV store for storing list of gemport IDs for a given ONU //Format: <device_id>/<(pon_intf_id, onu_id)>/gemport_ids GEMPORT_ID_RESOURCE_MAP_PATH = "{%s}/{%s}/gemport_ids" //Path on the KV store for storing list of Flow IDs for a given ONU //Format: <device_id>/<(pon_intf_id, onu_id)>/flow_ids FLOW_ID_RESOURCE_MAP_PATH = "{%s}/{%s}/flow_ids" //Flow Id info: Use to store more metadata associated with the flow_id FLOW_ID_INFO_PATH_PREFIX = "{%s}/flow_id_info" //Format: <device_id>/flow_id_info/<(pon_intf_id, onu_id)> FLOW_ID_INFO_PATH_INTF_ONU_PREFIX = "{%s}/flow_id_info/{%s}" //Format: <device_id>/flow_id_info/<(pon_intf_id, onu_id)><flow_id> FLOW_ID_INFO_PATH = FLOW_ID_INFO_PATH_PREFIX + "/{%s}/{%d}" //Constants for internal usage. PON_INTF_ID = "pon_intf_id" START_IDX = "start_idx" END_IDX = "end_idx" POOL = "pool" NUM_OF_PON_INTF = 16 KVSTORE_RETRY_TIMEOUT = 5 * time.Second //Path on the KV store for storing reserved gem ports //Format: reserved_gemport_ids RESERVED_GEMPORT_IDS_PATH = "reserved_gemport_ids" )
Variables ¶
This section is empty.
Functions ¶
func SetKVClient ¶
Types ¶
type PONResourceManager ¶
type PONResourceManager struct { //Implements APIs to initialize/allocate/release alloc/gemport/onu IDs. Technology string DeviceType string DeviceID string Backend string // ETCD only currently Address string // address of the KV store OLTModel string KVStore *db.Backend KVStoreForConfig *db.Backend // Below attribute, pon_resource_ranges, should be initialized // by reading from KV store. PonResourceRanges map[string]interface{} IntfIDs []uint32 // list of pon interface IDs Globalorlocal string }
func NewPONResourceManager ¶
func NewPONResourceManager(ctx context.Context, Technology string, DeviceType string, DeviceID string, Backend string, Address string, basePathKvStore string) (*PONResourceManager, error)
NewPONResourceManager creates a new PON resource manager.
func (*PONResourceManager) ClearDeviceResourcePool ¶
func (PONRMgr *PONResourceManager) ClearDeviceResourcePool(ctx context.Context) error
func (*PONResourceManager) ClearDeviceResourcePoolForIntf ¶
func (PONRMgr *PONResourceManager) ClearDeviceResourcePoolForIntf(ctx context.Context, intfID uint32) error
func (*PONResourceManager) ClearResourceIDPool ¶
func (*PONResourceManager) CloseKVClient ¶
func (PONRMgr *PONResourceManager) CloseKVClient(ctx context.Context)
func (*PONResourceManager) FormatResource ¶
func (*PONResourceManager) FreeResourceID ¶
func (*PONResourceManager) GenerateNextID ¶
func (*PONResourceManager) GetCurrentAllocIDForOnu ¶
func (PONRMgr *PONResourceManager) GetCurrentAllocIDForOnu(ctx context.Context, IntfONUID string) []uint32
func (*PONResourceManager) GetCurrentFlowIDsForOnu ¶
func (PONRMgr *PONResourceManager) GetCurrentFlowIDsForOnu(ctx context.Context, IntfONUID string) []uint32
func (*PONResourceManager) GetCurrentGEMPortIDsForOnu ¶
func (PONRMgr *PONResourceManager) GetCurrentGEMPortIDsForOnu(ctx context.Context, IntfONUID string) []uint32
func (*PONResourceManager) GetFlowIDInfo ¶
func (*PONResourceManager) GetResource ¶
func (*PONResourceManager) GetResourceID ¶
func (*PONResourceManager) GetResourceTypeAllocID ¶
func (PONRMgr *PONResourceManager) GetResourceTypeAllocID() string
func (*PONResourceManager) GetResourceTypeGemPortID ¶
func (PONRMgr *PONResourceManager) GetResourceTypeGemPortID() string
func (*PONResourceManager) GetResourceTypeOnuID ¶
func (PONRMgr *PONResourceManager) GetResourceTypeOnuID() string
func (*PONResourceManager) GetTechnology ¶
func (PONRMgr *PONResourceManager) GetTechnology() string
func (*PONResourceManager) InitDefaultPONResourceRanges ¶
func (PONRMgr *PONResourceManager) InitDefaultPONResourceRanges(ctx context.Context, ONUIDStart uint32, ONUIDEnd uint32, ONUIDSharedPoolID uint32, AllocIDStart uint32, AllocIDEnd uint32, AllocIDSharedPoolID uint32, GEMPortIDStart uint32, GEMPortIDEnd uint32, GEMPortIDSharedPoolID uint32, FlowIDStart uint32, FlowIDEnd uint32, FlowIDSharedPoolID uint32, UNIIDStart uint32, UNIIDEnd uint32, NoOfPONPorts uint32, IntfIDs []uint32) bool
func (*PONResourceManager) InitDeviceResourcePool ¶
func (PONRMgr *PONResourceManager) InitDeviceResourcePool(ctx context.Context) error
func (*PONResourceManager) InitDeviceResourcePoolForIntf ¶
func (PONRMgr *PONResourceManager) InitDeviceResourcePoolForIntf(ctx context.Context, intfID uint32) error
func (*PONResourceManager) InitResourceIDPool ¶
func (PONResourceManager) InitResourceMap ¶
func (PONRMgr PONResourceManager) InitResourceMap(ctx context.Context, PONIntfONUID string)
func (*PONResourceManager) InitResourceRangesFromKVStore ¶
func (PONRMgr *PONResourceManager) InitResourceRangesFromKVStore(ctx context.Context) bool
func (*PONResourceManager) RemoveAllFlowIDInfo ¶
func (PONRMgr *PONResourceManager) RemoveAllFlowIDInfo(ctx context.Context, IntfONUID string) bool
func (*PONResourceManager) RemoveFlowIDInfo ¶
func (PONResourceManager) RemoveResourceMap ¶
func (PONRMgr PONResourceManager) RemoveResourceMap(ctx context.Context, PONIntfONUID string) bool
func (*PONResourceManager) UpdateAllocIdsForOnu ¶
func (*PONResourceManager) UpdateFlowIDForOnu ¶
func (*PONResourceManager) UpdateFlowIDInfoForOnu ¶
func (*PONResourceManager) UpdateGEMPortIDsForOnu ¶
func (*PONResourceManager) UpdateRanges ¶
func (PONRMgr *PONResourceManager) UpdateRanges(ctx context.Context, StartIDx string, StartID uint32, EndIDx string, EndID uint32, SharedIDx string, SharedPoolID uint32, RMgr *PONResourceManager)