major refactoring for mixed leaf device, verified mac based ztp, wip 2stage ztp, DONT use this for TEST