Commit 31473426 authored by Waleed Akbar's avatar Waleed Akbar
Browse files

Update requirements file and added error messages for gNMI OpenConfig collector

- Added pyang and pyangbind to requirements.in
- Created ErrorMessages.py for standardized error handling
- Adjusted BASE_PATH in clone-yang-models.sh for correct directory structure
- Updated YangHandler.py to include openconfig-ospf-types
- Refactored imports in __init__.py for better readability
- Added test utilities in messages_gnmi_openconfig.py for KPI packet creation
- Modified test_gnmi_openconfig_collector.py to utilize new test utilities
parent ba7d9c36
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@

anytree==2.8.0
confluent-kafka==2.3.*
pyang==2.6.*
git+https://github.com/robshakir/pyangbind.git
libyang==2.8.4
numpy==2.0.1
APScheduler==3.10.1
+40 −0
Original line number Diff line number Diff line
# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# 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.

_DEVICE_ID          = 'DeviceId({device_uuid:s})'
_ENDPOINT_ID        = 'EndpointId({endpoint_uuid:s})'
_KPI                = 'Kpi({kpi_uuid:s})'
_DEVICE_ENDPOINT_ID = _DEVICE_ID + '/' + _ENDPOINT_ID
_RESOURCE           = 'Resource({resource_data:s})'
_RESOURCE_KEY       = 'Resource(key={resource_key:s})'
_RESOURCE_KEY_VALUE = 'Resource(key={resource_key:s}, value={resource_value:s})'
_SUBSCRIPTION       = 'Subscription(key={subscr_key:s}, duration={subscr_duration:s}, interval={subscr_interval:s})'
_SAMPLE_TYPE        = 'SampleType({sample_type_id:s}/{sample_type_name:s})'
_ERROR              = 'Error({error:s})'

ERROR_MISSING_DRIVER = _DEVICE_ID + ' has not been added to this Device instance'
ERROR_MISSING_KPI    = _KPI + ' not found'

ERROR_BAD_RESOURCE   = _DEVICE_ID + ': GetConfig retrieved malformed ' + _RESOURCE
ERROR_UNSUP_RESOURCE = _DEVICE_ID + ': GetConfig retrieved unsupported ' + _RESOURCE

ERROR_GET            = _DEVICE_ID + ': Unable to Get ' + _RESOURCE_KEY + '; ' + _ERROR
ERROR_GET_INIT       = _DEVICE_ID + ': Unable to Get Initial ' + _RESOURCE_KEY + '; ' + _ERROR
ERROR_DELETE         = _DEVICE_ID + ': Unable to Delete ' + _RESOURCE_KEY_VALUE + '; ' + _ERROR
ERROR_SET            = _DEVICE_ID + ': Unable to Set ' + _RESOURCE_KEY_VALUE + '; ' + _ERROR

ERROR_SAMPLETYPE     = _DEVICE_ENDPOINT_ID + ': ' + _SAMPLE_TYPE + ' not supported'

ERROR_SUBSCRIBE      = _DEVICE_ID + ': Unable to Subscribe ' + _SUBSCRIPTION + '; ' + _ERROR
ERROR_UNSUBSCRIBE    = _DEVICE_ID + ': Unable to Unsubscribe ' + _SUBSCRIPTION + '; ' + _ERROR
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ DRIVERS.append(
        # TODO: multi-filter is not working
        {
            FilterFieldEnum.DEVICE_TYPE: [
                DeviceTypeEnum.EMULATED_P4_SWITCH,
                DeviceTypeEnum.EMULATED_PACKET_ROUTER,
                DeviceTypeEnum.EMULATED_PACKET_SWITCH,
            ],
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

BASE_PATH=~/tfs-ctrl/src/telemetry/backend/collectors/gnmi_openconfig
BASE_PATH=~/tfs-ctrl/src/telemetry/backend/service/collectors/gnmi_openconfig
GIT_BASE_PATH=${BASE_PATH}/git/openconfig

rm -rf ${GIT_BASE_PATH}
+2 −1
Original line number Diff line number Diff line
@@ -42,10 +42,11 @@ YANG_MODULES = [
    'openconfig-types',
    'openconfig-policy-types',
    'openconfig-mpls-types',
    'openconfig-ospf-types',
    'openconfig-network-instance-types',
    'openconfig-network-instance',

    'openconfig-platform',
    # 'openconfig-platform',
    'openconfig-platform-controller-card',
    'openconfig-platform-cpu',
    'openconfig-platform-ext',
Loading