Guessing here since you did not post the YANG model, but if the “IP address” is a key in the list “HH” you can use maapi_move() for that. See the confd_lib_maapi(3) man page for details.
list hosts {
tailf:callpoint trans-hosts {
tailf:transaction-hook subtree {
tailf:invocation-mode per-transaction;
}
}
key name;
leaf name {
type string;
}
leaf ip {
tailf:callpoint ip-mask {
tailf:set-hook node;
}
type inet:ipv4-address;
}
leaf netmask {
tailf:callpoint ip-mask {
tailf:set-hook node;
}
type inet:ipv4-address;
}
}
Using this am getting the input from user as host test ip 10.0.0.4 netmask 255.255.255.0
I will make some calculation with netmask and ip in my python script. After that I need to replace the
host test ip 10.0.0.4 netmask 255.255.255.0 with my calculated ip adddress in the running-config
There is a bunch of Python code examples on this site showing how to do stuff like that; I guess a good start are Jason’s Maagic Examples, in particular those using the single_write_trans function might be relevant for you (note he uses ncs API - but that is pretty much identical to confd, just replace ncs with confd in his code). ConfD distribution also contains several examples showing how to talk to ConfD from Python.