/** * Generates an instance of the Status class based on the passed StatusCode * only. The description field of the Status object will be inferred by the * status code. * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} */ public Status(StatusCode errorCode) { this.code = (errorCode != null) ? errorCode : StatusCode.UNDEFINED; this.description = (description != null) ? description : this.code .toString(); this.requestId = 0; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((code == null) ? 0 : code.calculateConsistentHashCode()); return result; }
try { status = futureStatus.get(); if (status.getCode().equals(StatusCode.TIMEOUT)) {
try { status = futureStatus.get(); if (status.getCode().equals(StatusCode.TIMEOUT)) {
/** * Generates an instance of the Status class. This is used as return code * for internal API2 function calls. This constructor allows to specify, * beside the Status Code, a custom human readable description to add more * information about the status. * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} * @param description * The human readable description of the status. If passed as * null, description will be inferred by the code */ public Status(StatusCode errorCode, String description) { this.code = (errorCode != null) ? errorCode : StatusCode.UNDEFINED; this.description = (description != null) ? description : this.code .toString(); this.requestId = 0; }
status = futureStatus.get(); if (status.getCode() .equals(StatusCode.TIMEOUT)) {
/** * Generates an instance of the Status class to be used in case of * asynchronous call. It is supposed to be created by the underlying * infrastructure only when it was successful in allocating the asynchronous * request id, hence caller should expect StatusCode to be successful. * * @param errorCode * The status code. If passed as null, code will be stored as * {@code StatusCode.UNDEFINED} * @param requestId * The request id set by underlying infrastructure for this * request */ public Status(StatusCode errorCode, long requestId) { this.code = (errorCode != null) ? errorCode : StatusCode.UNDEFINED; this.description = (description != null) ? description : this.code .toString(); this.requestId = requestId; }
public FlowConfig(String installInHw, String name, Node node, String priority, String cookie, String ingressPort, String portGroup, String vlanId, String vlanPriority, String etherType, String srcMac, String dstMac, String protocol, String tosBits, String srcIP, String dstIP, String tpSrc, String tpDst, String idleTimeout, String hardTimeout, List<String> actions) { super(); this.installInHw = installInHw; this.name = name; this.node = node; this.priority = priority; this.cookie = cookie; this.ingressPort = ingressPort; this.portGroup = portGroup; this.vlanId = vlanId; this.vlanPriority = vlanPriority; this.etherType = etherType; this.dlSrc = srcMac; this.dlDst = dstMac; this.protocol = protocol; this.tosBits = tosBits; this.nwSrc = srcIP; this.nwDst = dstIP; this.tpSrc = tpSrc; this.tpDst = tpDst; this.idleTimeout = idleTimeout; this.hardTimeout = hardTimeout; this.actions = actions; this.status = StatusCode.SUCCESS.toString(); }
public boolean isStatusSuccessful() { return status.equals(StatusCode.SUCCESS.toString()); }
private void updateStaticFlowConfigsOnContainerModeChange(UpdateType update) { log.trace("Updating Static Flow configs on container mode change: {}", update); for (ConcurrentMap.Entry<Integer, FlowConfig> entry : staticFlows.entrySet()) { FlowConfig config = entry.getValue(); if (config.isPortGroupEnabled()) { continue; } if (config.installInHw() && !config.isInternalFlow()) { switch (update) { case ADDED: config.setStatus("Removed from node because in container mode"); break; case REMOVED: config.setStatus(StatusCode.SUCCESS.toString()); break; default: break; } } } // Update cluster cache refreshClusterStaticFlowsStatus(null); }
private void addStaticFlowsToSwitch(Node node) { for (ConcurrentMap.Entry<Integer, FlowConfig> entry : staticFlows.entrySet()) { FlowConfig config = entry.getValue(); if (config.isPortGroupEnabled()) { continue; } if (config.getNode().equals(node)) { if (config.installInHw() && !config.getStatus().equals(StatusCode.SUCCESS.toString())) { Status status = this.installFlowEntryAsync(config.getFlowEntry()); config.setStatus(status.getDescription()); } } } // Update cluster cache refreshClusterStaticFlowsStatus(node); }
target.setStatus(StatusCode.GONE.toString()); staticFlows.put(key, target);
return (result.isSuccess()) ? StatusCode.SUCCESS.toString() : result.getDescription();
return (result.isSuccess()) ? StatusCode.SUCCESS.toString() : result.getDescription();
private boolean installFlowsOnNodeConnectorUp(NodeConnector nodeConnector) { boolean updated = false; List<FlowConfig> flowConfigForNode = getStaticFlows(nodeConnector.getNode()); for (FlowConfig flowConfig : flowConfigForNode) { if (doesFlowContainNodeConnector(flowConfig.getFlow(), nodeConnector)) { if (flowConfig.installInHw() && !flowConfig.getStatus().equals(StatusCode.SUCCESS.toString())) { Status status = this.installFlowEntryAsync(flowConfig.getFlowEntry()); if (!status.isSuccess()) { flowConfig.setStatus(status.getDescription()); } else { flowConfig.setStatus(StatusCode.SUCCESS.toString()); } updated = true; } } } return updated; }
if (status.isSuccess()) { target.setStatus(StatusCode.SUCCESS.toString()); target.toggleInstallation(); staticFlows.put(key, target);
String error; Status status; config.setStatus(StatusCode.SUCCESS.toString());