本文整理了Java中org.opendaylight.controller.sal.utils.Status.isSuccess()
方法的一些代码示例,展示了Status.isSuccess()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.isSuccess()
方法的具体详情如下:
包路径:org.opendaylight.controller.sal.utils.Status
类名称:Status
方法名:isSuccess
[英]Tells whether the status is successful
[中]说明状态是否成功
代码示例来源:origin: org.opendaylight.controller/switchmanager
public Status validate() {
Status status = validateName();
if (status.isSuccess()) {
status = validateSubnetAddress();
if (status.isSuccess()) {
status = validatePorts(this.nodeConnectors);
}
}
return status;
}
代码示例来源:origin: org.opendaylight.controller/usermanager.implementation
@Override
public Status changeLocalUserPassword(String user, String curPassword, String newPassword) {
UserConfig targetConfigEntry = null;
// update configuration entry
targetConfigEntry = localUserConfigList.get(user);
if (targetConfigEntry == null) {
return new Status(StatusCode.NOTFOUND, "User not found");
}
Status status = targetConfigEntry.update(curPassword, newPassword, null);
if (!status.isSuccess()) {
return status;
}
// Trigger cluster update
localUserConfigList.put(user, targetConfigEntry);
logger.trace("Password changed for User \"{}\"", user);
return status;
}
代码示例来源:origin: org.opendaylight.controller/switchmanager
public Status validate() {
Status validCheck = validateNodeId();
if (validCheck.isSuccess()) {
validCheck = validateNodeProperties();
}
return validCheck;
}
代码示例来源:origin: org.opendaylight.controller/topologymanager
public Status saveConfigInternal() {
Status saveStatus = configurationService.persistConfiguration(
new ArrayList<ConfigurationObject>(userLinksDB.values()), USER_LINKS_FILE_NAME);
if (!saveStatus.isSuccess()) {
return new Status(StatusCode.INTERNALERROR, "Topology save failed: " + saveStatus.getDescription());
}
return saveStatus;
}
代码示例来源:origin: org.opendaylight.controller/containermanager.implementation
public Status saveContainerConfigLocal() {
Status status = configurationService.persistConfiguration(
new ArrayList<ConfigurationObject>(containerConfigs.values()), CONTAINERS_FILE_NAME);
if (!status.isSuccess()) {
return new Status(StatusCode.INTERNALERROR, "Failed to save container configurations: "
+ status.getDescription());
}
return status;
}
代码示例来源:origin: org.opendaylight.controller/configuration.implementation
@Override
public Status saveConfiguration() {
boolean success = true;
for (IConfigurationContainerAware configurationAware : configurationAwareList) {
logger.trace("Save Config triggered for {}", configurationAware.getClass().getSimpleName());
Status status = configurationAware.saveConfiguration();
if (!status.isSuccess()) {
success = false;
logger.warn("Failed to save config for {} ({})", configurationAware.getClass().getSimpleName(),
status.getDescription());
}
}
if (success) {
return new Status(StatusCode.SUCCESS);
} else {
return new Status(StatusCode.INTERNALERROR, "Failed to save one or more configurations");
}
}
代码示例来源:origin: org.opendaylight.controller/usermanager.implementation
@Override
public Status saveConfiguration() {
boolean success = true;
Status ret = saveLocalUserList();
if (!ret.isSuccess()) {
success = false;
}
ret = saveAAAServerList();
if (!ret.isSuccess()) {
success = false;
}
ret = saveAuthorizationList();
if (!ret.isSuccess()) {
success = false;
}
if (success) {
return new Status(StatusCode.SUCCESS);
}
return new Status(StatusCode.INTERNALERROR, "Failed to save user configurations");
}
代码示例来源:origin: org.opendaylight.affinity/l2agent
private void installFlow(Match match, List<Action> actions, Node incoming_node, short priority) {
Flow f = new Flow(match, actions);
f.setPriority(priority);
// Modify the flow on the network node
Status status = programmer.addFlow(incoming_node, f);
if (!status.isSuccess()) {
logger.warn("SDN Plugin failed to program the flow: {}. The failure is: {}",
f, status.getDescription());
return;
}
logger.info("Installed flow {} in node {}", f, incoming_node);
}
代码示例来源:origin: org.opendaylight.vtn/manager.northbound
/**
* Delete all flow filters in the specified flow filter list.
*
* @param fid Flow filter identifier.
* @return Response as dictated by the HTTP Response Status code.
*/
protected final Response deleteFlowFilters(FlowFilterId fid) {
checkPrivilege(Privilege.WRITE);
IVTNManager mgr = getVTNManager();
Status status = mgr.clearFlowFilter(fid);
if (status == null) {
return Response.noContent().build();
}
if (status.isSuccess()) {
return Response.ok().build();
}
throw getException(status);
}
代码示例来源:origin: org.opendaylight.controller/appauth
@Override
public Status removeResourceGroup(String groupName) {
// Default resource group cannot be deleted
if (groupName == null || groupName.trim().isEmpty()) {
return new Status(StatusCode.BADREQUEST, "Invalid group name");
}
if (groupName.equals(this.allResourcesGroupName)) {
return new Status(StatusCode.NOTALLOWED,
"All resource group cannot be removed");
}
resourceGroups.remove(groupName);
Status result = removeRoleResourceGroupMapping(groupName);
return result.isSuccess() ? result :
new Status(StatusCode.SUCCESS, "Failed removing group from: " + result.getDescription());
}
代码示例来源:origin: org.opendaylight.affinity/flatl2
/**
* Install this flow entry object.
*/
public boolean installFlowEntry(FlowEntry fEntry) {
if (!this.ruleManager.checkFlowEntryConflict(fEntry)) {
if (this.ruleManager.installFlowEntry(fEntry).isSuccess()) {
return true;
} else {
log.error("Error in installing flow entry {} to node : {}", fEntry.toString(), fEntry.getNode());
}
} else {
log.error("Conflicting flow entry exists : {}", fEntry.toString());
}
return true;
}
代码示例来源:origin: org.opendaylight.controller/connectionmanager.implementation
@Override
public Status disconnect(Node node) {
if (node == null)
return new Status(StatusCode.BADREQUEST);
if (connectionService == null)
return new Status(StatusCode.NOSERVICE);
Status status = connectionService.disconnect(node);
if (status.isSuccess()) {
AbstractScheme scheme = schemes.get(activeScheme);
if (scheme != null)
scheme.removeNode(node);
}
return status;
}
代码示例来源:origin: org.opendaylight.controller/configuration.implementation
private Status saveConfigurationsInternal() {
boolean success = true;
for (IConfigurationAware configurationAware : configurationAwareList) {
if (configurationAware instanceof IConfigurationContainerService) {
// Create directory for new containers
createContainerDirectory(configurationAware);
}
Status status = configurationAware.saveConfiguration();
if (!status.isSuccess()) {
success = false;
logger.warn("Failed to save config for {}", configurationAware.getClass().getName());
}
}
// Remove startup directories of containers that were removed from
// the configuration but not saved
clearStaleContainerDirectories();
if (success) {
return new Status(StatusCode.SUCCESS);
} else {
return new Status(StatusCode.INTERNALERROR, "Failed to Save All Configurations");
}
}
代码示例来源:origin: org.opendaylight.controller/usermanager.implementation
private Status addRemoveAuthInfo(AuthorizationConfig AAAconf, boolean delete) {
Status configCheck = AAAconf.validate();
if (!configCheck.isSuccess()) {
String msg = "Invalid Authorization configuration: "
+ configCheck.getDescription();
logger.warn(msg);
return new Status(StatusCode.BADREQUEST, msg);
}
// Update configuration database
if (delete) {
authorizationConfList.remove(AAAconf.getUser());
} else {
authorizationConfList.put(AAAconf.getUser(), AAAconf);
}
return new Status(StatusCode.SUCCESS);
}
代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation
private Status addStaticFlow(FlowConfig config, boolean async) {
// Configuration object validation
Status status = config.validate();
if (!status.isSuccess()) {
log.warn("Invalid Configuration for flow {}. The failure is {}", config, status.getDescription());
String error = "Invalid Configuration (" + status.getDescription() + ")";
config.setStatus(error);
return new Status(StatusCode.BADREQUEST, error);
}
return addStaticFlowInternal(config, async, false);
}
代码示例来源:origin: org.opendaylight.snmp4sdn/snmp4sdn
public Status deleteVLAN(Node node, Integer vlanID){
Status status = checkNodeIpValid(node);
if(status.getCode() != StatusCode.SUCCESS) return status;
if(!isValidVlan(vlanID)){
logger.debug("ERROR: VLAN ID as " + vlanID + " is invalid, when delete VLAN from node " + getNodeIP((Long)node.getID()));
return new Status(StatusCode.NOTACCEPTABLE, "VLAN ID as " + vlanID + " is invalid, when delete VLAN from node " + getNodeIP((Long)node.getID()));
}
if(isDummy) return new Status(StatusCode.SUCCESS);
long nodeId = ((Long)node.getID()).longValue();
int vlanId = vlanID.intValue();
status = new SNMPHandler(cmethUtil).deleteVLAN(nodeId, vlanId);
if(!status.isSuccess())
logger.debug("ERROR: deleteVLAN(): Delete VLAN (node:" + nodeId + "(" + getNodeIP(nodeId) + ")" + ", vlanId:" + vlanId + ") on switch fail: " + status);
return status;
}
代码示例来源:origin: org.opendaylight.openflowplugin.legacy/sal-compatibility
@Override
public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
Flow flow = ToSalConversionsUtils.toFlow(input, null);
@SuppressWarnings("unchecked")
org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier<Node>) input
.getNode().getValue());
Status status = delegate.addFlowAsync(node, flow);
AddFlowOutputBuilder builder = new AddFlowOutputBuilder();
builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId())));
AddFlowOutput rpcResultType = builder.build();
return Futures.immediateFuture(RpcResultBuilder.<AddFlowOutput>status(status.isSuccess())
.withResult(rpcResultType).build());
}
代码示例来源:origin: org.opendaylight.openflowplugin.legacy/sal-compatibility
@Override
public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
Flow flow = ToSalConversionsUtils.toFlow(input, null);
@SuppressWarnings("unchecked")
org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier<Node>) input
.getNode().getValue());
Status status = delegate.removeFlowAsync(node, flow);
RemoveFlowOutputBuilder builder = new RemoveFlowOutputBuilder();
builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId())));
RemoveFlowOutput rpcResultType = builder.build();
return Futures.immediateFuture(RpcResultBuilder.<RemoveFlowOutput>status(status.isSuccess())
.withResult(rpcResultType).build());
}
代码示例来源:origin: org.opendaylight.snmp4sdn/snmp4sdn
public Status addVLAN(Node node, Integer vlanID, String vlanName){
Status status = checkNodeIpValid(node);
if(status.getCode() != StatusCode.SUCCESS) return status;
if(!isValidVlan(vlanID)){
logger.debug("ERROR: addVLAN(): VLAN ID as " + vlanID + " is invalid, when addVLAN to node " + getNodeIP((Long)node.getID()));
return new Status(StatusCode.NOTACCEPTABLE, "VLANService.addVLAN(): VLAN ID as " + vlanID + " is invalid, when addVLAN to node " + getNodeIP((Long)node.getID()));
}
if(vlanName == null){
logger.debug("ERROR: addVLAN(): VLAN name is null, which is invalid, when addVLAN to node " + getNodeIP((Long)node.getID()));
return new Status(StatusCode.NOTACCEPTABLE, "addVLAN(): VLAN name is null, which is invalid, when addVLAN to node " + getNodeIP((Long)node.getID()));
}
if(isDummy) return new Status(StatusCode.SUCCESS);
long nodeId = ((Long)node.getID()).longValue();
int vlanId = vlanID.intValue();
status = new SNMPHandler(cmethUtil).addVLAN(nodeId, vlanId, vlanName);
if(!status.isSuccess())
logger.debug("ERROR: addVLAN(): Add VLAN (node:" + nodeId + "(" + getNodeIP(nodeId) + ")" + ", vlanId:" + vlanId + ", vlanName:" + vlanName +") to switch fail: " + status);
return status;
}
代码示例来源:origin: org.opendaylight.controller/forwardingrulesmanager.implementation
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;
}
内容来源于网络,如有侵权,请联系作者删除!