[onos-5262] Adding patchset 1
[onos-5262] Adding patchset 2
Change-Id: I43cb43deca16bcfe1874699bccdb94b0301d30d1
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
index 1c7e22e..59a7442 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
@@ -102,6 +102,7 @@
private static final String UPDATE_META = "updateMeta";
private static final String ADD_HOST_INTENT = "addHostIntent";
private static final String REMOVE_INTENT = "removeIntent";
+ private static final String RESUBMIT_INTENT = "resubmitIntent";
private static final String ADD_MULTI_SRC_INTENT = "addMultiSourceIntent";
private static final String REQ_RELATED_INTENTS = "requestRelatedIntents";
private static final String REQ_NEXT_INTENT = "requestNextRelatedIntent";
@@ -224,6 +225,7 @@
new AddHostIntent(),
new AddMultiSourceIntent(),
new RemoveIntent(),
+ new ResubmitIntent(),
new ReqAllFlowTraffic(),
new ReqAllPortTraffic(),
@@ -467,6 +469,23 @@
}
}
+ private final class ResubmitIntent extends RequestHandler {
+ private ResubmitIntent() {
+ super(RESUBMIT_INTENT);
+ }
+
+ @Override
+ public void process(long sid, ObjectNode payload) {
+ Intent intent = findIntentByPayload(payload);
+ if (intent == null) {
+ log.warn("Unable to find intent from payload {}", payload);
+ } else {
+ log.debug("Resubmitting intent {}", intent.key());
+ intentService.submit(intent);
+ }
+ }
+ }
+
private final class AddMultiSourceIntent extends RequestHandler {
private AddMultiSourceIntent() {
super(ADD_MULTI_SRC_INTENT);
diff --git a/web/gui/src/main/webapp/app/view/intent/intent.html b/web/gui/src/main/webapp/app/view/intent/intent.html
index 3fa441a..18d8673 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.html
+++ b/web/gui/src/main/webapp/app/view/intent/intent.html
@@ -32,6 +32,11 @@
tooltip tt-msg="topoTip"
ng-click="showIntent()"></div>
+ <div ng-class="{'active': !!selId && isIntentWithdrawn()}"
+ icon icon-id="play" icon-size="42"
+ tooltip tt-msg="resubmitTip"
+ ng-click="(!!selId && isIntentWithdrawn()) ? resubmitIntent():''"></div>
+
<div ng-class="{'active': !!selId && isIntentInstalled()}"
icon icon-id="stop" icon-size="42"
tooltip tt-msg="deactivateTip"
diff --git a/web/gui/src/main/webapp/app/view/intent/intent.js b/web/gui/src/main/webapp/app/view/intent/intent.js
index 1b49a98..71c07cf 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.js
+++ b/web/gui/src/main/webapp/app/view/intent/intent.js
@@ -71,6 +71,7 @@
});
$scope.topoTip = 'Show selected intent on topology view';
+ $scope.resubmitTip = 'Resubmit selected intent';
$scope.deactivateTip = 'Remove selected intent';
$scope.purgeTip = 'Purge selected intent';
@@ -87,20 +88,22 @@
return $scope.intentState === 'Withdrawn';
};
- function executeAction(bPurge) {
+ function executeAction(action) {
var content = ds.createDiv(),
- txt = bPurge ? 'purge' : 'withdraw' ;
+ txt,
+ bPurge = action === 'purge';
$scope.intentData.intentPurge = bPurge;
content.append('p').
- text('Are you sure you want to '+ txt +
+ text('Are you sure you want to '+ action +
' the selected intent?');
function dOk() {
var d = $scope.intentData;
$log.debug(d);
- d && tts.removeIntent(d);
+ d && (action === 'resubmit' ? tts.resubmitIntent(d) :
+ tts.removeIntent(d));
$scope.fired = true;
}
@@ -118,11 +121,15 @@
}
$scope.deactivateIntent = function () {
- executeAction(false);
+ executeAction("withdraw");
+ };
+
+ $scope.resubmitIntent = function () {
+ executeAction("resubmit");
};
$scope.purgeIntent = function () {
- executeAction(true);
+ executeAction("purge");
};
$scope.briefToggle = function () {
diff --git a/web/gui/src/main/webapp/app/view/topo/topoTraffic.js b/web/gui/src/main/webapp/app/view/topo/topoTraffic.js
index 215f3e3..5d52ab1 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoTraffic.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoTraffic.js
@@ -192,6 +192,19 @@
flash.flash('Intent ' + txt);
}
+ function resubmitIntent (d) {
+ $log.debug('Entering resubmitIntent');
+ wss.sendEvent('resubmitIntent', {
+ appId: d.appId,
+ appName: d.appName,
+ key: d.key,
+ purge: d.intentPurge
+ });
+ trafficMode = 'intents';
+ hoverMode = null;
+ flash.flash('Intent resubmitted');
+ }
+
function addMultiSourceIntent () {
var so = api.selectOrder();
wss.sendEvent('addMultiSourceIntent', {
@@ -240,7 +253,8 @@
// invoked from buttons on detail (multi-select) panel
addHostIntent: addHostIntent,
addMultiSourceIntent: addMultiSourceIntent,
- removeIntent: removeIntent
+ removeIntent: removeIntent,
+ resubmitIntent: resubmitIntent
};
}]);
}());
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js
index 4febcb1..ff9fd72 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoTraffic-spec.js
@@ -50,6 +50,7 @@
'addHostIntent',
'addMultiSourceIntent',
'removeIntent',
+ 'resubmitIntent',
])).toBeTruthy();
});