Bug 481118: permit connections when portsPerPrimary is 0

When creating connections, the traditional port matching algorithm takes
a case like:

    c1[2]p1[2]   c2[3]p2[1]

To produce:

    c1[0]#p1[0]  <->  c2[0]#p2[0]
    c1[0]#p1[1]
    c1[1]#p1[0]  <->  c2[1]#p2[0]
    c1[1]#p1[1]

The algorithm intentionally does *not* connect:

    c1[0]#p1[1]  <->  c2[2]#p2[0]

This is to provide all instances of the replicated c1 with the same
number of connections.

This patch modifies that behaviour in a specific special case.  When the
traditional algorithm would have produced 0 connections, we now try to
make some connections.  In a case like:

    c1[3]p1[1]   c2[1]p2[1]

We will produce:

    c1[0]#p1[0]  <->  c2[0]#p2[0]
    c1[1]#p1[0]
    c1[2]#p1[0]

Tested using the sample model attached to the bug.  The
Top-connections.log includes:

    Top.pinger[0]#control.far[0] <-> Top#control.far[0]

I've also updated the test suite to check this case.

Change-Id: I6688af204329c3bd7d499ffd619243da9675ac22
Signed-off-by: Andrew Eidsness <andrewe@jfront.com>
2 files changed