import com.google.common.base.Preconditions;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import org.apache.felix.service.command.CommandSession;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
+import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.itm.impl.ItmUtils;
-import org.opendaylight.genius.mdsalutil.MDSALDataStoreUtils;
import org.opendaylight.genius.utils.cache.DataStoreCache;
+import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBfd;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeLldp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeGre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig;
import org.slf4j.LoggerFactory;
@Singleton
+@SuppressWarnings("checkstyle:RegexpSingleLineJava")
public class TepCommandHelper {
private static final Logger LOG = LoggerFactory.getLogger(TepCommandHelper.class);
+
+ private static final AtomicInteger CHECK = new AtomicInteger();
+
private final DataBroker dataBroker;
+ private final ManagedNewTransactionRunner txRunner;
private final ItmConfig itmConfig;
- static int check = 0;
- static short flag = 0;
+
/*
* boolean flag add_or_delete --- can be set to true if the last called tep
* command is Tep-add else set to false when Tep-delete is called
* tepCommandHelper object is created only once in session initiated
*/
- final Map<String, Map<SubnetObject, List<Vteps>>> transportZonesHashMap = new HashMap<>();
+ private final Map<String, Map<SubnetObject, List<Vteps>>> transportZonesHashMap = new HashMap<>();
private List<Subnets> subnetList = new ArrayList<>();
private List<TransportZone> transportZoneArrayList = new ArrayList<>();
- private List<Vteps> vtepDelCommitList = new ArrayList<>();
+ private final List<Vteps> vtepDelCommitList = new ArrayList<>();
// private List<InstanceIdentifier<? extends DataObject>> vtepPaths = new
// ArrayList<>();
@Inject
public TepCommandHelper(final DataBroker dataBroker, final ItmConfig itmConfig) {
this.dataBroker = dataBroker;
+ this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.itmConfig = itmConfig;
}
@PostConstruct
- public void start() throws Exception {
+ public void start() {
boolean defTzEnabled = itmConfig.isDefTzEnabled();
if (defTzEnabled) {
String tunnelType = itmConfig.getDefTzTunnelType();
String subnetMask, String gatewayIp, String transportZone,
CommandSession session) throws TepException {
- check++;
+ CHECK.incrementAndGet();
IpAddress ipAddressObj = null;
IpAddress gatewayIpObj = null;
IpPrefix subnetMaskObj = null;
final VtepsKey vtepkey = new VtepsKey(dpnId, portName);
try {
- ipAddressObj = new IpAddress(ipAddress.toCharArray());
- gatewayIpObj = new IpAddress("0.0.0.0".toCharArray());
- if (gatewayIp != null) {
- gatewayIpObj = new IpAddress(gatewayIp.toCharArray());
+ ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress);
+ gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
+ if (gatewayIp != null && !gatewayIp.isEmpty()
+ && !"null".equals(gatewayIp) || "0.0.0.0".equals(gatewayIp)) {
+ gatewayIpObj = IpAddressBuilder.getDefaultInstance(gatewayIp);
} else {
LOG.debug("gateway is null");
+ gatewayIp = null;
}
- } catch (Exception e) {
- handleError("Invalid IpAddress. Expected: 1.0.0.0 to 254.255.255.255", session);
+ } catch (RuntimeException e) {
+ handleError("Invalid IpAddress. Expected: 1.0.0.0 to 254.255.255.255");
return;
}
try {
- subnetMaskObj = new IpPrefix(subnetMask.toCharArray());
+ subnetMaskObj = IpPrefixBuilder.getDefaultInstance(subnetMask);
} catch (Exception e) {
- handleError("Invalid Subnet Mask. Expected: 0.0.0.0/0 to 255.255.255.255/32", session);
+ handleError("Invalid Subnet Mask. Expected: 0.0.0.0/0 to 255.255.255.255/32");
return;
}
if (!validateIPs(ipAddress, subnetMask, gatewayIp)) {
- handleError("IpAddress and gateWayIp should belong to the subnet provided", session);
+ handleError("IpAddress and gateWayIp should belong to the subnet provided");
return;
}
private boolean validateIPs(String ipAddress, String subnetMask, String gatewayIp) {
SubnetUtils utils = new SubnetUtils(subnetMask);
- if ((utils.getInfo().isInRange(ipAddress)) && ((gatewayIp == null) || (utils.getInfo().isInRange(gatewayIp)))) {
+ if (utils.getInfo().isInRange(ipAddress) && (gatewayIp == null || utils.getInfo().isInRange(gatewayIp))) {
return true;
} else {
LOG.trace("InValid IP");
boolean isConfiguredTepGreType = isGreTunnelType(transportZone, allTransportZonesAsMap);
// Checking for duplicates in local cache
- for (String tz : transportZonesHashMap.keySet()) {
+ for (Entry<String, Map<SubnetObject, List<Vteps>>> entry : transportZonesHashMap.entrySet()) {
+ String tz = entry.getKey();
boolean isGreType = isGreTunnelType(tz, allTransportZonesAsMap);
- Map<SubnetObject, List<Vteps>> subVtepMapTemp = transportZonesHashMap.get(tz);
- for (SubnetObject subOb : subVtepMapTemp.keySet()) {
- List<Vteps> vtepList = subVtepMapTemp.get(subOb);
+ Map<SubnetObject, List<Vteps>> subVtepMapTemp = entry.getValue();
+ for (List<Vteps> vtepList : subVtepMapTemp.values()) {
validateForDuplicateAndSingleGreTep(inputVtep, isConfiguredTepGreType, isGreType, vtepList);
}
}
* StringUtils.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_GRE,
* tzone.getTunnelType())) { return true; }
*/
- return (tzone != null) && (tzone.getTunnelType()).equals(TunnelTypeGre.class);
+ return tzone != null && tzone.getTunnelType().equals(TunnelTypeGre.class);
}
/**
public boolean checkExistingSubnet(Map<SubnetObject, List<Vteps>> subVtepMapTemp, SubnetObject subObCli) {
for (SubnetObject subOb : subVtepMapTemp.keySet()) {
if (subOb.get_key().equals(subObCli.get_key())) {
- if (!(subOb.get_vlanId().equals(subObCli.get_vlanId()))) {
+ if (!subOb.get_vlanId().equals(subObCli.get_vlanId())) {
return true;
}
- if (!(subOb.get_gatewayIp().equals(subObCli.get_gatewayIp()))) {
+ if (!subOb.get_gatewayIp().equals(subObCli.get_gatewayIp())) {
return true;
}
}
// check in local cache
if (transportZonesHashMap.containsKey(tzone)) {
Map<SubnetObject, List<Vteps>> subVtepMapTemp = transportZonesHashMap.get(tzone);
- for (SubnetObject subOb : subVtepMapTemp.keySet()) {
- List<Vteps> vtepList = subVtepMapTemp.get(subOb);
+ for (List<Vteps> vtepList : subVtepMapTemp.values()) {
for (Vteps vtep : vtepList) {
if (vtep.getDpnId().equals(dpnId)) {
return true;
TransportZones transportZonesBuilt = null;
TransportZone transportZone = null;
try {
- LOG.debug("no of teps added" + check);
- if (transportZonesHashMap != null || !transportZonesHashMap.isEmpty()) {
+ LOG.debug("no of teps added {}", CHECK);
+ if (transportZonesHashMap != null && !transportZonesHashMap.isEmpty()) {
transportZoneArrayList = new ArrayList<>();
- for (String tz : transportZonesHashMap.keySet()) {
- LOG.debug("transportZonesHashMap" + tz);
+ for (Entry<String, Map<SubnetObject, List<Vteps>>> mapEntry : transportZonesHashMap.entrySet()) {
+ String tz = mapEntry.getKey();
+ LOG.debug("transportZonesHashMap {}", tz);
subnetList = new ArrayList<>();
- Map<SubnetObject, List<Vteps>> subVtepMapTemp = transportZonesHashMap.get(tz);
- for (SubnetObject subOb : subVtepMapTemp.keySet()) {
- LOG.debug("subnets" + subOb.get_prefix());
- List<Vteps> vtepList = subVtepMapTemp.get(subOb);
+ Map<SubnetObject, List<Vteps>> subVtepMapTemp = mapEntry.getValue();
+ for (Entry<SubnetObject, List<Vteps>> entry : subVtepMapTemp.entrySet()) {
+ SubnetObject subOb = entry.getKey();
+ LOG.debug("subnets {}", subOb.get_prefix());
+ List<Vteps> vtepList = entry.getValue();
Subnets subnet = new SubnetsBuilder().setGatewayIp(subOb.get_gatewayIp())
.setKey(subOb.get_key()).setPrefix(subOb.get_prefix()).setVlanId(subOb.get_vlanId())
.setVteps(vtepList).build();
subnetList.add(subnet);
- LOG.debug("vteps" + vtepList);
+ LOG.debug("vteps {}", vtepList);
}
InstanceIdentifier<TransportZone> transportZonePath =
InstanceIdentifier.builder(TransportZones.class)
LOG.debug("read container from DS");
if (transportZoneOptional.isPresent()) {
TransportZone tzoneFromDs = transportZoneOptional.get();
- LOG.debug("read tzone container" + tzoneFromDs.toString());
+ LOG.debug("read tzone container {}", tzoneFromDs);
if (tzoneFromDs.getTunnelType() == null
- || (tzoneFromDs.getTunnelType()).equals(TunnelTypeVxlan.class)) {
+ || tzoneFromDs.getTunnelType().equals(TunnelTypeVxlan.class)) {
transportZone =
new TransportZoneBuilder().setKey(new TransportZoneKey(tz))
.setTunnelType(TunnelTypeVxlan.class).setSubnets(subnetList)
.setZoneName(tz).build();
- } else if ((tzoneFromDs.getTunnelType()).equals(TunnelTypeGre.class)) {
+ } else if (tzoneFromDs.getTunnelType().equals(TunnelTypeGre.class)) {
transportZone =
new TransportZoneBuilder().setKey(new TransportZoneKey(tz))
.setTunnelType(TunnelTypeGre.class).setSubnets(subnetList)
.setTunnelType(TunnelTypeVxlan.class).setSubnets(subnetList).setZoneName(tz)
.build();
}
- LOG.debug("tzone object" + transportZone);
+ LOG.debug("tzone object {}", transportZone);
transportZoneArrayList.add(transportZone);
}
transportZonesBuilt = new TransportZonesBuilder().setTransportZone(transportZoneArrayList).build();
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
- LOG.debug("InstanceIdentifier" + path);
+ LOG.debug("InstanceIdentifier {}", path);
ItmUtils.asyncUpdate(LogicalDatastoreType.CONFIGURATION, path, transportZonesBuilt, dataBroker,
ItmUtils.DEFAULT_CALLBACK);
- LOG.debug("wrote to Config DS" + transportZonesBuilt);
+ LOG.debug("wrote to Config DS {}", transportZonesBuilt);
transportZonesHashMap.clear();
transportZoneArrayList.clear();
subnetList.clear();
} else {
LOG.debug("NO vteps were configured");
}
- } catch (Exception e) {
- LOG.error(e.getMessage());
+ } catch (RuntimeException e) {
+ LOG.error("Error building TEPs", e);
}
}
if (transportZonesOptional.isPresent()) {
TransportZones transportZones = transportZonesOptional.get();
if (transportZones.getTransportZone() == null || transportZones.getTransportZone().isEmpty()) {
- handleError("No teps configured", session);
+ handleError("No teps configured");
return;
}
List<String> result = new ArrayList<>();
- result.add(String.format("Tunnel Monitoring (for VXLAN tunnels): %s", (monitorEnabled ? "On" : "Off")));
+ result.add(String.format("Tunnel Monitoring (for VXLAN tunnels): %s", monitorEnabled ? "On" : "Off"));
result.add(String.format("Tunnel Monitoring Interval (for VXLAN tunnels): %d", monitorInterval));
result.add(System.lineSeparator());
result.add(String.format("%-16s %-16s %-16s %-12s %-12s %-12s %-16s %-12s", "TransportZone",
+ "---------------------------------");
for (TransportZone tz : transportZones.getTransportZone()) {
if (tz.getSubnets() == null || tz.getSubnets().isEmpty()) {
- LOG.error("Transport Zone " + tz.getZoneName() + "has no subnets");
+ LOG.error("Transport Zone {} has no subnets", tz.getZoneName());
continue;
}
for (Subnets sub : tz.getSubnets()) {
if (sub.getVteps() == null || sub.getVteps().isEmpty()) {
- LOG.error("Transport Zone " + tz.getZoneName() + "subnet " + sub.getPrefix() + "has no vteps");
+ LOG.error("Transport Zone {} subnet {} has no vteps", tz.getZoneName(), sub.getPrefix());
continue;
}
for (Vteps vtep : sub.getVteps()) {
flag = true;
String strTunnelType ;
- if ((tz.getTunnelType()).equals(TunnelTypeGre.class)) {
+ if (tz.getTunnelType().equals(TunnelTypeGre.class)) {
strTunnelType = ITMConstants.TUNNEL_TYPE_GRE;
} else {
strTunnelType = ITMConstants.TUNNEL_TYPE_VXLAN;
}
result.add(String.format("%-16s %-16s %-16s %-12s %-12s %-12s %-16s %-12s",
- tz.getZoneName(), strTunnelType, sub.getPrefix().getIpv4Prefix().getValue(),
- sub.getGatewayIp().getIpv4Address().getValue(), sub.getVlanId().toString(),
- vtep.getDpnId().toString(), vtep.getIpAddress().getIpv4Address().getValue(),
+ tz.getZoneName(), strTunnelType, new String(sub.getPrefix().getValue()),
+ new String(sub.getGatewayIp().getValue()), sub.getVlanId().toString(),
+ vtep.getDpnId().toString(), new String(vtep.getIpAddress().getValue()),
vtep.getPortname()));
}
}
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
public void showCache(String cacheName) {
-
- if (!DataStoreCache.isCacheValid(cacheName)) {
+ boolean dataStoreCache = DataStoreCache.isCacheValid(cacheName);
+ boolean inMemoryCache = isInMemoryCacheNameValid(cacheName);
+ if (!dataStoreCache && !inMemoryCache) {
System.out.println(" " + cacheName + " is not a valid Cache Name ");
return ;
}
- List<Object> keys = null;
- keys = DataStoreCache.getKeys(cacheName);
- if (keys != null && !keys.isEmpty()) {
+ if (dataStoreCache) {
+ List<Object> keys = null;
+ keys = DataStoreCache.getKeys(cacheName);
+ if (keys != null && !keys.isEmpty()) {
+ System.out.println("Dumping the data in cache for " + cacheName);
+ for (Object key : keys) {
+ System.out.println(" KEY: " + key + " Value: " + DataStoreCache.get(cacheName, key));
+ }
+ } else {
+ System.out.println("No data in cache for " + cacheName);
+ }
+ } else if (inMemoryCache) {
System.out.println("Dumping the data in cache for " + cacheName);
- for (Object key : keys) {
- System.out.println(" KEY: " + key + " Value: " + DataStoreCache.get(cacheName, key));
- System.out.println();
+ Collection<String> cacheContent;
+ switch (cacheName) {
+ case ITMConstants.INTERNAL_TUNNEL_CACHE_NAME:
+ cacheContent = ItmUtils.ITM_CACHE.getAllInternalInterfaces();
+ break;
+ case ITMConstants.EXTERNAL_TUNNEL_CACHE_NAME:
+ cacheContent = ItmUtils.ITM_CACHE.getAllExternalInterfaces();
+ break;
+ default:
+ cacheContent = Collections.emptyList();
+ }
+ System.out.println("Number of data in cache " + cacheContent.size());
+ if (!cacheContent.isEmpty()) {
+ for (String key : cacheContent) {
+ System.out.println(key + " ");
+ }
+ } else {
+ System.out.println("No data in cache for " + cacheName);
}
- } else {
- System.out.println("No data in cache for " + cacheName);
}
}
+ public boolean isInMemoryCacheNameValid(String name) {
+ boolean valid = false;
+ valid = name.equals(ITMConstants.INTERNAL_TUNNEL_CACHE_NAME)
+ || name.equals(ITMConstants.EXTERNAL_TUNNEL_CACHE_NAME);
+ return valid;
+ }
+
@SuppressWarnings("checkstyle:IllegalCatch")
public void deleteVtep(BigInteger dpnId, String portName, Integer vlanId, String ipAddress, String subnetMask,
String gatewayIp, String transportZone, CommandSession session) throws TepException {
IpPrefix subnetMaskObj = null;
final VtepsKey vtepkey = new VtepsKey(dpnId, portName);
try {
- ipAddressObj = new IpAddress(ipAddress.toCharArray());
- gatewayIpObj = new IpAddress("0.0.0.0".toCharArray());
- if (gatewayIp != null) {
- gatewayIpObj = new IpAddress(gatewayIp.toCharArray());
+ ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress);
+ gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
+ if (!"null".equals(gatewayIp) || "0.0.0.0".equals(gatewayIp) && gatewayIp != null) {
+ gatewayIpObj = IpAddressBuilder.getDefaultInstance(gatewayIp);
} else {
LOG.debug("gateway is null");
+ gatewayIp = null;
}
- } catch (Exception e) {
- handleError("Invalid IpAddress. Expected: 1.0.0.0 to 254.255.255.255", session);
+ } catch (RuntimeException e) {
+ handleError("Invalid IpAddress. Expected: 1.0.0.0 to 254.255.255.255");
return;
}
try {
- subnetMaskObj = new IpPrefix(subnetMask.toCharArray());
+ subnetMaskObj = IpPrefixBuilder.getDefaultInstance(subnetMask);
} catch (Exception e) {
- handleError("Invalid Subnet Mask. Expected: 0.0.0.0/0 to 255.255.255.255/32", session);
+ handleError("Invalid Subnet Mask. Expected: 0.0.0.0/0 to 255.255.255.255/32");
return;
}
if (!validateIPs(ipAddress, subnetMask, gatewayIp)) {
- handleError("IpAddress and gateWayIp should belong to the subnet provided", session);
+ handleError("IpAddress and gateWayIp should belong to the subnet provided");
return;
}
SubnetsKey subnetsKey = new SubnetsKey(subnetMaskObj);
tzPaths.add(tpath);
if (transportZones.getTransportZone() == null
|| transportZones.getTransportZone().size() == 0) {
- MDSALDataStoreUtils.asyncRemove(dataBroker, LogicalDatastoreType.CONFIGURATION,
- path, ItmUtils.DEFAULT_CALLBACK);
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ tx -> tx.delete(LogicalDatastoreType.CONFIGURATION, path)), LOG,
+ "Error deleting {}", path);
return;
}
}
allPaths.clear();
vtepDelCommitList.clear();
}
- } catch (Exception e) {
- LOG.error(e.getMessage());
+ } catch (RuntimeException e) {
+ LOG.error("Unexpected error", e);
}
}
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
- public void showState(List<StateTunnelList> tunnelLists, boolean tunnelMonitorEnabled,
- CommandSession session) throws TepException {
+ public void showState(Collection<StateTunnelList> tunnelLists, boolean tunnelMonitorEnabled) throws TepException {
if (tunnelLists == null || tunnelLists.isEmpty()) {
- handleError("No Internal Tunnels Exist", session);
+ handleError("No Internal Tunnels Exist");
return;
}
if (!tunnelMonitorEnabled) {
- if (session != null) {
- session.getConsole().println("Tunnel Monitoring is Off");
- }
+ System.out.println("Tunnel Monitoring is Off");
}
String displayFormat = "%-16s %-16s %-16s %-16s %-16s %-10s %-10s";
System.out.println(String.format(displayFormat, "Tunnel Name", "Source-DPN",
tunnelType = ITMConstants.TUNNEL_TYPE_GRE;
} else if (tunType.equals(TunnelTypeMplsOverGre.class)) {
tunnelType = ITMConstants.TUNNEL_TYPE_MPLSoGRE;
+ } else if (tunType.equals(TunnelTypeLogicalGroup.class)) {
+ tunnelType = ITMConstants.TUNNEL_TYPE_LOGICAL_GROUP_VXLAN;
}
System.out.println(String.format(displayFormat, tunnelInst.getTunnelInterfaceName(),
tunnelInst.getSrcInfo().getTepDeviceId(), tunnelInst.getDstInfo().getTepDeviceId(),
- tunnelInst.getSrcInfo().getTepIp().getIpv4Address().getValue(),
- tunnelInst.getDstInfo().getTepIp().getIpv4Address().getValue(), tunnelState, tunnelType));
+ new String(tunnelInst.getSrcInfo().getTepIp().getValue()),
+ new String(tunnelInst.getDstInfo().getTepIp().getValue()), tunnelState, tunnelType));
}
}
}
String gatewayIp, String transportZone, CommandSession session) {
boolean exists = false;
final VtepsKey vtepkey = new VtepsKey(dpnId, portName);
- IpAddress ipAddressObj = new IpAddress(ipAddress.toCharArray());
- IpPrefix subnetMaskObj = new IpPrefix(subnetMask.toCharArray());
- IpAddress gatewayIpObj = new IpAddress("0.0.0.0".toCharArray());
+ IpAddress ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress);
+ IpPrefix subnetMaskObj = IpPrefixBuilder.getDefaultInstance(subnetMask);
+ IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
if (gatewayIp != null) {
- gatewayIpObj = new IpAddress(gatewayIp.toCharArray());
+ gatewayIpObj = IpAddressBuilder.getDefaultInstance(gatewayIp);
} else {
LOG.debug("gateway is null");
}
// TransportZone tZone = getTransportZone(tZoneName);
// if (tZone != null) {
if (tzoneFromConfigDs != null) {
- if ((!tzoneFromConfigDs.getTunnelType().equals(tunType)) && ItmUtils.isNotEmpty(tzoneFromConfigDs
+ if (!tzoneFromConfigDs.getTunnelType().equals(tunType) && ItmUtils.isNotEmpty(tzoneFromConfigDs
.getSubnets())) {
// for default-TZ, such error message is not needed to be thrown.
// it needs to be handled in different way, by deleting default-TZ
}
}
- public void handleError(String errorMessage, CommandSession session) throws TepException {
- if (session != null) {
- session.getConsole().println(errorMessage);
- } else {
- throw new TepException(errorMessage);
- }
-
+ public void handleError(String errorMessage) throws TepException {
+ throw new TepException(errorMessage);
}
}