Change-Id: I6189ab2f617895a780bd14b9a620250476058da5
Signed-off-by: Alessandro Boch <aboch@cisco.com>
<commons.io.version>2.4</commons.io.version>
<bundlescanner.version>0.4.2-SNAPSHOT</bundlescanner.version>
<usermanager.version>0.4.2-SNAPSHOT</usermanager.version>
<commons.io.version>2.4</commons.io.version>
<bundlescanner.version>0.4.2-SNAPSHOT</bundlescanner.version>
<usermanager.version>0.4.2-SNAPSHOT</usermanager.version>
- <forwardingrulesmanager.version>0.5.1-SNAPSHOT</forwardingrulesmanager.version>
+ <forwardingrulesmanager.version>0.6.0-SNAPSHOT</forwardingrulesmanager.version>
<statisticsmanager.version>0.5.1-SNAPSHOT</statisticsmanager.version>
<clustering.services.version>0.5.1-SNAPSHOT</clustering.services.version>
<configuration.version>0.4.3-SNAPSHOT</configuration.version>
<statisticsmanager.version>0.5.1-SNAPSHOT</statisticsmanager.version>
<clustering.services.version>0.5.1-SNAPSHOT</clustering.services.version>
<configuration.version>0.4.3-SNAPSHOT</configuration.version>
</scm>
<artifactId>forwardingrulesmanager</artifactId>
</scm>
<artifactId>forwardingrulesmanager</artifactId>
- <version>0.5.1-SNAPSHOT</version>
+ <version>0.6.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<build>
<packaging>bundle</packaging>
<build>
*/
public Status addStaticFlow(FlowConfig config);
*/
public Status addStaticFlow(FlowConfig config);
+ /**
+ * Add a flow specified by the {@code FlowConfig} object on the current
+ * container, through an asynchronous call.
+ *
+ * @param config
+ * the {@code FlowConfig} object representing the static flow
+ * @return the {@code Status} object indicating the result of this action.
+ */
+ public Status addStaticFlowAsync(FlowConfig config);
+
/**
* Remove a flow specified by the {@code FlowConfig} object on the current
* container
/**
* Remove a flow specified by the {@code FlowConfig} object on the current
* container
*/
public Status removeStaticFlow(FlowConfig config);
*/
public Status removeStaticFlow(FlowConfig config);
+ /**
+ * Remove a flow specified by the {@code FlowConfig} object on the current
+ * container, through an asynchronous call.
+ *
+ * @param config
+ * the {@code FlowConfig} object representing the static flow
+ * @return the {@code Status} object indicating the result of this action
+ */
+ public Status removeStaticFlowAsync(FlowConfig config);
+
/**
* Replace the flow identified by the {@code FlowConfig.name} name for the
* {@code FlowConfig.node} network node with the new flow specified by
/**
* Replace the flow identified by the {@code FlowConfig.name} name for the
* {@code FlowConfig.node} network node with the new flow specified by
*
* @param config
* the {@code FlowConfig} object
*
* @param config
* the {@code FlowConfig} object
- * @returnthe {@code Status} object indicating the result of this action
+ * @return the {@code Status} object indicating the result of this action
*/
public Status modifyStaticFlow(FlowConfig config);
*/
public Status modifyStaticFlow(FlowConfig config);
*/
public Status removeStaticFlow(String name, Node node);
*/
public Status removeStaticFlow(String name, Node node);
+ /**
+ * Remove the flow specified by name on the passed network node via an
+ * asynchronous call
+ *
+ * @param name
+ * for the static flow
+ * @param node
+ * on which the flow is attached
+ * @return the {@code Status} object indicating the result of this action
+ */
+ public Status removeStaticFlowAsync(String name, Node node);
+
/**
* Toggle the installation status of the specified configured flow If the
* flow configuration status is active, this call will change the flow
/**
* Toggle the installation status of the specified configured flow If the
* flow configuration status is active, this call will change the flow
@Override
public Status addStaticFlow(FlowConfig config) {
@Override
public Status addStaticFlow(FlowConfig config) {
+ return addStaticFlow(config, false);
+ }
+
+ private Status addStaticFlow(FlowConfig config, boolean async) {
// Configuration object validation
Status status = config.validate();
if (!status.isSuccess()) {
// Configuration object validation
Status status = config.validate();
if (!status.isSuccess()) {
config.setStatus(error);
return new Status(StatusCode.BADREQUEST, error);
}
config.setStatus(error);
return new Status(StatusCode.BADREQUEST, error);
}
- return addStaticFlowInternal(config, false);
+ return addStaticFlowInternal(config, async, false);
+ }
+
+
+ @Override
+ public Status addStaticFlowAsync(FlowConfig config) {
+ return addStaticFlow(config, true);
* installation on the network node was successful
* @return The status of this request
*/
* installation on the network node was successful
* @return The status of this request
*/
- private Status addStaticFlowInternal(FlowConfig config, boolean restore) {
+ private Status addStaticFlowInternal(FlowConfig config, boolean async, boolean restore) {
boolean multipleFlowPush = false;
String error;
Status status;
boolean multipleFlowPush = false;
String error;
Status status;
// Program hw
if (config.installInHw()) {
FlowEntry entry = config.getFlowEntry();
// Program hw
if (config.installInHw()) {
FlowEntry entry = config.getFlowEntry();
- status = this.installFlowEntry(entry);
+ status = async ? this.installFlowEntryAsync(entry) : this.installFlowEntry(entry);
if (!status.isSuccess()) {
config.setStatus(status.getDescription());
if (!restore) {
if (!status.isSuccess()) {
config.setStatus(status.getDescription());
if (!restore) {
@Override
public Status removeStaticFlow(FlowConfig config) {
@Override
public Status removeStaticFlow(FlowConfig config) {
+ return removeStaticFlow(config, false);
+ }
+
+ @Override
+ public Status removeStaticFlowAsync(FlowConfig config) {
+ return removeStaticFlow(config, true);
+ }
+
+ private Status removeStaticFlow(FlowConfig config, boolean async) {
/*
* No config.isInternal() check as NB does not take this path and GUI
* cannot issue a delete on an internal generated flow. We need this
/*
* No config.isInternal() check as NB does not take this path and GUI
* cannot issue a delete on an internal generated flow. We need this
}
// Program the network node
}
// Program the network node
- Status status = this.uninstallFlowEntry(config.getFlowEntry());
+ Status status = async ? this.uninstallFlowEntryAsync(config.getFlowEntry()) : this.uninstallFlowEntry(config
+ .getFlowEntry());
// Update configuration database if programming was successful
if (status.isSuccess()) {
// Update configuration database if programming was successful
if (status.isSuccess()) {
@Override
public Status removeStaticFlow(String name, Node node) {
@Override
public Status removeStaticFlow(String name, Node node) {
+ return removeStaticFlow(name, node, false);
+ }
+
+ @Override
+ public Status removeStaticFlowAsync(String name, Node node) {
+ return removeStaticFlow(name, node, true);
+ }
+
+ private Status removeStaticFlow(String name, Node node, boolean async) {
// Look for the target configuration entry
Integer key = 0;
FlowConfig target = null;
// Look for the target configuration entry
Integer key = 0;
FlowConfig target = null;
}
// Program the network node
}
// Program the network node
- Status status = this.removeEntry(target.getFlowEntry(), false);
+ Status status = this.removeEntry(target.getFlowEntry(), async);
// Update configuration database if programming was successful
if (status.isSuccess()) {
// Update configuration database if programming was successful
if (status.isSuccess()) {
}
for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, STATIC_FLOWS_FILE_NAME)) {
}
for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, STATIC_FLOWS_FILE_NAME)) {
- addStaticFlowInternal((FlowConfig) conf, true);
+ addStaticFlowInternal((FlowConfig) conf, false, true);
// check if the frm really needs to act on the notification.
// this is to check against duplicate notifications
if(programInternalFlow(proactive, fc)) {
// check if the frm really needs to act on the notification.
// this is to check against duplicate notifications
if(programInternalFlow(proactive, fc)) {
- Status status = (proactive) ? addStaticFlowInternal(fc, false) : removeStaticFlow(fc);
+ Status status = (proactive) ? addStaticFlowInternal(fc, false, false) : removeStaticFlow(fc);
if (status.isSuccess()) {
log.trace("{} Proactive Static flow: {}", (proactive ? "Installed" : "Removed"), fc.getName());
} else {
if (status.isSuccess()) {
log.trace("{} Proactive Static flow: {}", (proactive ? "Installed" : "Removed"), fc.getName());
} else {
if ((staticFlow.getNode().equals(node)) && (staticFlow.getPortGroup().equals(config.getName()))) {
for (Short port : data.getPorts()) {
FlowConfig derivedFlow = getDerivedFlowConfig(staticFlow, config.getName(), port);
if ((staticFlow.getNode().equals(node)) && (staticFlow.getPortGroup().equals(config.getName()))) {
for (Short port : data.getPorts()) {
FlowConfig derivedFlow = getDerivedFlowConfig(staticFlow, config.getName(), port);
- addStaticFlowInternal(derivedFlow, false);
+ addStaticFlowInternal(derivedFlow, false, false);