From b9d6126601120aabf2d43e2e951915c0eed370ce Mon Sep 17 00:00:00 2001 From: Alexey Sandler Date: Mon, 20 Apr 2020 12:57:09 +0300 Subject: Add drop down Source subscriber name on the PMC instantiation form Add the "Source Subscriber Name" drop down for the source VNF on the PMC (Port Mirroring Configuration) instantiation form. Issue-ID: VID-809 Change-Id: Iab01675e815bbc9809c67e31e475613973d868ea Signed-off-by: Einat Vinouze Signed-off-by: Alexey Sandler Signed-off-by: Amichai Hemli Signed-off-by: Ittay Stern --- .../controller/ServiceProxyConfigController.js | 52 ++++++++++++++++++---- .../vid/scripts/view-models/serviceProxyConfig.htm | 12 ++++- 2 files changed, 54 insertions(+), 10 deletions(-) (limited to 'vid-app-common/src/main/webapp') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js index 8e3b5b890..c85187e98 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js @@ -60,25 +60,58 @@ appDS2.controller( $scope.serviceTypes = []; - function init() { - loadServiceTypes(); + $scope.isSourceSubscriberEnabled = function() { + return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_2006_PORT_MIRRORING_LET_SELECTING_SOURCE_SUBSCRIBER) + && !$scope.configurationByPolicy; + }; + function init() { + if ($scope.isSourceSubscriberEnabled()) { + loadSourceSubscriber(); + } + loadServiceTypes(DataService.getGlobalCustomerId(), handleGetSourceAndCollectorServiceTypesResponse); generateMetadata(sourceServiceProxy); generateMetadata(collectorServiceProxy); } + function loadSourceSubscriber() { + AaiService.getSubList(function (response) { + $scope.sourceSubscribers = response; + $scope.sourceSubscriber = response.find((subscriber)=>{ + return subscriber.globalCustomerId === DataService.getGlobalCustomerId(); + }); + }, function (response) { // failure + $scope.sourceSubscribers = []; + }); + } + + function getSourceSubscriberId() { + return $scope.isSourceSubscriberEnabled() + ? $scope.sourceSubscriber && $scope.sourceSubscriber.globalCustomerId + : DataService.getGlobalCustomerId() + } + function setDefaultCollectorServiceType() { const configServiceType = DataService.getServiceType(); $scope.collectorServiceType = mustFind($scope.serviceTypes, {"service-type": configServiceType}); loadCollectorProxies(); } - function handleGetServiceTypesResponse(response) { + function handleGetSourceAndCollectorServiceTypesResponse(response) { + handleGetSourceServiceTypesResponse(response) + handleGetCollectorServiceTypesResponse(response) + } + + function handleGetCollectorServiceTypesResponse(response) { $scope.serviceTypes = response.data; setDefaultCollectorServiceType(); } + function handleGetSourceServiceTypesResponse(response) { + $scope.sourceServiceTypes = response.data; + } + var handleGetParametersResponse = function(parameters) { $scope.serviceMetadataFields = parameters.summaryList; $scope.nodeTemplateFields = DataService.getPortMirroningConfigFields(); @@ -97,11 +130,14 @@ appDS2.controller( $window.history.back(); }; + $scope.onSourceSubscriberChange = function(selectedSubscriber) { + $scope.sourceSubscriber = selectedSubscriber + loadServiceTypes(selectedSubscriber.globalCustomerId, handleGetSourceServiceTypesResponse) + } - function loadServiceTypes() { - const subscriberId = DataService.getGlobalCustomerId(); + function loadServiceTypes(subscriberId, handleGetServiceTypesResponseCallback) { AaiService.getSubscriberServiceTypes(subscriberId) - .then(handleGetServiceTypesResponse) + .then(handleGetServiceTypesResponseCallback) .catch(function (error) { $log.error(error); }); @@ -288,7 +324,7 @@ appDS2.controller( if (service.name === 'collectorInstanceName' && $scope.configurationByPolicy) { var configurationModel = DataService.getModelInfo(COMPONENT.VNF); AaiService.getPnfInstancesList( - DataService.getGlobalCustomerId(), + getSourceSubscriberId(), serviceType, serviceProxy.sourceModelUuid, serviceProxy.sourceModelInvariant, @@ -307,7 +343,7 @@ appDS2.controller( }); } else { AaiService.getVnfInstancesList( - DataService.getGlobalCustomerId(), + getSourceSubscriberId(), serviceType, serviceProxy.sourceModelUuid, serviceProxy.sourceModelInvariant, diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm index 42732bb82..99d830573 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm @@ -64,10 +64,18 @@ limitations under the License.
-
Source Service Type
+
Source Subscriber name
+ + +
Source Service Type
-- cgit 1.2.3-korg