Create mock router/switches and log in to those for testing rather than real ones. This has the bonus of allowing you to easily create error conditions.
If security issues make it a reasonable option, ask the user for test usernames/passwords in Makefile.PL/Build.PL and store them for the use of the test suite later. Module::Build has various built in mechanisms that make this very simple.
Get the test scripts to pick up the username/password from an environment variable. Skip the tests if it's not available.