refactor the code to get packages from dnf
dont use non public api
Add dnf session unit tests