TepCommandHelper { @SuppressWarnings("checkstyle:IllegalCatch") public void deleteVtep(Uint64 dpnId, String ipAddress, String transportZone) throws TepException { final VtepsKey vtepkey = new VtepsKey(dpnId); IpAddress ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress); Vteps vtepCli; InstanceIdentifier<Vteps> vpath = InstanceIdentifier.builder(TransportZones.class) .child(TransportZone.class, new TransportZoneKey(transportZone)) .child(Vteps.class, vtepkey).build(); boolean existsInCache = isInCache(dpnId, ipAddress, transportZone); if (!existsInCache) { Optional<Vteps> vtepOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, vpath, dataBroker); if (vtepOptional.isPresent()) { vtepCli = vtepOptional.get(); if (Objects.equals(vtepCli.getIpAddress(), ipAddressObj)) { vtepDelCommitList.add(vtepCli); } } else { handleError("Vtep Doesnt exist"); } } } @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);  }
@SuppressWarnings("checkstyle:IllegalCatch") @Test public void testDeleteVtep() { try { tepCommandHelper.deleteVtep(dpId1, tepIp1, transportZone1); } catch (Exception e) { LOG.error(e.getMessage()); } verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION,vtepsIdentifier); }
@SuppressWarnings("checkstyle:IllegalCatch") @Test public void testDeleteVtepGatewayIpNull() { try { tepCommandHelper.deleteVtep(dpId1, tepIp1, transportZone1); } catch (Exception e) { LOG.error(e.getMessage()); } LOG.debug("gateway is null in deleteVtep"); }