@Test public void testGetPorts() { Set<PortNumber> ports; ports = config.getPorts(KEY1); assertThat(ports.size(), is(2)); assertTrue(ports.contains(PORT3)); assertTrue(ports.contains(PORT4)); ports = config.getPorts(KEY2); assertThat(ports.size(), is(2)); assertTrue(ports.contains(PORT3)); assertTrue(ports.contains(PORT4)); ports = config.getPorts(KEY3); assertThat(ports.size(), is(2)); assertTrue(ports.contains(PORT4)); assertTrue(ports.contains(PORT5)); }
public Set<PortNumber> getPorts(XConnectStoreKey xconnect) { ImmutableSet.Builder<PortNumber> builder = ImmutableSet.builder(); object.get(xconnect.deviceId().toString()).forEach(vlanPortsPair -> { if (xconnect.vlanId().toShort() == vlanPortsPair.get(VLAN).asInt()) { int portCount = vlanPortsPair.get(PORTS).size(); checkArgument(portCount == 2, "Expect 2 ports but found " + portCount + " on " + xconnect); vlanPortsPair.get(PORTS).forEach(portNode -> { builder.add(PortNumber.portNumber(portNode.asInt())); }); } }); return builder.build(); }
XConnectConfig extends Config<ApplicationId> { public Set<PortNumber> getPorts(XConnectStoreKey xconnect) { ImmutableSet.Builder<PortNumber> builder = ImmutableSet.builder(); object.get(xconnect.deviceId().toString()).forEach(vlanPortsPair -> { if (xconnect.vlanId().toShort() == vlanPortsPair.get(VLAN).asInt()) { int portCount = vlanPortsPair.get(PORTS).size(); checkArgument(portCount == 2, "Expect 2 ports but found " + portCount + " on " + xconnect); vlanPortsPair.get(PORTS).forEach(portNode -> { builder.add(PortNumber.portNumber(portNode.asInt())); }); } }); return builder.build(); } }
XConnectConfig extends Config<ApplicationId> { public Set<PortNumber> getPorts(XConnectStoreKey xconnect) { ImmutableSet.Builder<PortNumber> builder = ImmutableSet.builder(); object.get(xconnect.deviceId().toString()).forEach(vlanPortsPair -> { if (xconnect.vlanId().toShort() == vlanPortsPair.get(VLAN).asInt()) { int portCount = vlanPortsPair.get(PORTS).size(); checkArgument(portCount == 2, "Expect 2 ports but found " + portCount + " on " + xconnect); vlanPortsPair.get(PORTS).forEach(portNode -> { builder.add(PortNumber.portNumber(portNode.asInt())); }); } }); return builder.build(); }  }
XConnectConfig extends Config<ApplicationId> { public Set<PortNumber> getPorts(XConnectStoreKey xconnect) { ImmutableSet.Builder<PortNumber> builder = ImmutableSet.builder(); object.get(xconnect.deviceId().toString()).forEach(vlanPortsPair -> { if (xconnect.vlanId().toShort() == vlanPortsPair.get(VLAN).asInt()) { int portCount = vlanPortsPair.get(PORTS).size(); checkArgument(portCount == 2, "Expect 2 ports but found " + portCount + " on " + xconnect); vlanPortsPair.get(PORTS).forEach(portNode -> { builder.add(PortNumber.portNumber(portNode.asInt())); }); } }); return builder.build(); }  @Override boolean isValid(); Set<XConnectStoreKey> getXconnects(); Set<XConnectStoreKey> getXconnects(DeviceId deviceId); Set<PortNumber> getPorts(XConnectStoreKey xconnect); }
XConnectConfig extends Config<ApplicationId> { public Set<PortNumber> getPorts(XConnectStoreKey xconnect) { ImmutableSet.Builder<PortNumber> builder = ImmutableSet.builder(); object.get(xconnect.deviceId().toString()).forEach(vlanPortsPair -> { if (xconnect.vlanId().toShort() == vlanPortsPair.get(VLAN).asInt()) { int portCount = vlanPortsPair.get(PORTS).size(); checkArgument(portCount == 2, "Expect 2 ports but found " + portCount + " on " + xconnect); vlanPortsPair.get(PORTS).forEach(portNode -> { builder.add(PortNumber.portNumber(portNode.asInt())); }); } }); return builder.build(); }  @Override boolean isValid(); Set<XConnectStoreKey> getXconnects(); Set<XConnectStoreKey> getXconnects(DeviceId deviceId); Set<PortNumber> getPorts(XConnectStoreKey xconnect);  }