private String containerName = null;
private ExecutorService executor;
protected boolean stopping;
+ private static boolean hostRefresh = true;
+ private static int hostRetryCount = 5;
private static class ARPPending {
protected InetAddress hostIP;
protected short sent_count;
ARPPendingList.remove(entry.getKey());
continue;
}
- if (arphost.getSent_count() < switchManager.getHostRetryCount()) {
+ if (arphost.getSent_count() < hostRetryCount) {
/*
* No reply has been received of first ARP Req, send the
* next one. Before sending the ARP, check if ARPHandler is
hostFinder.find(arphost.getHostIP());
arphost.sent_count++;
logger.debug("ARP Sent from ARPPending List, IP: {}", arphost.getHostIP().getHostAddress());
- } else if (arphost.getSent_count() >= switchManager.getHostRetryCount()) {
+ } else if (arphost.getSent_count() >= hostRetryCount) {
/*
* ARP requests have been sent without receiving a reply,
* remove this from the pending list
if ((clusterContainerService != null) && !clusterContainerService.amICoordinator()) {
return;
}
- if ((switchManager != null) && !switchManager.isHostRefreshEnabled()) {
+ if (!hostRefresh) {
/*
- * The host probe procedure was disabled by CLI
+ * The host probe procedure is turned off
*/
return;
}
short arp_cntdown = host.getArpSendCountDown();
arp_cntdown--;
- if (arp_cntdown > switchManager.getHostRetryCount()) {
+ if (arp_cntdown > hostRetryCount) {
host.setArpSendCountDown(arp_cntdown);
} else if (arp_cntdown <= 0) {
/*
*/
removeKnownHost(entry.getKey());
notifyHostLearnedOrRemoved(host, false);
- } else if (arp_cntdown <= switchManager.getHostRetryCount()) {
+ } else if (arp_cntdown <= hostRetryCount) {
/*
* Use the services of arphandler to check if host is still
* there
public byte[] getNodeMAC(Node node);
/**
- * Return true if the host Refresh procedure (by sending ARP request probes
- * to known hosts) is enabled. By default, the procedure is enabled. This can
- * be overwritten by OSFI CLI "hostRefresh off".
- *
- * @return true if it is enabled; false if it's disabled.
- */
- public boolean isHostRefreshEnabled();
-
- /**
- * Return host refresh retry count
- *
- * @return host refresh retry count
+ * Create a Name/Tier/Bandwidth Property object based on given property name
+ * and value. Other property types are not supported yet.
+ *
+ * @param propName
+ * Name of the Property specified by
+ * {@link org.opendaylight.controller.sal.core.Property} and its
+ * extended classes
+ * @param propValue
+ * Value of the Property specified by
+ * {@link org.opendaylight.controller.sal.core.Property} and its
+ * extended classes
+ * @return {@link org.opendaylight.controller.sal.core.Property}
*/
- public int getHostRetryCount();
-
- /**
- * Create a Name/Tier/Bandwidth Property object based on given property
- * name and value. Other property types are not supported yet.
- *
- * @param propName Name of the Property specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
- * @param propValue Value of the Property specified by {@link org.opendaylight.controller.sal.core.Property} and its extended classes
- * @return {@link org.opendaylight.controller.sal.core.Property}
- */
public Property createProperty(String propName, String propValue);
/**
private final Set<IInventoryListener> inventoryListeners = Collections
.synchronizedSet(new HashSet<IInventoryListener>());
private final Set<ISpanAware> spanAware = Collections.synchronizedSet(new HashSet<ISpanAware>());
- private static boolean hostRefresh = true;
- private int hostRetryCount = 5;
private IClusterContainerServices clusterContainerService = null;
private String containerName = null;
private boolean isDefaultContainer = true;
return (macProperty == null) ? null : macProperty.getMacAddress();
}
- @Override
- public boolean isHostRefreshEnabled() {
- return hostRefresh;
- }
-
- @Override
- public int getHostRetryCount() {
- return hostRetryCount;
- }
-
@Override
public NodeConnector getNodeConnector(Node node, String nodeConnectorName) {
if (nodeConnectorNames == null) {
help.append("\t pencs <node id> - Print enabled node connectors for a given node\n");
help.append("\t pdm <node id> - Print switch ports in device map\n");
help.append("\t snt <node id> <tier> - Set node tier number\n");
- help.append("\t hostRefresh <on/off/?> - Enable/Disable/Query host refresh\n");
- help.append("\t hostRetry <count> - Set host retry count\n");
return help.toString();
}
setNodeProp(node, tier);
}
- public void _hostRefresh(CommandInterpreter ci) {
- String mode = ci.nextArgument();
- if (mode == null) {
- ci.println("expecting on/off/?");
- return;
- }
- if (mode.toLowerCase().equals("on")) {
- hostRefresh = true;
- } else if (mode.toLowerCase().equals("off")) {
- hostRefresh = false;
- } else if (mode.equals("?")) {
- if (hostRefresh) {
- ci.println("host refresh is ON");
- } else {
- ci.println("host refresh is OFF");
- }
- } else {
- ci.println("expecting on/off/?");
- }
- return;
- }
-
- public void _hostRetry(CommandInterpreter ci) {
- String retry = ci.nextArgument();
- if (retry == null) {
- ci.println("Please enter a valid number. Current retry count is "
- + hostRetryCount);
- return;
- }
- try {
- hostRetryCount = Integer.parseInt(retry);
- } catch (Exception e) {
- ci.println("Please enter a valid number");
- }
- return;
- }
-
@Override
public byte[] getNodeMAC(Node node) {
MacAddress mac = (MacAddress) this.getNodeProp(node,