network: change SortHostPorts to maintain order of same-type addresses

HostPorts are meant to kept in their original order.
Change SortHostPorts to swap hostnames and to the fore
and give preference to either IPv4 or IPv6, but otherwise
keep the order within address type groups the same.
Remove SortHostPorts call from state.SetAPIHostPorts

Move the logic from state into the peergrouper. I'm
not sure why we're sorting the values before adding
them to state at all, but the logic should be kept
outside at any rate.
Merge pull request #394 from axw/lp1345832-stable-sorthostports

Remove SortHostPorts call from state.SetAPIHostPorts

**state, worker/peergrouper:**

Move the logic from state into the peergrouper. I'm not sure why we're
sorting the values before adding them to state at all, but the logic should
be kept outside at any rate.

**network: change SortHostPorts to maintain order of same-type addresses**

HostPorts are meant to kept in their original order. Change SortHostPorts
to swap hostnames and to the fore and give preference to either IPv4 or
IPv6, but otherwise keep the order within address type groups the same.

Fixes https://bugs.launchpad.net/juju-core/+bug/1345832