How to generate a new extended public key (xpub)? I have a need to generate a new extended public key (xpub).

Examples: 

xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz

tpubD6NzVbkrYhZ4WLczPJWReQycCJdd6YVWXubbVUFnJ5KgU5MDQrD998ZJLNGbhd2pq7ZtDiPYTfJ7iBenLVQpYgSQqPjUsQeJXH8VQ8xA67D


How can I do this?

I would like to do it inside json rpc, because that would help automate testing, but I ultimately don't care how I get them. They are for testing.
You can do that, but each HD seed needs to be inside its own wallet file which is loaded by the server. Running bitcoind with multiple -wallet arguments will achieve what you are aiming for. Currently it is not supported to dynamically load and unload wallets at runtime, but support for that is being added and will be available in a future release.