NetworkManager refactoring and UT fix