SNMP Protocol Agent

Created on June 21, 2022

The SNMP Protocol Agent is an RDK-B component that provides network management capabilities through the Simple Network Management Protocol. This component operates as an SNMP subagent using the AgentX protocol to communicate with a master SNMP daemon. It translates SNMP Object Identifiers (OIDs) into RDK-B data model parameters, enabling remote network management systems to monitor and configure RDK-B gateway devices through standard SNMP operations. The component supports both SNMPv2 and SNMPv3 protocols and provides comprehensive Management Information Base (MIB) implementations for various gateway subsystems.

The SNMP Protocol Agent acts as a bridge between external network management systems and the internal RDK-B middleware layer. It receives SNMP GET, SET, and GETNEXT requests from network management stations, translates these requests into corresponding data model parameter operations using the CCSP message bus, and returns responses in SNMP format. The component implements MIB-to-Data-Model mappings defined in XML configuration files, which specify the relationship between SNMP OIDs and RDK-B data model parameters across multiple subsystems including WiFi, Firewall, MoCA, Device Management, Hotspot, DNS, NTP, and TR-069.

graph LR
    subgraph "External Systems"
        NMS[Network Management System]
        SNMP_Tools[SNMP Monitoring Tools]
    end

    subgraph "SNMP Layer"
        MasterSNMPD[Master SNMP Daemon<br/>snmpd]
    end

    subgraph "RDK-B Middleware"
        SNMPAgent[SNMP Protocol Agent<br/>snmp_subagent]
        CR[Component Registry<br/>CcspCr]
        PAM[CcspPandM]
        WiFi[CcspWiFiAgent/OneWifi]
        MoCA[CcspMoCAAgent]
        TR069[CcspTr069Pa]
        Firewall[CcspFirewall]
    end

    subgraph "System Layer"
        MessageBus[(CCSP Message Bus<br/>RBus)]
        SysCfg[syscfg]
        SysEvent[sysevent]
    end

    subgraph "Security"
        Privilege[Privilege Manager]
    end

    NMS -->|SNMPv2/v3| MasterSNMPD
    SNMP_Tools -->|SNMP GET/SET| MasterSNMPD
    MasterSNMPD <-->|AgentX Protocol| SNMPAgent

    SNMPAgent <-->|RBus Component Discovery| CR
    SNMPAgent <-->|RBus Parameter Operations| MessageBus
    SNMPAgent -->|syscfg_get/syscfg_set| SysCfg
    SNMPAgent -->|sysevent_get/sysevent_set| SysEvent
    SNMPAgent -->|drop_root_caps| Privilege

    MessageBus <-->|Device.* Parameters| PAM
    MessageBus <-->|Device.WiFi.* Parameters| WiFi
    MessageBus <-->|Device.MoCA.* Parameters| MoCA
    MessageBus <-->|Device.ManagementServer.* Parameters| TR069
    MessageBus <-->|Device.Firewall.* Parameters| Firewall

    classDef external fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;
    classDef snmp fill:#e1f5fe,stroke:#0277bd,stroke-width:2px;
    classDef middleware fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px;
    classDef system fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px;
    classDef security fill:#ffebee,stroke:#c62828,stroke-width:2px;

    class NMS,SNMP_Tools external;
    class MasterSNMPD snmp;
    class SNMPAgent,CR,PAM,WiFi,MoCA,TR069,Firewall middleware;
    class MessageBus,SysCfg,SysEvent system;
    class Privilege security;

Key Features & Responsibilities:

  • SNMP Protocol Implementation: Operates as AgentX subagent providing SNMP GET, SET, and GETNEXT operations for remote network management with support for both SNMPv2 and SNMPv3 protocols
  • MIB-to-DataModel Translation: Implements dynamic MIB object handling by translating SNMP OIDs to RDK-B data model parameters through XML-defined mappings enabling consistent access across subsystems
  • Multi-Subsystem Coverage: Provides MIB implementations for WiFi, Firewall, MoCA, Hotspot, Device Management, DNS, NTP, TR-069, VLAN, and vendor-specific extensions through custom handler modules
  • AgentX Protocol Support: Integrates with master SNMP daemon via AgentX protocol enabling distributed SNMP agent architecture and supporting multiple subagents on the same device
  • Dynamic MIB Loading: Loads MIB mapping configurations from XML files at runtime allowing flexible MIB extensions without code recompilation

Design

The SNMP Protocol Agent follows a modular architecture designed around the net-snmp library’s AgentX subagent model with clear separation between protocol handling, MIB translation, and data model access. The design emphasizes extensibility through XML-driven MIB mappings and handler-based subsystem implementations. The architecture operates in three primary layers: the SNMP protocol layer handling AgentX communication with the master daemon, the translation layer processing MIB-to-DataModel conversions through XML configurations, and the integration layer managing CCSP message bus interactions for parameter access.

The component initializes by establishing an AgentX connection to the master SNMP daemon, loading MIB mapping XML files, and registering MIB handlers for each supported subsystem. Communication with RDK-B components occurs through the CCSP message bus using the CcspBaseIf API set, which provides parameter discovery, get, set, and commit operations. The design implements caching strategies for frequently accessed parameters and supports both scalar and tabular SNMP objects with automatic instance management.

The northbound interface accepts SNMP requests via AgentX protocol on TCP port 705 (loopback, configured as tcp:127.0.0.1:705 in ccsp_snmp_subagent.c). External SNMP requests arrive on UDP port 161; trap notifications use UDP port 162. The southbound interface uses RBus message bus for RDK-B component parameter operations and syscfg/sysevent APIs for system configuration. The component drops root capabilities after initialization via privilege manager API.

MIB mapping configurations are stored in XML files located in the Mib2DmMapping directory, with CcspRDKBMibList.xml serving as the master index. Each MIB module has a corresponding XML file specifying OID-to-parameter mappings, data types, access permissions, and handler function bindings. The component supports conditional MIB loading through XML preprocessing directives enabling feature-specific MIB definitions.

graph TD
    subgraph ExternalInterface ["External Interface"]
        AgentXProtocol[AgentX Protocol]
        MasterSNMPD[Master SNMP Daemon<br/>snmpd]
    end

    subgraph SNMPAgent ["SNMP Protocol Agent (C/net-snmp)"]
        subgraph MainProcess ["Main Process"]
            SubAgent[SNMP Subagent Process<br/>source/SnmpPlugin/ccsp_snmp_subagent.c]
            Init[Initialization<br/>init_ccsp_snmp_plugin]
            MIBLoader[MIB XML Loader<br/>source/SnmpPlugin/CcspSnmpPlugin.c]
        end

        subgraph PluginCore ["SNMP Plugin Core"]
            MIBHelper[MIB Helper<br/>source/SnmpPlugin/ccsp_mib_helper.c]
            ScalarHelper[Scalar Handler<br/>source/SnmpPlugin/ccsp_scalar_helper.c]
            TableHelper[Table Handler<br/>source/SnmpPlugin/ccsp_table_helper.c]
            MIBUtil[MIB Utilities<br/>source/SnmpPlugin/ccsp_mib_utilities.c]
        end

        subgraph CustomHandlers ["Custom MIB Handlers"]
            Handlers[Subsystem Handlers<br/>WiFi, DeviceMgmt, Firewall,<br/>MoCA, Hotspot, Diagnostics,<br/>DNS, NTP, IP Management<br/>source/custom/*.c]
        end

        subgraph Integration ["CCSP Integration"]
            CosaAPI[COSA API<br/>source/SnmpPlugin/cosa_api.c]
            SNMPCommon[SNMP Common<br/>source/custom/ccsp_snmp_common.c]
        end

        subgraph Configuration ["Configuration"]
            MIBMappings[(MIB XML Mappings<br/>Mib2DmMapping/*.xml)]
            SNMPConf[SNMP Config<br/>config/snmpd.conf]
        end

        SubAgent --> Init
        Init --> MIBLoader
        MIBLoader --> MIBHelper
        MIBHelper --> ScalarHelper
        MIBHelper --> TableHelper
        MIBHelper --> MIBUtil

        ScalarHelper --> CustomHandlers
        TableHelper --> CustomHandlers

        CustomHandlers --> CosaAPI
        CustomHandlers --> SNMPCommon

        CosaAPI --> MessageBus
        SNMPCommon --> MessageBus

        MIBLoader --> MIBMappings
        SubAgent --> SNMPConf
    end

    MessageBus[(CCSP Message Bus<br/>RBus)]

    AgentXProtocol --> MasterSNMPD
    MasterSNMPD --> SubAgent

Prerequisites and Dependencies

Build-Time Flags and Configuration:

Configure OptionDISTRO FeatureBuild FlagPurposeDefault
--enable-unitTestDockerSupportN/AUNIT_TEST_DOCKER_SUPPORTEnable docker support for unit testingDisabled
N/AN/ARDKB_MIBUse RDKB-specific MIB list (CcspRDKBMibList.xml) instead of legacyEnabled
N/ArdkloggerFEATURE_SUPPORT_RDKLOGEnable RDK Logger integration for loggingPlatform-dependent
N/AbreakpadINCLUDE_BREAKPADEnable Breakpad crash reportingPlatform-dependent
N/Awan-managerFEATURE_RDKB_WAN_MANAGEREnable WAN Manager specific parametersPlatform-dependent
N/AonewifiRDK_ONEWIFIEnable OneWiFi unified WiFi stack supportPlatform-dependent
N/AProduct-specific_XB6_PRODUCT_REQ_XB6 product specific featuresPlatform-dependent
N/AProduct-specific_XB7_PRODUCT_REQ_XB7 product specific featuresPlatform-dependent
N/AProduct-specific_XF3_PRODUCT_REQ_XF3 product specific featuresPlatform-dependent
N/AProduct-specific_CBR_PRODUCT_REQ_CBR product specific featuresPlatform-dependent
N/Awifi-ax_WIFI_AX_SUPPORT_WiFi 6 (802.11ax) supportPlatform-dependent
N/Apuma7INTEL_PUMA7Intel Puma7 chipset specific featuresPlatform-dependent
N/ApcdUSE_PCD_API_EXCEPTION_HANDLINGPCD API exception handlingPlatform-dependent

RDK-B Platform and Integration Requirements:

  • RDK-B Components: CcspCommonLibrary, CcspCr (Component Registry), CcspPandM, CcspWiFiAgent/OneWifi, CcspMoCAAgent, CcspTr069Pa
  • HAL Dependencies: No direct HAL dependencies
  • Systemd Services: Master SNMP daemon (snmpd) must be running before snmp_subagent starts
  • Message Bus: CCSP Message Bus (RBus) registration under component name ccsp.cisco.spvtg.ccsp.snmp with connection to Component Registry at eRT.com.cisco.spvtg.ccsp.CR
  • Configuration Files:
  • /tmp/ccsp_msg.cfg for CCSP message bus configuration
  • config/snmpd.conf for SNMP daemon configuration
  • mibs/*.txt for MIB definition files
  • libsnmp_plugin.so for core plugin library
  • libsnmp_custom.so for custom handler library
  • Mib2DmMapping/CcspRDKBMibList.xml for MIB mapping index
  • Individual MIB mapping XML files in Mib2DmMapping directory
  • Startup Order: Initialize after CCSP Component Registry and message bus are active
  • External Libraries: net-snmp (libnetsnmp, libnetsnmpagent, libnetsnmpmibs), libccsp_common, libsyscfg, libsysevent, libutapi, libutctx, libsecure_wrapper, libprivilege, libprint_uptime

Threading Model:

The SNMP Protocol Agent implements a single-threaded event-driven architecture based on the net-snmp library’s main event loop. All SNMP request processing, MIB operations, and CCSP message bus interactions occur within the main thread context using the net-snmp agent event processing mechanism.

  • Threading Architecture: Single-threaded with net-snmp event loop
  • Main Thread: Handles AgentX protocol communication, SNMP request processing, MIB handler callbacks, and CCSP message bus synchronous calls
  • Synchronization: No explicit synchronization required due to single-threaded design

Component State Flow

Initialization to Active State

The SNMP Protocol Agent follows a sequential initialization process establishing system connections, loading configurations, and registering MIB handlers before entering the main SNMP request processing loop. The component performs argument parsing, net-snmp initialization, CCSP message bus connection, MIB mapping XML loading, and handler registration in a fixed order to ensure all dependencies are satisfied before accepting SNMP requests.

sequenceDiagram
    autonumber
    participant System as System Startup
    participant SubAgent as SNMP Subagent
    participant NetSNMP as net-snmp Library
    participant CCSP as CCSP Message Bus
    participant MIBLoader as MIB Loader
    participant Handlers as MIB Handlers

    System->>SubAgent: Start snmp_subagent Process
    Note over SubAgent: State: Initializing<br/>Parse command line arguments

    SubAgent->>NetSNMP: netsnmp_ds_set_string(AgentX Socket)
    Note over SubAgent: Configure AgentX connection address

    SubAgent->>NetSNMP: init_agent(AGNT_NAME)
    NetSNMP-->>SubAgent: Agent Initialized

    SubAgent->>MIBLoader: init_ccsp_snmp_plugin()
    Note over SubAgent: State: LoadingConfig<br/>Initialize plugin and load MIBs

    MIBLoader->>CCSP: Cosa_Init()
    CCSP->>CCSP: CCSP_Message_Bus_Init()
    CCSP-->>MIBLoader: Message Bus Connected
    Note over SubAgent: Connected to RBus

    MIBLoader->>MIBLoader: Load CcspRDKBMibList.xml
    MIBLoader->>MIBLoader: Parse XML and Load MIB Files

    loop For Each MIB File
        MIBLoader->>Handlers: Register MIB Handlers
        Handlers->>NetSNMP: netsnmp_register_handler()
        NetSNMP-->>Handlers: Handler Registered
    end

    MIBLoader-->>SubAgent: Plugin Initialized
    Note over SubAgent: State: RegisteringHandlers → Connecting

    SubAgent->>NetSNMP: init_snmp(AGNT_NAME)
    NetSNMP->>NetSNMP: Connect to Master SNMP Daemon via AgentX
    NetSNMP-->>SubAgent: AgentX Connection Established

    SubAgent->>SubAgent: drop_root()
    Note over SubAgent: Drop root privileges

    Note over SubAgent: State: Active<br/>Ready to process SNMP requests
    SubAgent->>System: Write PID to /var/tmp/snmp_subagent_*.pid

    loop Main Event Loop
        SubAgent->>NetSNMP: agent_check_and_process(block=1)
        NetSNMP->>NetSNMP: Wait for AgentX Messages
        Note over SubAgent: Process SNMP requests as they arrive
    end

    System->>SubAgent: Signal Stop (SIGTERM/SIGINT)
    Note over SubAgent: State: Active → Shutdown
    SubAgent->>NetSNMP: snmp_shutdown(AGNT_NAME)
    NetSNMP->>NetSNMP: Disconnect AgentX
    SubAgent->>CCSP: Cosa_Shutdown()
    SubAgent->>System: Exit Process

Runtime State Changes and Context Switching

During normal operation, the SNMP Protocol Agent remains in an active state processing incoming SNMP requests through the net-snmp event loop. State changes occur primarily in response to external events such as configuration updates, master daemon reconnection, or component restart triggers.

State Change Triggers:

  • Master SNMP daemon restart requiring AgentX reconnection
  • CCSP message bus reconnection when Component Registry or target components restart
  • V2Support syscfg parameter change affecting SNMPv2 availability
  • Component stop signal (SIGTERM/SIGINT) triggering graceful shutdown

Context Switching Scenarios:

  • AgentX connection failure triggering reconnection attempts with exponential backoff
  • SNMP request handling context switch from idle to active processing state
  • CCSP message bus call timeout handling with parameter access retry logic

Call Flow

Initialization Call Flow:

sequenceDiagram
    participant Init as Initialization Process
    participant Comp as SNMP Subagent
    participant NetSNMP as net-snmp Library
    participant Plugin as SNMP Plugin
    participant Bus as Message Bus

    Init->>Comp: Start snmp_subagent
    Comp->>NetSNMP: Configure AgentX Parameters
    Comp->>NetSNMP: init_agent()
    Comp->>Plugin: init_ccsp_snmp_plugin()
    Plugin->>Bus: Cosa_Init() / CCSP_Message_Bus_Init()
    Bus-->>Plugin: Bus Handle
    Plugin->>Plugin: Load MIB XML Files
    Plugin->>NetSNMP: Register MIB Handlers
    NetSNMP-->>Plugin: Handlers Registered
    Plugin-->>Comp: Plugin Initialized
    Comp->>NetSNMP: init_snmp() / Connect AgentX
    NetSNMP-->>Comp: AgentX Connected
    Comp->>Comp: drop_root()
    Comp->>Init: Initialization Complete (Active State)

Request Processing Call Flow:

sequenceDiagram
    participant NMS as Network Mgmt System
    participant MasterSNMP as Master SNMP Daemon
    participant SubAgent as SNMP Subagent
    participant Handler as MIB Handler
    participant CCSP as CCSP Message Bus
    participant Component as RDK-B Component

    NMS->>MasterSNMP: SNMP GET Request (OID)
    MasterSNMP->>SubAgent: AgentX GET Request
    Note over SubAgent: agent_check_and_process()

    SubAgent->>Handler: Handler Callback Function
    Note over Handler: Lookup OID in MIB mapping

    Handler->>CCSP: Cosa_FindDestComp(parameter)
    CCSP->>CCSP: CcspBaseIf_discComponentSupportingNamespace()
    CCSP-->>Handler: Component Name, RBus Path

    Handler->>CCSP: Cosa_GetParamValues(component, path, param)
    CCSP->>CCSP: CcspBaseIf_getParameterValues()
    CCSP->>Component: RBus Method Call (getParameterValues)
    Component-->>CCSP: Parameter Value
    CCSP-->>Handler: Parameter Value

    Handler->>Handler: Convert Value to SNMP Format
    Handler-->>SubAgent: SNMP Response Data

    SubAgent->>MasterSNMP: AgentX Response
    MasterSNMP->>NMS: SNMP Response (Value)

SNMP SET Operation Flow:

sequenceDiagram
    participant NMS as Network Mgmt System
    participant MasterSNMP as Master SNMP Daemon
    participant SubAgent as SNMP Subagent
    participant Handler as MIB Handler
    participant CCSP as CCSP Message Bus
    participant Component as RDK-B Component

    NMS->>MasterSNMP: SNMP SET Request (OID, Value)
    MasterSNMP->>SubAgent: AgentX SET Request

    SubAgent->>Handler: Handler SET Callback (Reserve Phase)
    Handler->>Handler: Validate Value Format
    Handler-->>SubAgent: Validation Result

    SubAgent->>Handler: Handler SET Callback (Commit Phase)
    Handler->>CCSP: Cosa_FindDestComp(parameter)
    CCSP-->>Handler: Component Name, RBus Path

    Handler->>Handler: Convert SNMP Value to DataModel Type
    Handler->>CCSP: Cosa_SetParamValues(component, path, param, value)
    CCSP->>CCSP: CcspBaseIf_setParameterValues()
    CCSP->>Component: RBus Method Call (setParameterValues)
    Component-->>CCSP: Set Result

    CCSP->>Component: CcspBaseIf_setCommit() if auto-commit enabled
    Component-->>CCSP: Commit Result

    CCSP-->>Handler: Operation Status
    Handler-->>SubAgent: SET Success/Failure

    SubAgent->>MasterSNMP: AgentX Response
    MasterSNMP->>NMS: SNMP Response (Success/Error)

Internal Modules

The SNMP Protocol Agent is organized into specialized modules separating core SNMP protocol handling, MIB translation logic, custom subsystem handlers, and CCSP integration. Each module encapsulates specific functionality with defined interfaces for inter-module communication and extension.

Module/ClassDescriptionKey Files
SNMP Subagent ProcessMain executable implementing AgentX subagent protocol with master daemon communication, event loop management, privilege dropping, and process lifecycle controlccsp_snmp_subagent.c
SNMP Plugin CoreCentral plugin manager responsible for MIB XML loading, MIB helper object creation, handler registration coordination, and plugin lifecycle managementCcspSnmpPlugin.c
MIB Helper FrameworkCore MIB processing framework providing OID registration, handler dispatch, caching infrastructure, and base implementation for scalar and table MIB objectsccsp_mib_helper.cccsp_mib_helper.h
Scalar HelperImplements scalar MIB object handling including GET/SET operations, value validation, type conversion, and parameter access control for single-instance OIDsccsp_scalar_helper.cccsp_scalar_helper_access.cccsp_scalar_helper_control.cccsp_scalar_helper.hccsp_scalar_helper_internal.h
Table HelperImplements tabular MIB object handling including row enumeration, index management, table caching, and multi-instance object operations for SNMP tablesccsp_table_helper.cccsp_table_helper_access.cccsp_table_helper_control.cccsp_table_helper.hccsp_table_helper_internal.h
MIB UtilitiesUtility functions for OID manipulation, data type conversion, parameter name parsing, and common MIB operation helpersccsp_mib_utilities.cccsp_mib_utilities.h
MIB DefinitionsCommon MIB-related constants, macros, and data structure definitions shared across all MIB handlersccsp_mib_definitions.h
WiFi MIB HandlerHandles RDKB-RG-WiFi-MIB operations for wireless access point configuration, client association, security settings, and WiFi statistics with OneWiFi and legacy WiFi stack supportrg_wifi_handler.c
Device Management HandlerHandles RDKB-RG-MIB-DeviceMgmt operations for device information, firmware management, reboot control, configuration backup/restore, and device status monitoringrg_devmgmt_handler.crg_devmgmt_handler.h
Firewall MIB HandlerHandles RDKB-RG-MIB-Firewall operations for firewall rule management, port forwarding, DMZ configuration, and security policy controlrg_firewall_handler.c
MoCA MIB HandlerHandles RDKB-RG-MIB-MoCA operations for MoCA interface status, node information, network topology, and MoCA performance statisticsrg_moca_handler.c
Hotspot MIB HandlerHandles RDKB-RG-MIB-Hotspot operations for public WiFi hotspot configuration, SSID management, client access control, and hotspot statusrg_hotspot_handler.c
Diagnostics HandlerHandles diagnostic MIB operations for ping tests, traceroute, device diagnostics, and network troubleshooting commandsrg_diag_handler.c
WAN DNS HandlerHandles RDKB-RG-MIB-WanDns operations for DNS server configuration, DNS forwarding settings, and DNS query statisticsrg_wandns_handler.c
NTP Server HandlerHandles RDKB-RG-MIB-NTP operations for NTP server configuration, time synchronization settings, and NTP client statusrg_ntpserver_handler.c
IP Management HandlerHandles IP address management MIB operations for IPv4/IPv6 addressing, DHCP client/server, and IP interface configurationrg_ipmgmt_handler.c
COSA API IntegrationCCSP Object Access API providing abstraction layer for component discovery, parameter get/set operations, table row operations, and commit handling through CCSP message buscosa_api.ccosa_api.h
SNMP Common UtilitiesCommon utility functions for data model access including wrapper functions for get/set operations shared across multiple MIB handlersccsp_snmp_common.cccsp_snmp_common.h

Component Interactions

The SNMP Protocol Agent maintains interactions with network management systems, the master SNMP daemon, RDK-B middleware components, and system services. These interactions span multiple protocols including AgentX for SNMP communication, RBus for middleware integration, and direct API calls for system configuration access.

Interaction Matrix

Target Component/LayerInteraction PurposeKey APIs/Endpoints
External Systems
Network Management SystemSNMP-based remote monitoring and configuration of gateway deviceSNMPv2/v3 protocol via master daemon
Master SNMP Daemon (snmpd)AgentX subagent protocol communication for SNMP request delegationAgentX protocol over tcp:127.0.0.1:705
RDK-B Middleware Components
Component Registry (CcspCr)Component discovery to locate which component owns specific data model parametersCcspBaseIf_discComponentSupportingNamespace() via RBus path eRT.com.cisco.spvtg.ccsp.CR
CcspPandMAccess to Device.* parameters including device information, LAN settings, and general platform configurationCcspBaseIf_getParameterValues()CcspBaseIf_setParameterValues()
CcspWiFiAgent/OneWifiWiFi MIB operations for access point configuration, associated devices, security settings, and wireless statisticsDevice.WiFi.* parameters via message bus
CcspMoCAAgentMoCA MIB operations for interface status, associated devices, and MoCA network topologyDevice.MoCA.* parameters via message bus
CcspTr069PaTR-069 management server parameters for ACS connection, parameter attributes, and device provisioningDevice.ManagementServer.* parameters via message bus
CcspFirewallFirewall MIB operations for security rules, port forwarding, and firewall configurationDevice.Firewall.*Device.NAT.* parameters via message bus
CcspWanManagerWAN interface configuration and device control parametersDevice.X_CISCO_COM_DeviceControl.* parameters (when FEATURE_RDKB_WAN_MANAGER enabled)
System & Platform Services
CCSP Message Bus (RBus)Primary IPC mechanism for all RDK-B component communication and data model accessCCSP_Message_Bus_Init()CcspBaseIf_* API family
syscfgPersistent configuration storage for system settings including SNMP v2 support flagssyscfg_get()syscfg_set()
syseventEvent notification system for system state changes and inter-process communicationsysevent_get()sysevent_set()
Privilege ManagerSecurity service for dropping root privileges after initializationdrop_root_caps()init_capability()update_process_caps()

Events Published by SNMP Protocol Agent:

The SNMP Protocol Agent does not publish events to other components. It operates in response mode, processing incoming SNMP requests and translating them to data model operations. State changes in RDK-B components are reflected through standard data model change notifications subscribed by management systems through SNMP traps configured in the master daemon.

IPC Flow Patterns

Primary IPC Flow – SNMP GET Request to Data Model Parameter:

sequenceDiagram
    participant NMS as Network Mgmt System
    participant Master as Master SNMP Daemon
    participant SubAgent as SNMP Subagent
    participant CR as Component Registry
    participant Target as Target Component

    NMS->>Master: SNMP GET Request (OID)
    Master->>SubAgent: AgentX GET Request
    Note over SubAgent: Lookup OID in XML mapping<br/>Get data model parameter name

    SubAgent->>CR: CcspBaseIf_discComponentSupportingNamespace(param)
    Note over CR: Search component database
    CR-->>SubAgent: Component Name, RBus Path

    SubAgent->>Target: CcspBaseIf_getParameterValues(param) via RBus
    Note over Target: Access internal data<br/>Return current value
    Target-->>SubAgent: Parameter Value, Type

    Note over SubAgent: Convert value to SNMP format<br/>Apply data type transformation
    SubAgent-->>Master: AgentX Response with Value
    Master-->>NMS: SNMP Response

IPC Flow – SNMP SET Request with Commit:

sequenceDiagram
    participant NMS as Network Mgmt System
    participant Master as Master SNMP Daemon
    participant SubAgent as SNMP Subagent
    participant Target as Target Component

    NMS->>Master: SNMP SET Request (OID, Value)
    Master->>SubAgent: AgentX SET Request (Reserve Phase)
    Note over SubAgent: Validate value format<br/>Check parameter access
    SubAgent-->>Master: Reserve OK

    Master->>SubAgent: AgentX SET Request (Commit Phase)
    SubAgent->>Target: CcspBaseIf_setParameterValues(param, value) via RBus
    Note over Target: Validate parameter<br/>Set new value
    Target-->>SubAgent: Set Result

    SubAgent->>Target: CcspBaseIf_setCommit() via RBus
    Note over Target: Apply configuration changes<br/>Persist to storage if needed
    Target-->>SubAgent: Commit Result

    SubAgent-->>Master: AgentX Response (Success)
    Master-->>NMS: SNMP Response (Success)

Component Discovery Flow:

sequenceDiagram
    participant SubAgent as SNMP Subagent
    participant Bus as Message Bus
    participant CR as Component Registry

    SubAgent->>SubAgent: Cosa_FindDestComp(parameter_name)
    SubAgent->>Bus: Connect to RBus (if not connected)
    Bus-->>SubAgent: Connection Handle

    SubAgent->>CR: CcspBaseIf_discComponentSupportingNamespace()<br/>via RBus path: eRT.com.cisco.spvtg.ccsp.CR
    Note over CR: Query component database<br/>Match parameter namespace

    CR-->>SubAgent: Component Name (e.g., com.cisco.spvtg.ccsp.pam)<br/>RBus Path (e.g., /com/cisco/spvtg/ccsp/pam)

    Note over SubAgent: Cache component info<br/>for subsequent requests

Implementation Details

Major HAL APIs Integration

The SNMP Protocol Agent does not directly integrate with HAL APIs. It operates at the middleware layer translating SNMP requests to data model parameter operations. Target RDK-B components invoked through message bus calls are responsible for HAL interactions as needed.

Key Implementation Logic

  • MIB XML Parsing and Loading: The component loads MIB mapping configurations at startup by parsing CcspRDKBMibList.xml to determine which MIB XML files to load, then processing each XML file to extract OID-to-parameter mappings, data types, and handler bindings using the ansc_xml_dom_parser library
  • XML parsing implementation in source/SnmpPlugin/CcspSnmpPlugin.c function init_ccsp_snmp_plugin()
  • MIB helper object creation and handler registration in source/SnmpPlugin/ccsp_mib_helper.c
  • OID Translation and Parameter Discovery: Each SNMP request triggers OID lookup in loaded MIB mappings to identify the corresponding data model parameter, followed by component discovery through the Component Registry to determine which RDK-B component owns that parameter
  • OID-to-parameter mapping lookup in source/SnmpPlugin/ccsp_mib_utilities.c
  • Component discovery implementation in source/SnmpPlugin/cosa_api.c function Cosa_FindDestComp()
  • Caching of component discovery results to minimize registry queries
  • Data Type Conversion: The component implements bidirectional conversion between SNMP data types (INTEGER, OCTET_STR, IPADDRESS, COUNTER, GAUGE, TIMETICKS) and data model types (string, int, unsignedInt, boolean, dateTime, base64) ensuring proper value representation
  • Type conversion logic in source/SnmpPlugin/ccsp_mib_utilities.c and source/SnmpPlugin/ccsp_scalar_helper.c
  • Special handling for complex types like MAC addresses, IP addresses, and enumerations
  • Error Handling Strategy: SNMP error codes are generated based on CCSP message bus operation results with proper mapping of CCSP error codes to SNMP error codes (noError, noSuchName, badValue, genErr, noAccess)
  • Error mapping implementation in MIB helper functions
  • Timeout handling for message bus calls with configurable retry
  • Fallback to default values when parameter access fails for read operations
  • Logging & Debugging: The component uses RDK Logger when available, falling back to AnscTrace logging for development builds with configurable log levels through CCSPDBG environment variable
  • Logger initialization in source/SnmpPlugin/CcspSnmpPlugin.c using RDK_LOGGER_INIT()
  • Debug level configuration in set_debug_level() function
  • net-snmp debug token registration for protocol-level debugging
  • Privilege Management: After initialization and AgentX connection establishment, the component drops root privileges using the privilege manager API retaining only necessary capabilities for operation
  • Privilege dropping implementation in source/SnmpPlugin/ccsp_snmp_subagent.c function drop_root()
  • Capability configuration through privilege manager library

Key Configuration Files

Confirguration FilePurposeOverride Mechanisms
config/snmpd.confMaster SNMP daemon configuration including community strings, AgentX settings, and plugin loading directivesSystem integrator configuration
/tmp/ccsp_msg.cfgCCSP message bus configuration specifying component names, RBus paths, and subsystem prefixesCopied from /usr/ccsp/ccsp_msg.cfg at startup
Mib2DmMapping/CcspRDKBMibList.xmlMaster index of MIB mapping XML files to be loaded by the pluginBuild-time selection between CcspRDKBMibList.xml and CcspMibList.xml via RDKB_MIB flag
Mib2DmMapping/Ccsp_RDKB-RG-WiFi-MIB.xmlMIB-to-DataModel mapping for WiFi subsystem including access point and associated device parametersXML preprocessing directives for feature-specific includes
Mib2DmMapping/Ccsp_RDKB-RG-MIB-DeviceMgmt.xmlMIB-to-DataModel mapping for device management operations including reboot, reset, and firmware managementPlatform-specific parameter mappings
Mib2DmMapping/Ccsp_RDKB-RG-MIB-Firewall.xmlMIB-to-DataModel mapping for firewall configuration and port forwarding rulesSecurity feature flag conditionals
Mib2DmMapping/Ccsp_RDKB-RG-MIB-MoCA.xmlMIB-to-DataModel mapping for MoCA interface status and network topologyMoCA availability conditionals
Mib2DmMapping/Ccsp_RDKB-RG-MIB-Hotspot.xmlMIB-to-DataModel mapping for public WiFi hotspot configuration and managementHotspot feature flag conditionals
/var/tmp/snmp_subagent_v2.pidProcess ID file for SNMPv2 subagent instanceGenerated at runtime
/var/tmp/snmp_subagent_v3.pidProcess ID file for SNMPv3 subagent instanceGenerated at runtime
Go To Top