TepCommandHelper { public boolean checkTepPerTzPerDpn(String tzone, Uint64 dpnId) { if (transportZonesHashMap.containsKey(tzone)) { List<Vteps> vtepList = transportZonesHashMap.get(tzone); for (Vteps vtep : vtepList) { if (Objects.equals(vtep.getDpnId(), dpnId)) { return true; } } } InstanceIdentifier<TransportZone> tzonePath = InstanceIdentifier.builder(TransportZones.class) .child(TransportZone.class, new TransportZoneKey(tzone)).build(); Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, tzonePath, dataBroker); if (transportZoneOptional.isPresent()) { TransportZone tz = transportZoneOptional.get(); for (Vteps vtep : tz.getVteps().values()) { if (Objects.equals(vtep.getDpnId(), dpnId)) { return true; } } } return false; } @Inject  TepCommandHelper(final DataBroker dataBroker, final ItmConfig itmConfig,
                            final UnprocessedTunnelsStateCache unprocessedTunnelsStateCache); @PostConstruct void start(); @PreDestroy void close(); @SuppressWarnings("checkstyle:IllegalCatch") void createLocalCache(Uint64 dpnId, String ipAddress,
                                 String transportZone); TransportZone getTransportZone(String transportZoneName); TransportZones getAllTransportZones(); boolean checkTepPerTzPerDpn(String tzone, Uint64 dpnId); @SuppressWarnings("checkstyle:IllegalCatch") void buildTeps(); List<String> showTeps(boolean monitorEnabled, int monitorInterval); @SuppressWarnings("checkstyle:RegexpSinglelineJava") void showCache(String cacheName); @SuppressWarnings("checkstyle:IllegalCatch") void deleteVtep(Uint64 dpnId, String ipAddress,
                           String transportZone); @SuppressWarnings("checkstyle:IllegalCatch") void deleteOnCommit(); @SuppressWarnings("checkstyle:RegexpSinglelineJava") void showState(Collection<StateTunnelList> tunnelLists, boolean tunnelMonitorEnabled); void showBridges(Map<Uint64, OvsdbBridgeRef> dpnIdBridgeRefMap); boolean isInCache(Uint64 dpnId, String ipAddress,
                             String transportZone); void configureTunnelType(String transportZoneName, String tunnelType); void configureTunnelMonitorParams(boolean monitorEnabled, String monitorProtocol); void configureTunnelMonitorInterval(int interval); void handleError(String errorMessage); @SuppressWarnings("checkstyle:RegexpSinglelineJava") void showOfPorts(Collection<OfTep> ofTeps);  }
@Test public void testCheckTepPerTzPerDpn() { try { tepCommandHelper.createLocalCache(dpId1,tepIp1,transportZone1); } catch (TepException e) { LOG.error(e.getMessage()); } tepCommandHelper.checkTepPerTzPerDpn(transportZone1,dpId2); verify(mockReadTx, times(2)).read(LogicalDatastoreType.CONFIGURATION,transportZoneIdentifier); }