I am building my own mainline sonic with these options:
- sed -i 's/INCLUDE_ICCPD.*\sn/INCLUDE_ICCPD = y/' rules/config
- sed -i 's/INCLUDE_RESTAPI.*\sn/INCLUDE_RESTAPI = y/' rules/config
- sed -i 's/.*ENABLE_TRANSLIB_WRITE\s=\s.*/ENABLE_TRANSLIB_WRITE = y/' rules/config
- sed -i 's/INCLUDE_FIPS.*\sy/INCLUDE_FIPS = n/' rules/config
So I have translib write enabled, which is the most important thing for gnmi I suppose.
I am building the Virtual Switch image to be run in GNS3 sonic-vs.img.gz
I am using nornir for automation with pygnmi and nornir_pygnmi as the interface to communicate with the sonic gnmi endpoint.
Some set operations work, but others don't. For example enabling and disabling features works. But when I try to update or replace SYSLOG_SERVER or NTP_SERVER it fails, but it also doesn't fail.
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Error: Failed to apply patch on the following scopes:"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-05-14T16:41:39.262722796+03:00", grpc_status:2, grpc_message:"Error: Failed to apply patch on the following scopes:"}"
>
The code itself looks like this:
def sonic_ntp(task: Task) -> MultiResult:
ntp_servers = {}
for ntp_server in task.host.get('ntp_servers'):
ntp_servers[ntp_server] = {
"association_type": "pool",
"iburst": "off",
"admin_state": "disabled",
"version": 4,
}
NTP_SETTINGS = [
(
"/sonic-db:CONFIG_DB/localhost/NTP_SERVER",
ntp_servers
)
]
result = task.run(name="Configure NTP settings for SONiC appliance", task=gnmi_set, update=NTP_SETTINGS, encoding='json_ietf')
return result
I am building my own mainline sonic with these options:
So I have translib write enabled, which is the most important thing for gnmi I suppose.
I am building the Virtual Switch image to be run in GNS3
sonic-vs.img.gz
I am using nornir for automation with pygnmi and nornir_pygnmi as the interface to communicate with the sonic gnmi endpoint.
Some set operations work, but others don't. For example enabling and disabling features works. But when I try to update or replace
SYSLOG_SERVER
orNTP_SERVER
it fails, but it also doesn't fail.The code itself looks like this:
As you can see the endpoint is
/sonic-db:CONFIG_DB/localhost/NTP_SERVER
(https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#ntp-servers)The data is inserted into the model, but the pygnmi connection does not recieve something back that it wants and fails.