@Test public void testLinkTypeSymmetric() { for (InterfaceType t1 : InterfaceType.values()) { for (InterfaceType t2 : InterfaceType.values()) { assertThat(interfaceTypesToLinkType(t1, t2), equalTo(interfaceTypesToLinkType(t2, t1))); } } }
public static LinkType interfaceTypesToLinkType( InterfaceType iface1type, InterfaceType iface2type) { if (iface1type != iface2type) { return LinkType.UNKNOWN; } switch (iface1type) { case PHYSICAL: case LOGICAL: return LinkType.PHYSICAL; case AGGREGATED: case AGGREGATE_CHILD: case REDUNDANT: case REDUNDANT_CHILD: case TUNNEL: case VLAN: case VPN: return LinkType.VIRTUAL; case LOOPBACK: case NULL: case UNKNOWN: return LinkType.UNKNOWN; default: throw new IllegalArgumentException(String.format("Unknown InterfaceType: %s", iface1type)); } }
Link extends BfObject { public static LinkType interfaceTypesToLinkType( InterfaceType iface1type, InterfaceType iface2type) { if (iface1type != iface2type) { return LinkType.UNKNOWN; } switch (iface1type) { case PHYSICAL: case LOGICAL: return LinkType.PHYSICAL; case AGGREGATED: case AGGREGATE_CHILD: case REDUNDANT: case REDUNDANT_CHILD: case TUNNEL: case VLAN: case VPN: return LinkType.VIRTUAL; case LOOPBACK: case NULL: case UNKNOWN: return LinkType.UNKNOWN; default: throw new IllegalArgumentException(String.format("Unknown InterfaceType: %s", iface1type)); } } }
Link extends BfObject { public static LinkType interfaceTypesToLinkType( InterfaceType iface1type, InterfaceType iface2type) { if (iface1type != iface2type) { return LinkType.UNKNOWN; } switch (iface1type) { case PHYSICAL: case LOGICAL: return LinkType.PHYSICAL; case AGGREGATED: case AGGREGATE_CHILD: case REDUNDANT: case REDUNDANT_CHILD: case TUNNEL: case VLAN: case VPN: return LinkType.VIRTUAL; case LOOPBACK: case NULL: case UNKNOWN: return LinkType.UNKNOWN; default: throw new IllegalArgumentException(String.format("Unknown InterfaceType: %s", iface1type)); } } Link(String srcId, String dstId);  Link(String srcId, String dstId, LinkType type); @JsonCreator  Link(
      @JsonProperty(PROP_ID) String id,
      @JsonProperty(PROP_SRC_ID) String srcId,
      @JsonProperty(PROP_DST_ID) String dstId,
      @JsonProperty(PROP_TYPE) LinkType type); }
Link extends BfObject { public static LinkType interfaceTypesToLinkType( InterfaceType iface1type, InterfaceType iface2type) { if (iface1type != iface2type) { return LinkType.UNKNOWN; } switch (iface1type) { case PHYSICAL: case LOGICAL: return LinkType.PHYSICAL; case AGGREGATED: case AGGREGATE_CHILD: case REDUNDANT: case REDUNDANT_CHILD: case TUNNEL: case VLAN: case VPN: return LinkType.VIRTUAL; case LOOPBACK: case NULL: case UNKNOWN: return LinkType.UNKNOWN; default: throw new IllegalArgumentException(String.format("Unknown InterfaceType: %s", iface1type)); } } Link(String srcId, String dstId);  Link(String srcId, String dstId, LinkType type); @JsonCreator  Link(
      @JsonProperty(PROP_ID) String id,
      @JsonProperty(PROP_SRC_ID) String srcId,
      @JsonProperty(PROP_DST_ID) String dstId,
      @JsonProperty(PROP_TYPE) LinkType type); @JsonProperty(PROP_DST_ID) String getDstId(); static String getId(String srcId, String dstId); @JsonProperty(PROP_SRC_ID) String getSrcId(); @JsonProperty(PROP_TYPE) LinkType getType(); static LinkType interfaceTypesToLinkType(
      InterfaceType iface1type, InterfaceType iface2type); @JsonProperty(PROP_TYPE) void setType(LinkType type); }
Link extends BfObject { public static LinkType interfaceTypesToLinkType( InterfaceType iface1type, InterfaceType iface2type) { if (iface1type != iface2type) { return LinkType.UNKNOWN; } switch (iface1type) { case PHYSICAL: case LOGICAL: return LinkType.PHYSICAL; case AGGREGATED: case AGGREGATE_CHILD: case REDUNDANT: case REDUNDANT_CHILD: case TUNNEL: case VLAN: case VPN: return LinkType.VIRTUAL; case LOOPBACK: case NULL: case UNKNOWN: return LinkType.UNKNOWN; default: throw new IllegalArgumentException(String.format("Unknown InterfaceType: %s", iface1type)); } } Link(String srcId, String dstId);  Link(String srcId, String dstId, LinkType type); @JsonCreator  Link(
      @JsonProperty(PROP_ID) String id,
      @JsonProperty(PROP_SRC_ID) String srcId,
      @JsonProperty(PROP_DST_ID) String dstId,
      @JsonProperty(PROP_TYPE) LinkType type); @JsonProperty(PROP_DST_ID) String getDstId(); static String getId(String srcId, String dstId); @JsonProperty(PROP_SRC_ID) String getSrcId(); @JsonProperty(PROP_TYPE) LinkType getType(); static LinkType interfaceTypesToLinkType(
      InterfaceType iface1type, InterfaceType iface2type); @JsonProperty(PROP_TYPE) void setType(LinkType type);  }