There is a module virttest.libvirt_xml.secret_xml for secret XML, maybe you can use it to create a XML file, avoid hard coding xml details.