CcspDmCli (CCSP Data Model Command Line Interface) is a diagnostic and testing tool within the RDK-B middleware stack that provides direct command-line access to the CCSP message bus system. This component serves as a bridge between administrators/engineers and the TR-181 data model implementation - enabling real-time inspection, modification, and testing of device parameters without requiring full management interface interactions.

CcspDmCli operates as a lightweight client application that connects to the CCSP message bus infrastructure, allowing users to perform data model operations including parameter retrieval, modification, table management, and attribute manipulation. It serves both as a diagnostic tool for system administrators troubleshooting device configurations and as a development utility for engineers implementing and testing TR-181 parameter support across RDK-B components.

The component provides essential services to the RDK-B ecosystem by offering direct access to the data model layer, enabling rapid prototyping of management interfaces, supporting automated testing frameworks, and providing runtime debugging capabilities for TR-181 parameter implementations. It acts as a versatile interface that bridges the gap between low-level component implementations and high-level management operations.

```mermaid
graph LR
    subgraph "External Systems"
        Test["Test Automation"]
        MgmtScript["Management Scripts"]
        Dev["Engineers"]
    end

    subgraph "RDK-B Platform"
        dmcli["CCSP Dmcli"]
        rbus["RBUS"]
        rdkbComponent["Other RDK-B Components (WAN Manager, LMLite, OneWiFi etc.)"]
        subgraph "Platform Layer"
            HAL[Platform HAL]
            Linux[Linux]
        end
    end

    %% External connections
    Test --> dmcli
    MgmtScript -->dmcli
    Dev -->dmcli

    dmcli -->rbus

    rbus <-->|IPC| rdkbComponent

    %% Interface Managers to HAL
    rdkbComponent -->|HAL APIs| HAL

    %% System integration
    HAL -->|Drivers| Linux

    classDef external fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;
    classDef dmcli fill:#e3f2fd,stroke:#1976d2,stroke-width:3px;
    classDef rdkbComponent fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px;
    classDef system fill:#fce4ec,stroke:#c2185b,stroke-width:2px;

    class Test,MgmtScript,Dev external;
    class dmcli dmcli;
    class rbus,rdkbComponent rdkbComponent;
    class HAL,Linux system;
```

Key Features & Responsibilities:

Design

CcspDmCli follows a client-server architectural pattern where it operates as a lightweight CCSP message bus client that interfaces with the distributed RDK-B component ecosystem. The design prioritizes simplicity, reliability, and comprehensive coverage of TR-181 data model operations while maintaining minimal system resource usage. The component architecture ensures clean separation between user interface handling, message bus communication, and command processing logic.

The core design principle centers around providing transparent access to the CCSP message bus infrastructure through an intuitive command-line interface. CcspDmCli abstracts the complexity of CCSP protocol interactions, component discovery mechanisms, and namespace resolution while preserving full access to the underlying TR-181 data model functionality. The design emphasizes robustness through comprehensive error handling, timeout management, and graceful degradation in distributed system scenarios.

The interaction design with northbound interfaces (users and scripts) utilizes a command-driven approach with standardized syntax patterns that mirror TR-181 parameter structures. Southbound interactions with the CCSP message bus leverage the standard CCSP protocol stack including component registration, namespace discovery, and parameter operation routing. The design integrates seamlessly with PSM for persistent data operations and primarily uses synchronous request-response patterns for system integration.

IPC mechanisms are implemented through the standard CCSP message bus infrastructure, utilizing RBus transport layers depending on platform configuration. The design accommodates both protocols through abstraction layers that maintain consistent API behavior regardless of underlying transport implementation. Message serialization follows CCSP protocol standards with support for all TR-181 data types and complex parameter structures.

Data persistence and storage management are handled through dedicated PSM integration commands that provide direct access to the Parameter Storage Manager without requiring intermediate component interactions. The design supports both volatile runtime parameter operations and persistent configuration storage operations, with clear command syntax distinctions between ephemeral and persistent data operations.

```mermaid
graph TD
    subgraph "CcspDmCli"
        subgraph "User Interface Layer"
            CLI[Command Line Interface<br />Interactive & Batch Mode]
            Parser[Command Parser<br />Syntax Validation]
            OutputFormatter[Output Formatter<br />Color-coded Results]
        end

        subgraph "Command Processing Engine"
            CmdDispatcher[Command Dispatcher<br />Operation Routing]
            ParameterOps[Parameter Operations]
            TableOps[Table Operations]
            AttributeOps[Attribute Operations<br />Notification & Access Control]
            PSMOps[PSM Operations]
        end

        subgraph "CCSP Integration Layer"
            BusClient[Message Bus Client]
            ComponentDiscovery[Component Discovery]
            MessageHandler[Message Handler]
        end

        subgraph "Support Modules"
            ErrorHandler[Error Handler]
            TimeoutManager[Timeout Manager]
            MemoryManager[Memory Manager]
        end
    end

    subgraph "External Components"
        MessageBus[CCSP Message Bus]
    end

    %% User interface flow
    CLI --> Parser
    Parser --> CmdDispatcher
    CmdDispatcher --> ParameterOps
    CmdDispatcher --> TableOps
    CmdDispatcher --> AttributeOps  
    CmdDispatcher --> PSMOps

    %% Command processing to CCSP layer
    ParameterOps --> BusClient
    TableOps --> BusClient
    AttributeOps --> BusClient
    PSMOps --> BusClient

    %% CCSP integration
    BusClient --> ComponentDiscovery
    BusClient --> MessageHandler
    ComponentDiscovery --> MessageHandler

    %% Error handling and support
    MessageHandler --> ErrorHandler
    MessageHandler --> TimeoutManager
    BusClient --> MemoryManager

    %% Message bus communication
    MessageHandler <-->|CCSP Protocol<br />Parameter Operations| MessageBus
    ComponentDiscovery <-->|Component Discovery<br />Namespace Queries| MessageBus

    %% Output formatting
    ErrorHandler --> OutputFormatter
    TimeoutManager --> OutputFormatter
    MessageHandler --> OutputFormatter
    OutputFormatter --> CLI
```

Prerequisites and Dependencies

RDK-B Platform and Integration Requirements (MUST):

Threading Model

CcspDmCli implements a single-threaded architecture optimized for command-line tool usage patterns and message bus interaction reliability. The single-threaded design eliminates complex synchronization requirements while ensuring predictable command execution order and consistent error handling behavior.

Component State Flow

Initialization to Active State

CcspDmCli follows a straightforward initialization sequence focused on establishing message bus connectivity and preparing for command processing. The initialization process emphasizes early validation of system prerequisites and graceful error handling for missing dependencies.

```mermaid
sequenceDiagram
    participant CcspDmCli as CcspDmCli Process

    CcspDmCli->>CcspDmCli: [*] → Initializing
    CcspDmCli->>CcspDmCli: Initializing → ParseArguments
    CcspDmCli->>CcspDmCli: ParseArguments → ValidateConfig
    CcspDmCli->>CcspDmCli: ValidateConfig → InitMessageBus
    CcspDmCli->>CcspDmCli: InitMessageBus → BusConnected
    CcspDmCli->>CcspDmCli: BusConnected → DetermineMode

    alt Interactive Session
        CcspDmCli->>CcspDmCli: DetermineMode → InteractiveMode
        CcspDmCli->>CcspDmCli: InteractiveMode → Active
    else Batch File Processing
        CcspDmCli->>CcspDmCli: DetermineMode → BatchMode
        CcspDmCli->>CcspDmCli: BatchMode → Active
    else Single Command Mode
        CcspDmCli->>CcspDmCli: DetermineMode → SingleCommand
        CcspDmCli->>CcspDmCli: SingleCommand → Active
    end

    CcspDmCli->>CcspDmCli: Active → ProcessCommand
    CcspDmCli->>CcspDmCli: ProcessCommand → ComponentDiscovery
    CcspDmCli->>CcspDmCli: ComponentDiscovery → SendRequest
    CcspDmCli->>CcspDmCli: SendRequest → WaitResponse

    alt Response Received
        CcspDmCli->>CcspDmCli: WaitResponse → ProcessResponse
        CcspDmCli->>CcspDmCli: ProcessResponse → Active
    else Timeout Exceeded
        CcspDmCli->>CcspDmCli: WaitResponse → Timeout
        CcspDmCli->>CcspDmCli: Timeout → Active
    end

    CcspDmCli->>CcspDmCli: Active → Shutdown
    CcspDmCli->>CcspDmCli: Shutdown → [*]
```

Runtime State Changes and Context Switching

CcspDmCli operates in a stateless command processing model where each command execution represents a complete request-response cycle with target RDK-B components. The component maintains minimal state information between commands to ensure predictable behavior and simplified error recovery.

State Change Triggers:

Context Switching Scenarios:

Call Flow

Initialization Call Flow:

```mermaid
sequenceDiagram
    participant User as User/Script
    participant CcspDmCli as CcspDmCli Process
    participant MessageBus as CCSP Message Bus
    participant CR as Component Registrar

    User->>CcspDmCli: Start Application (CLI Args)
    CcspDmCli->>CcspDmCli: Parse Arguments & Validate
    CcspDmCli->>CcspDmCli: Setup Signal Handlers & Memory
    CcspDmCli->>MessageBus: CCSP_Message_Bus_Init("ccsp.busclient")
    MessageBus-->>CcspDmCli: Bus Handle & Connection Established
    CcspDmCli->>CR: Register Client Component
    CR-->>CcspDmCli: Registration Confirmation
    CcspDmCli->>User: Ready for Commands (Interactive Prompt)
```

Request Processing Call Flow:

```mermaid
sequenceDiagram
    participant User as User/CLI
    participant CcspDmCli as CcspDmCli
    participant ComponentDiscovery as Component Discovery
    participant MessageBus as Message Bus
    participant TargetComponent as Target RDK-B Component

    User->>CcspDmCli: Command (e.g., getvalues Device.WiFi.Enable)
    CcspDmCli->>CcspDmCli: Parse Command & Validate Syntax
    CcspDmCli->>ComponentDiscovery: Discover Supporting Component
    ComponentDiscovery->>MessageBus: CcspBaseIf_discComponentSupportingNamespace
    MessageBus->>TargetComponent: Component Discovery Request
    TargetComponent-->>MessageBus: Component Info Response
    MessageBus-->>ComponentDiscovery: Component Details
    ComponentDiscovery-->>CcspDmCli: Target Component Identified
    CcspDmCli->>MessageBus: Parameter Operation Request
    MessageBus->>TargetComponent: TR-181 Operation (Get/Set/Add/Delete)
    TargetComponent-->>MessageBus: Operation Response
    MessageBus-->>CcspDmCli: Response with Parameter Data
    CcspDmCli->>CcspDmCli: Format Output & Apply Color Coding
    CcspDmCli->>User: Display Results
```

TR‑181 Data Models

Supported TR-181 Parameters

CcspDmCli does not implement or define TR-181 parameters directly but serves as a universal client interface for accessing TR-181 parameters implemented by other RDK-B components. The component provides comprehensive access to the entire TR-181 data model namespace through its command interface, supporting all parameter types and operations defined in the BBF TR-181 specification.

Object Hierarchy

CcspDmCli provides access to the complete TR-181 object hierarchy as implemented by target RDK-B components:

Device.
├── DeviceInfo. (via P&M Component)
│   ├── SoftwareVersion (string, R)
│   ├── HardwareVersion (string, R)
│   └── SerialNumber (string, R)
├── WiFi. (via OneWiFi)
│   ├── RadioNumberOfEntries (int, R)
│   ├── SSIDNumberOfEntries (int, R)
│   ├── Radio.{i}.
│   │   ├── Enable (boolean, R/W)
│   │   ├── Status (string, R)
│   │   └── Channel (int, R/W)
│   └── SSID.{i}.
│       ├── Enable (boolean, R/W)
│       ├── SSID (string, R/W)
│       └── Status (string, R)
├── Ethernet. (via P&M Component)
│   └── Interface.{i}.
│       ├── Enable (boolean, R/W)
│       ├── Status (string, R)
│       └── Name (string, R)
└── [All other Device.* objects as implemented by respective components]

Parameter Definitions

CcspDmCli Command Interface Parameters:

CcspDmCli does not define TR-181 parameters but provides command-line access to all parameters implemented by RDK-B components. The supported operations include:

CommandPurposeSyntaxTR-181 Operation
getvaluesRetrieve parameter valuesgetvalues <pathname> [pathname...]TR-181 Get Parameter Values
setvaluesSet parameter valuessetvalues <pathname> <type> <value> [pathname type value...] [commit]TR-181 Set Parameter Values
getnamesGet parameter namesgetnames <pathname> [nextlevel]TR-181 Get Parameter Names
addtableAdd table instanceaddtable <pathname>TR-181 Add Object
deltableDelete table instancedeltable <pathname>TR-181 Delete Object
getattributesGet parameter attributesgetattributes <pathname> [pathname...]TR-181 Get Parameter Attributes
setattributesSet parameter attributessetattributes <pathname> <notify> <accesslist> [pathname notify accesslist...]TR-181 Set Parameter Attributes

Parameter Registration and Access

Internal Modules

CcspDmCli is structured as a monolithic command-line application with functionally organized code sections rather than discrete modules. The main implementation provides comprehensive TR-181 operation support through well-defined functional areas within the single source file.

Module/ClassDescriptionKey Files
Command ParserProcesses user input, validates command syntax, and prepares parameter structures for CCSP operations. Handles both interactive and batch file input processing.ccsp_message_bus_client_tool.c
CCSP Integration LayerManages message bus connectivity, component discovery, and CCSP protocol communication. Implements request-response handling and timeout management.ccsp_message_bus_client_tool.c
Parameter Operations EngineImplements core TR-181 operations including getvalues, setvalues, getnames, addtable, deltable with comprehensive error handling and result formatting.ccsp_message_bus_client_tool.c
PSM Operations ModuleProvides direct PSM access commands (psmget, psmset, psmdel) for persistent configuration management bypassing standard component routing.ccsp_message_bus_client_tool.c
Output FormatterHandles result formatting, color-coded output generation, and performance metrics display for enhanced user experience.ccsp_message_bus_client_tool.c
Error HandlerManages comprehensive error detection, logging, signal handling, and graceful degradation for robust operation in distributed environments.ccsp_message_bus_client_tool.c

Component Interactions

CcspDmCli operates as a CCSP message bus client that interfaces with the complete RDK-B middleware ecosystem through standardized TR-181 operations and component discovery mechanisms. The interactions encompass both direct component communication for parameter operations and infrastructure service utilization for system integration.

Interaction Matrix

Target Component/LayerInteraction PurposeKey APIs/Endpoints
RDK-B Middleware Components

Component Registrar (CR)Component discovery and namespace resolution for TR-181 parameter routingCcspBaseIf_discComponentSupportingNamespace, CcspBaseIf_discNamespaceComponents
PSM ComponentDirect persistent parameter storage access bypassing standard component routingPSM_Get_Record_Value2, PSM_Set_Record_Value2, PSM_Del_Record
P&M ComponentDevice management parameters, system information, and platform configurationCcspBaseIf_getParameterValues, CcspBaseIf_setParameterValues
OneWiFiWireless network configuration, radio management, and SSID operationsCcspBaseIf_getParameterValues, CcspBaseIf_setParameterValues, CcspBaseIf_AddTblRow
System & Platform Layers

File SystemBatch command file processing and configuration file accessfopen(), fgets(), fclose()
CCSP Message Bus InfrastructureCore message bus connectivity and protocol transportCCSP_Message_Bus_Init, CCSP_Message_Bus_Exit
External Systems

Test Automation FrameworksAutomated testing support and validation operationsCLI command execution with text output parsing
Management ScriptsBulk operations and administrative task automationCLI command execution with exit codes and text output

IPC Flow Patterns

Primary IPC Flow - TR-181 Parameter Operations:

```mermaid
sequenceDiagram
    participant CLI as Command Line User
    participant CcspDmCli as CcspDmCli Process
    participant MessageBus as CCSP Message Bus
    participant CR as Component Registrar
    participant TargetComp as Target Component

    CLI->>CcspDmCli: Command (getvalues Device.WiFi.Enable)
    CcspDmCli->>CcspDmCli: Parse & Validate Command
    CcspDmCli->>MessageBus: Component Discovery Request
    MessageBus->>CR: CcspBaseIf_discComponentSupportingNamespace
    CR-->>MessageBus: Component Information
    MessageBus-->>CcspDmCli: Target Component Details
    CcspDmCli->>MessageBus: Parameter Operation Request
    MessageBus->>TargetComp: CcspBaseIf_getParameterValues
    TargetComp-->>MessageBus: Parameter Values Response
    MessageBus-->>CcspDmCli: Operation Result
    CcspDmCli->>CLI: Formatted Output Display
```

PSM Direct Access Flow:

```mermaid
sequenceDiagram
    participant CLI as Command Line User
    participant CcspDmCli as CcspDmCli Process
    participant MessageBus as CCSP Message Bus
    participant PSM as PSM Component

    CLI->>CcspDmCli: PSM Command (psmget dmsb.device.deviceinfo.serialnumber)
    CcspDmCli->>CcspDmCli: Parse PSM Command
    CcspDmCli->>MessageBus: Direct PSM Request
    MessageBus->>PSM: PSM_Get_Record_Value2
    PSM-->>MessageBus: Persistent Value Response
    MessageBus-->>CcspDmCli: PSM Operation Result
    CcspDmCli->>CLI: Value Display
```

Implementation Details

Major HAL APIs Integration

CcspDmCli operates at the CCSP middleware layer and does not directly integrate with HAL APIs. The component serves as a client interface to other RDK-B components that implement HAL integration. All hardware interactions are mediated through TR-181 parameter operations routed to appropriate data model components.

Key Implementation Logic

Command Line Configuration