@Test public void getTunnelPortTest() { NodeId nodeId = mock(NodeId.class); Assert.assertNull(switchManager.getTunnelPort(nodeId, TunnelTypeVxlan.class)); SwitchState switchState = new SwitchState(nodeId); SwitchManager.switches.put(nodeId, switchState); Assert.assertNull(switchManager.getTunnelPort(nodeId, TunnelTypeVxlan.class)); NodeConnectorId nodeConnectorId = mock(NodeConnectorId.class); TunnelBuilder tunnelBuilder = mock(TunnelBuilder.class); when(tunnelBuilder.getNodeConnectorId()).thenReturn(nodeConnectorId); switchState.tunnelBuilderByType.put(TunnelTypeVxlan.class, tunnelBuilder); Assert.assertEquals(nodeConnectorId, switchManager.getTunnelPort(nodeId, TunnelTypeVxlan.class)); }
public synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType) { SwitchState state = switches.get(nodeId); if (state == null) { return null; } TunnelBuilder tunnel = state.tunnelBuilderByType.get(tunnelType); if (tunnel == null) { return null; } return tunnel.getNodeConnectorId(); }
SwitchManager implements AutoCloseable { public synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType) { SwitchState state = switches.get(nodeId); if (state == null) { return null; } TunnelBuilder tunnel = state.tunnelBuilderByType.get(tunnelType); if (tunnel == null) { return null; } return tunnel.getNodeConnectorId(); } }
SwitchManager implements AutoCloseable { public synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType) { SwitchState state = switches.get(nodeId); if (state == null) { return null; } TunnelBuilder tunnel = state.tunnelBuilderByType.get(tunnelType); if (tunnel == null) { return null; } return tunnel.getNodeConnectorId(); } SwitchManager(DataBroker dataProvider); }
SwitchManager implements AutoCloseable { public synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType) { SwitchState state = switches.get(nodeId); if (state == null) { return null; } TunnelBuilder tunnel = state.tunnelBuilderByType.get(tunnelType); if (tunnel == null) { return null; } return tunnel.getNodeConnectorId(); } SwitchManager(DataBroker dataProvider); static void activatingSwitch(NodeId nodeId); static void deactivatingSwitch(NodeId nodeId); synchronized InstanceIdentifier<NodeConnector> getNodeConnectorIidForPortName(Name portName); synchronized Collection<NodeId> getReadySwitches(); synchronized Set<NodeConnectorId> getExternalPorts(NodeId nodeId); Set<Long> getExternalPortNumbers(NodeId nodeId); synchronized Collection<NodeConnectorId> getTunnelPorts(NodeId nodeId); synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType); synchronized IpAddress getTunnelIP(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType); void registerListener(SwitchListener listener); void setEncapsulationFormat(EncapsulationFormat format); @Override void close(); }
SwitchManager implements AutoCloseable { public synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType) { SwitchState state = switches.get(nodeId); if (state == null) { return null; } TunnelBuilder tunnel = state.tunnelBuilderByType.get(tunnelType); if (tunnel == null) { return null; } return tunnel.getNodeConnectorId(); } SwitchManager(DataBroker dataProvider); static void activatingSwitch(NodeId nodeId); static void deactivatingSwitch(NodeId nodeId); synchronized InstanceIdentifier<NodeConnector> getNodeConnectorIidForPortName(Name portName); synchronized Collection<NodeId> getReadySwitches(); synchronized Set<NodeConnectorId> getExternalPorts(NodeId nodeId); Set<Long> getExternalPortNumbers(NodeId nodeId); synchronized Collection<NodeConnectorId> getTunnelPorts(NodeId nodeId); synchronized NodeConnectorId getTunnelPort(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType); synchronized IpAddress getTunnelIP(NodeId nodeId, Class<? extends TunnelTypeBase> tunnelType); void registerListener(SwitchListener listener); void setEncapsulationFormat(EncapsulationFormat format); @Override void close();  }