private UiLinkId(ElementId a, PortNumber pa, ElementId b, PortNumber pb) {
        elementA = a;
        portA = pa;
        elementB = b;
        portB = pb;

        regionA = null;
        regionB = null;

        boolean isEdgeLink = (a instanceof HostId);

        // NOTE: for edgelinks, hosts are always element A
        idA = isEdgeLink ? a.toString() : a + ID_PORT_DELIMITER + pa;
        idB = b + ID_PORT_DELIMITER + pb;
        idStr = idA + CP_DELIMITER + idB;

        type = isEdgeLink ? Type.HOST_DEVICE : Type.DEVICE_DEVICE;
    }
@Test
    public void canonical() {
        title("canonical");
        UiLinkId one = UiLinkId.uiLinkId(LINK_X1_TO_Y2);
        UiLinkId two = UiLinkId.uiLinkId(LINK_Y2_TO_X1);
        print("link one: %s", one);
        print("link two: %s", two);
        assertEquals("not equiv", one, two);
    }