The function is called from e2e/network test only, so this moves the function into the test for reducing e2e/framework/util.go code and removing invalid dependency on e2e test framework.