[Phase 2] Implement gNMI Get for state retrieval #8

Open
opened 2025-12-20 15:41:28 +00:00 by Damien · 0 comments
Owner

Description

Implement gNMI Get operation to retrieve current device configuration state.

Tasks

  • Wrap pygnmi client for easier use
  • Implement Get for specific paths
  • Implement Get for multiple paths in one request
  • Parse and normalize response data
  • Handle connection errors gracefully
  • Support both config and state datastores

API Design

class GNMIClient:
    async def get_config(self, paths: list[str]) -> dict:
        """Get configuration at specified paths"""
        
    async def get_state(self, paths: list[str]) -> dict:
        """Get operational state at specified paths"""
        
    async def get_vlan_config(self) -> list[dict]:
        """Convenience: get all VLAN configuration"""

Example Usage

async with GNMIClient(target="leaf1:6030", credentials=creds) as client:
    vlans = await client.get_config([
        "/openconfig-network-instance:network-instances/network-instance[name=default]/vlans"
    ])

Output

  • src/gnmi/client.py
## Description Implement gNMI Get operation to retrieve current device configuration state. ## Tasks - [ ] Wrap pygnmi client for easier use - [ ] Implement Get for specific paths - [ ] Implement Get for multiple paths in one request - [ ] Parse and normalize response data - [ ] Handle connection errors gracefully - [ ] Support both config and state datastores ## API Design ```python class GNMIClient: async def get_config(self, paths: list[str]) -> dict: """Get configuration at specified paths""" async def get_state(self, paths: list[str]) -> dict: """Get operational state at specified paths""" async def get_vlan_config(self) -> list[dict]: """Convenience: get all VLAN configuration""" ``` ## Example Usage ```python async with GNMIClient(target="leaf1:6030", credentials=creds) as client: vlans = await client.get_config([ "/openconfig-network-instance:network-instances/network-instance[name=default]/vlans" ]) ``` ## Output - `src/gnmi/client.py`
Damien added the phase-2-minimal-reconciler label 2025-12-20 15:41:42 +00:00
Sign in to join this conversation.