I just posted a few examples of how to automate ping requests in Cisco IOS XR using YDK. The Ping command is defined in the Cisco-IOS-XR-ping-act model introduced in IOS XR 6.2.1. YDK provides the executor service to execute custom RPCs (also referred to as actions or as Exec commands in the CLI interface). The ping model is documented in the Cisco-IOS-XR module bundle. These are the new sample apps:
nc-execute-xr-ping-act-10-ydk.py - app boilerplate
nc-execute-xr-ping-act-20-ydk.py - simple ping request
nc-execute-xr-ping-act-22-ydk.py - ping request with a custom packet count
nc-execute-xr-ping-act-24-ydk.py - ping request with a custom source interface and reply timeout
nc-execute-xr-ping-act-26-ydk.py - ping request with a custom packet data size and verbose reply mode
nc-execute-xr-ping-act-28-ydk.py - vrf-aware ping request
You can find all these examples in the ydk-py-samples repository which includes many other sample apps using the executor service.
Give them a try!