summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/webapp/app/vid/scripts/services
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-08-06 16:14:59 +0300
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-08-06 16:14:59 +0300
commitd350d5ac25c8df2846e4f0d9082cb4d364a17a83 (patch)
tree6e2afb18b785bb98dfa61509ae89749a221ad4e8 /vid-app-common/src/main/webapp/app/vid/scripts/services
parentff76b5ed0aa91d5fdf9dc4f95e8b20f91ed9d072 (diff)
UI Feature flagging support
Change-Id: Ic2151dab6306c42364483e9064c01bab3dd7378b Issue-ID: VID-208 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/services')
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js109
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js63
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js11
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js12
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js23
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js142
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js72
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js53
8 files changed, 334 insertions, 151 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
index 4b1d7713..ceb5a754 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
@@ -20,7 +20,7 @@
"use strict";
-var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD, $q) {
+var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD, $q, featureFlags) {
function getServiceInstance(serviceInstanceIdentifier, findBy) {
serviceInstanceIdentifier.trim();
@@ -44,9 +44,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
});
return deferred.promise;
- };
-
-
+ }
function getGlobalCustomerIdFromServiceInstanceResponse(response) {
var globalCustomerId = "";
if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) {
@@ -69,7 +67,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
timeout : PropertyService.getServerResponseTimeoutMsec()
}).then(function (response) {
var displayData = response.data[FIELD.ID.SERVICE_INSTANCES];
- if (!displayData.length) {
+ if (!displayData || !displayData.length) {
displayData = [{
globalCustomerId : null,
subscriberName : null,
@@ -115,7 +113,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
- $http.get(url, {}, {
+ return $http.get(url, {}, {
timeout : PropertyService.getServerResponseTimeoutMsec()
@@ -169,6 +167,26 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
});
},
+ getCRInformationByInstanceId : function (serviceInstanceId) {
+
+ var deferred = $q.defer();
+
+ var url = COMPONENT.AAI_GET_CR_INSTANCE +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ $http.get(url, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ deferred.resolve(response);
+ } else {
+ deferred.resolve(response);
+ }
+ }, function(response) {
+ deferred.resolve(response);
+ });
+ return deferred.promise;
+ },
+
searchServiceInstances: searchServiceInstances,
getModelVersionId: function (subscriberId, instanceId) {
@@ -329,6 +347,44 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
});
},
+ getPortMirroringData : function (ids) {
+ var defer = $q.defer();
+ if(featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_REGION_ID_FROM_REMOTE)){
+ var url = COMPONENT.AAI_GET_PORT_MIRRORING_CONFIGS_DATA +'?configurationIds=' + ids.join(',');
+ $http.get(url).then(function(res){
+ defer.resolve(res);
+ }).catch(function(err) {
+ $log.error(err);
+ defer.resolve({});
+ });
+ }else {
+ var staticConfigurationData = {};
+ angular.forEach(ids, function(id) {
+ staticConfigurationData[id] = {
+ "cloudRegionId": "mdt1"
+ }
+ });
+ defer.resolve({
+ "data": staticConfigurationData
+ });
+ }
+
+ return defer.promise;
+
+ },
+
+ getPortMirroringSourcePorts : function (ids) {
+ var defer = $q.defer();
+ var url = COMPONENT.AAI_GET_PORT_MIRRORING_SOURCE_PORTS +'?configurationIds=' + ids.join(',');
+ $http.get(url).then(function(res){
+ defer.resolve(res);
+ }).catch(function(err) {
+ $log.error(err);
+ defer.resolve({});
+ });
+ return defer.promise;
+ },
+
getSubscriptionServiceTypeList : function(globalCustomerId,
successCallbackFunction) {
$log
@@ -444,11 +500,12 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
} else {
successCallbackFunction([]);
}
- },function(failure){console.log("failure")})["catch"]
- if(catchCallbackFunction) {
+ })["catch"] (function(response, status) {
+ if (catchCallbackFunction) {
catchCallbackFunction();
}
- (UtilityService.runHttpErrorHandler);
+ UtilityService.runHttpErrorHandler(response, status);
+ })
},
getServices : function(successCallbackFunction) {
$log
@@ -565,7 +622,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
var deferred = $q.defer();
if (UtilityService.hasContents(modelInvariantId)) {
- var body = {"versions" : modelInvariantId}
+ var body = {"versions": modelInvariantId};
$http.post(( COMPONENT.AAI_GET_VERSION_BY_INVARIANT_ID),body)
.success(function (response) {
@@ -657,8 +714,36 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
});
return deferred.promise;
+ },
+
+ getInstanceGroupsByVNFInstanceId: function (vnf_instance_id, successCallback, errorCallback) {
+ var url = COMPONENT.AAI_GET_INSTANCE_GROUPS_BY_VNF_INSTANCE_ID_PATH + "/" + vnf_instance_id;
+
+ $http.get(url, {}, {
+ timeout: PropertyService.getServerResponseTimeoutMsec()
+ }).then(function (response) {
+ successCallback(response);
+ }, function (response) {
+ errorCallback(response);
+ });
+ },
+
+ postPOMBAverificationRequest: function (url, data, config) {
+ $http.post(url, data, config)
+ .success(function (data, status, headers, config) {
+ //If at some point in the future the result should be handled - this should be the entry point.
+ log.debug("POMBA was called successfully with data: " + data);
+ })
+ .error(function (data, status, header, config) {
+ log.debug("Error: " +
+ "Data: " + data +
+ "status: " + status +
+ "headers: " + header +
+ "config: " + config);
+ });
}
- }};
+ }
+};
appDS2.factory("AaiService", ["$http", "$log", "PropertyService",
- "UtilityService", "COMPONENT", "FIELD", "$q", AaiService]);
+ "UtilityService", "COMPONENT", "FIELD", "$q", "featureFlags", AaiService]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
index 68fdce44..753f9fd1 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
@@ -20,21 +20,56 @@
"use strict";
-var AsdcService = function($http, $log, PropertyService, UtilityService) {
+var AsdcService = function ($http, $log, PropertyService, UtilityService, VIDCONFIGURATION, COMPONENT, featureFlags) {
return {
- getModel : function(modelId, successCallbackFunction) {
- $log.debug("AsdcService:getModel: modelId: " + modelId);
- $http.get(
- "asdc/getModel/" + modelId
- + "?r=" + Math.random(),
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(successCallbackFunction)["catch"]
- (UtilityService.runHttpErrorHandler);
- }
+ getModel: function (modelId, successCallbackFunction) {
+ $log.debug("AsdcService:getModel: modelId: " + modelId);
+ $http.get(
+ "asdc/getModel/" + modelId
+ + "?r=" + Math.random(),
+ {
+ timeout: PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(successCallbackFunction)["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+
+ shouldExcludeMacroFromAsyncInstatiationFlow: function(serviceModel){
+ if (!featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ASYNC_INSTANTIATION))
+ return true;
+ if (!_.isEmpty(serviceModel.pnfs))
+ return true;
+ if (!_.isEmpty(serviceModel.collectionResource))
+ return true;
+ if (!_.isEmpty(serviceModel.networks) && !featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_NETWORK_TO_ASYNC_INSTANTIATION))
+ return true;
+ if(serviceModel.service.instantiationType === "ClientConfig")
+ return true;
+ return false;
+ },
+
+ isMacro: function (serviceModel) {
+ if (serviceModel && serviceModel.service) {
+ switch (serviceModel.service.instantiationType) {
+ case 'Macro':
+ case 'Both':
+ return true;
+ case 'A-La-Carte':
+ return false;
+ case 'ClientConfig':
+ console.debug("Looking for " + serviceModel.service.invariantUuid + " by Client Config");
+ return UtilityService.arrayContains(VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid);
+ default:
+ console.debug("Unexpected serviceModel.service.instantiationType: " + serviceModel.service.instantiationType);
+ return true;
+ }
+ } else {
+ $log.debug("isMscro=false, because serviceModel.service is undefined");
+ return false;
+ }
+ }
}
}
-appDS2.factory("AsdcService", [ "$http", "$log", "PropertyService",
- "UtilityService", AsdcService ]);
+appDS2.factory("AsdcService", ["$http", "$log", "PropertyService",
+ "UtilityService", "VIDCONFIGURATION","COMPONENT", "featureFlags", AsdcService]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
index 0e7dbe46..f2a77e22 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
@@ -30,10 +30,9 @@
*/
var CreationService = function($log, AaiService, AsdcService, DataService,VIDCONFIGURATION,
- ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService, OwningEntityService) {
+ ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService, OwningEntityService,featureFlags) {
var _this = this;
-
var getAsyncOperationList = function() {
if (DataService.getLoggedInUserId() == null) {
getLoggedInUserID();
@@ -660,6 +659,11 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON
userParams : getArbitraryParameters(parameterList)
}
};
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ADD_MSO_TESTAPI_FIELD)) {
+ if ((_this.componentId != COMPONENT.SERVICE) || ( DataService.getALaCarte() )) {
+ requestDetails.requestParameters.testApi = DataService.getMsoRequestParametersTestApi();
+ }
+ }
if ( (_this.componentId != COMPONENT.SERVICE) || ( !DataService.getALaCarte() ) ) {
// include cloud region for everything but service create alacarte
var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
@@ -673,6 +677,7 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON
};
}
switch (_this.componentId) {
+
case COMPONENT.SERVICE:
requestDetails.subscriberInfo = {
globalSubscriberId : DataService.getGlobalCustomerId(),
@@ -1285,4 +1290,4 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON
appDS2.factory("CreationService", [ "$log", "AaiService", "AsdcService",
"DataService","VIDCONFIGURATION", "ComponentService", "COMPONENT", "FIELD", "PARAMETER",
- "UtilityService", "OwningEntityService", CreationService ]);
+ "UtilityService", "OwningEntityService","featureFlags", CreationService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js
index 77523e9c..0e163551 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js
@@ -257,6 +257,9 @@ var DataService = function($log, DataService) {
getServiceInstanceToCustomer : function() {
return _this.serviceInstanceToCustomer;
},
+ getMsoRequestParametersTestApi: function(){
+ return sessionStorage.getItem("msoRequestParametersTestApiValue");
+ },
setALaCarte : function(aval) {
_this.aLaCarte = aval;
},
@@ -267,6 +270,15 @@ var DataService = function($log, DataService) {
}
return _this.aLaCarte;
},
+ setShouldExcludeMacroFromAsyncInstatiationFlow: function (val) {
+ _this.shouldExcludeMacroFromAsyncInstatiationFlow = val;
+ },
+ getShouldExcludeMacroFromAsyncInstatiationFlow: function(){
+ if (_this.shouldExcludeMacroFromAsyncInstatiationFlow === undefined) {
+ return false;
+ }
+ return _this.shouldExcludeMacroFromAsyncInstatiationFlow;
+ },
setMacro : function(aval) {
_this.macro = aval;
},
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js
index 3255bc9a..416096a1 100644
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js
@@ -21,7 +21,7 @@
"use strict";
var DeleteResumeService = function($log, AaiService, AsdcService, DataService,
- ComponentService, COMPONENT, FIELD, UtilityService) {
+ ComponentService, COMPONENT, FIELD, UtilityService,featureFlags) {
var _this = this;
@@ -255,7 +255,7 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService,
}
};
- var getMsoUrl = function() {
+ var getMsoUrl = function(serviceStatus) {
switch (_this.componentId) {
case COMPONENT.CONFIGURATION:
return "mso_delete_configuration/"
@@ -269,7 +269,7 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService,
if(DataService.getE2EService() === true)
return "mso_delete_e2e_svc_instance/"+ DataService.getServiceInstanceId();
else
- return "mso_delete_svc_instance/"+ DataService.getServiceInstanceId();
+ return "mso_delete_svc_instance" + "/" + DataService.getServiceInstanceId() + "?serviceStatus=" + serviceStatus;
case COMPONENT.VNF:
return "mso_delete_vnf_instance/"
+ DataService.getServiceInstanceId() + "/vnfs/"
@@ -330,12 +330,21 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService,
requestorId: requestorloggedInId
}
};
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ADD_MSO_TESTAPI_FIELD)) {
+ if ((_this.componentId != COMPONENT.SERVICE) || ( DataService.getALaCarte() )) {
+ // a-la-carte services AND *any* non-service
+ requestDetails.requestParameters = {
+ testApi : DataService.getMsoRequestParametersTestApi()
+ };
+ }
+ }
switch (_this.componentId) {
case COMPONENT.SERVICE:
- requestDetails.requestParameters = {
- aLaCarte : DataService.getALaCarte()
- };
+ if (!requestDetails.requestParameters) {
+ requestDetails.requestParameters = {};
+ }
+ requestDetails.requestParameters.aLaCarte = DataService.getALaCarte();
if ( !(DataService.getALaCarte()) ) {
// for macro delete include cloud config.
var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
@@ -530,4 +539,4 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService,
appDS2.factory("DeleteResumeService", [ "$log", "AaiService", "AsdcService",
"DataService", "ComponentService", "COMPONENT", "FIELD",
- "UtilityService", DeleteResumeService ]);
+ "UtilityService","featureFlags", DeleteResumeService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js
index 37220ffd..044b5b91 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js
@@ -20,79 +20,101 @@
"use strict";
-var DetailsService = function($log, DataService, ComponentService, COMPONENT,
- FIELD, UtilityService) {
+var DetailsService = function ($log, DataService, ComponentService, COMPONENT,
+ FIELD, UtilityService) {
var _this = this;
- var getSummaryList = function() {
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- case COMPONENT.SERVICE:
- case COMPONENT.VNF:
- case COMPONENT.VF_MODULE:
- case COMPONENT.VOLUME_GROUP:
- return [ {
- name : FIELD.NAME.SUBSCRIBER_NAME,
- value : DataService.getSubscriberName()
- }, {
- name : FIELD.NAME.SERVICE_INSTANCE_ID,
- value : DataService.getServiceInstanceId()
- }, {
- name : FIELD.NAME.SERVICE_TYPE,
- value : DataService.getServiceType()
- } ];
- }
+ var getSummaryList = function () {
+ var model = DataService.getModelInfo(COMPONENT.SERVICE);
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.SERVICE:
+ case COMPONENT.VNF:
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.VOLUME_GROUP:
+ return [{
+ name: FIELD.NAME.SUBSCRIBER_NAME,
+ value: DataService.getSubscriberName()
+ }, {
+ name: FIELD.NAME.SERVICE_INSTANCE_ID,
+ value: DataService.getServiceInstanceId()
+ }, {
+ name: FIELD.NAME.SERVICE_TYPE,
+ value: DataService.getServiceType()
+ }, {
+ name: FIELD.NAME.MODEL_NAME,
+ value: model.modelName
+ }, {
+ name: FIELD.NAME.MODEL_VERSION,
+ value: model.modelVersion
+ }];
+ }
};
- var getDetailsList = function() {
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- case COMPONENT.SERVICE:
- case COMPONENT.VNF:
- case COMPONENT.VF_MODULE:
- case COMPONENT.VOLUME_GROUP:
- return ComponentService.getDisplayNames(ComponentService
- .getInventoryParameterList(_this.componentId, DataService
- .getInventoryItem(), false));
- }
+ var getDetailsList = function () {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.SERVICE:
+ case COMPONENT.VNF:
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.VOLUME_GROUP:
+ var model = DataService.getModelInfo(_this.componentId);
+ var metaData = ComponentService.getDisplayNames(ComponentService
+ .getInventoryParameterList(_this.componentId, DataService
+ .getInventoryItem(), false));
+ if (model && !UtilityService.isObjectEmpty(model.modelName) && !UtilityService.isObjectEmpty(model.modelVersion)) {
+ metaData = metaData.concat([
+ {
+ id: FIELD.NAME.MODEL_NAME,
+ name: FIELD.NAME.MODEL_NAME,
+ value: model.modelName
+ }, {
+ id: FIELD.NAME.MODEL_VERSION,
+ name: FIELD.NAME.MODEL_VERSION,
+ value: model.modelVersion
+ }
+ ]);
+ }
+ return metaData;
+ }
};
- var getMsoFilterString = function() {
+ var getMsoFilterString = function () {
- var instanceId = "";
+ var instanceId = "";
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- instanceId = DataService.getNetworkInstanceId();
- break;
- case COMPONENT.SERVICE:
- instanceId = DataService.getServiceInstanceId();
- break;
- case COMPONENT.VNF:
- instanceId = DataService.getVnfInstanceId();
- break;
- case COMPONENT.VF_MODULE:
- instanceId = DataService.getVfModuleInstanceId();
- break;
- case COMPONENT.VOLUME_GROUP:
- instanceId = DataService.getVolumeGroupInstanceId();
- }
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ instanceId = DataService.getNetworkInstanceId();
+ break;
+ case COMPONENT.SERVICE:
+ instanceId = DataService.getServiceInstanceId();
+ break;
+ case COMPONENT.VNF:
+ instanceId = DataService.getVnfInstanceId();
+ break;
+ case COMPONENT.VF_MODULE:
+ instanceId = DataService.getVfModuleInstanceId();
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ instanceId = DataService.getVolumeGroupInstanceId();
+ }
- return "filter=" + _this.componentId + "InstanceId:EQUALS:"
- + instanceId;
+ return "filter=" + _this.componentId + "InstanceId:EQUALS:"
+ + instanceId;
};
return {
- initializeComponent : function(componentId) {
- _this.componentId = ComponentService.initialize(componentId);
- },
- getComponentDisplayName : ComponentService.getComponentDisplayName,
- getSummaryList : getSummaryList,
- getDetailsList : getDetailsList,
- getMsoFilterString : getMsoFilterString
+ initializeComponent: function (componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ getComponentDisplayName: ComponentService.getComponentDisplayName,
+ getSummaryList: getSummaryList,
+ getDetailsList: getDetailsList,
+ getMsoFilterString: getMsoFilterString
}
}
-appDS2.factory("DetailsService", [ "$log", "DataService", "ComponentService",
- "COMPONENT", "FIELD", "UtilityService", DetailsService ]);
+appDS2.factory("DetailsService", ["$log", "DataService", "ComponentService",
+ "COMPONENT", "FIELD", "UtilityService", DetailsService]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js
index 67211d48..273f8e9e 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js
@@ -20,7 +20,7 @@
"use strict";
-var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityService, COMPONENT, FIELD) {
+var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityService, COMPONENT, FIELD, moment) {
var _this = this;
@@ -36,7 +36,7 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
timeout : PropertyService.getServerResponseTimeoutMsec()
}).then(successCallbackFunction)["catch"]
(UtilityService.runHttpErrorHandler);
- }
+ };
var checkValidStatus = function(response) {
if (response.data.status < 200 || response.data.status > 202) {
@@ -55,7 +55,7 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
}
};
- var buildPayloadForServiceActivateDeactivate = function (model, userId, aicZone) {
+ var buildPayloadForServiceActivateDeactivate = function (model, userId) {
var requestDetails = {
"modelInfo": {
"modelType": "service",
@@ -69,10 +69,8 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
"requestorId": userId
},
"requestParameters": {
- "userParams": [{
- "name": "aic_zone",
- "value": aicZone
- }]
+ // aicZone was sent from here
+ "userParams": []
}
};
@@ -83,14 +81,14 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
};
var activateInstance = function(requestParams) {
- var requestDetails = buildPayloadForServiceActivateDeactivate(requestParams.model, requestParams.userId, requestParams.aicZone);
+ var requestDetails = buildPayloadForServiceActivateDeactivate(requestParams.model, requestParams.userId);
return sendPostRequest(COMPONENT.MSO_ACTIVATE_INSTANCE.replace('@serviceInstanceId', requestParams.instance.serviceInstanceId),
requestDetails);
};
var deactivateInstance = function(requestParams) {
- var requestDetails = buildPayloadForServiceActivateDeactivate(requestParams.model, requestParams.userId, requestParams.aicZone);
+ var requestDetails = buildPayloadForServiceActivateDeactivate(requestParams.model, requestParams.userId);
return sendPostRequest(COMPONENT.MSO_DEACTIVATE_INSTANCE.replace('@serviceInstanceId', requestParams.instance.serviceInstanceId),
requestDetails);
@@ -154,7 +152,7 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status);
checkValidStatus(response);
- var list = response.data.entity.requestList
+ var list = response.data.entity.requestList;
UtilityService.checkUndefined(FIELD.ID.REQUEST_LIST, list);
var message = "";
@@ -168,8 +166,10 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
if (status === undefined) {
message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n";
} else {
- message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp)
- + ",\n";
+ if(status.finishTime) {
+ message += addListEntry(FIELD.ID.TIMESTAMP, moment(new Date(status.finishTime)).format("ddd, DD MMM YYYY HH:mm:ss"))
+ + ",\n";
+ }
message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState)
+ ",\n";
message += addListEntry(FIELD.ID.REQUEST_STATUS,
@@ -203,7 +203,7 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
if (status === undefined) {
message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n";
} else {
- message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp)
+ message += addListEntry(FIELD.ID.TIMESTAMP, moment(new Date()).format("ddd, DD MMM YYYY HH:mm:ss"))
+ ",\n";
message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState)
+ ",\n";
@@ -272,7 +272,7 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
showFunction(FIELD.ERROR.SYSTEM_FAILURE, error.message);
break;
case "msoFailure":
- showFunction(FIELD.ERROR.MSO, "")
+ showFunction(FIELD.ERROR.MSO, "");
break;
default:
showFunction(FIELD.ERROR.SYSTEM_FAILURE);
@@ -341,15 +341,16 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
}
},
{
- "relatedInstance": {
- "instanceId": requestParams.configurationByPolicy ?
- requestParams.portMirroringConfigFields.destinationInstance.properties['pnfName']:
- requestParams.portMirroringConfigFields.destinationInstance.properties['vnf-id'],
+ "relatedInstance": requestParams.configurationByPolicy ? {
+ "instanceName": requestParams.portMirroringConfigFields.destinationInstance.properties['pnfName'],
"instanceDirection": "destination",
- "modelInfo":
- requestParams.configurationByPolicy ?
- {"modelType": "pnf"} :
- modelInfoOf(requestParams.portMirroringConfigFields.destinationInstance)
+ "modelInfo": {
+ "modelType": "pnf"
+ }
+ } : {
+ "instanceId": requestParams.portMirroringConfigFields.destinationInstance.properties['vnf-id'],
+ "instanceDirection": "destination",
+ "modelInfo": modelInfoOf(requestParams.portMirroringConfigFields.destinationInstance)
}
}
],
@@ -375,13 +376,31 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
});
return deferred.promise;
},
+ deleteConfiguration: function(requestParams, configuration) {
+
+ var requestDetails = {
+ "modelInfo": requestParams.configurationModel,
+ "cloudConfiguration": {
+ "lcpCloudRegionId": configuration.configData.cloudRegionId
+ },
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": requestParams.userId
+ },
+ "requestParameters": {
+ "userParams": []
+ }
+ };
- toggleConfigurationStatus: function(requestParams) {
+ var url = "mso/mso_delete_configuration/" + requestParams.serviceInstanceId + "/configurations/" + requestParams.configurationId;
+ return sendPostRequest(url, requestDetails);
+ },
+ toggleConfigurationStatus: function(requestParams, configuration) {
var requestDetails = {
"modelInfo": requestParams.configurationModel,
"cloudConfiguration": {
- "lcpCloudRegionId": "mdt1"
+ "lcpCloudRegionId": configuration && configuration.configData ? configuration.configData.cloudRegionId : null
},
"requestInfo": {
"source": "VID",
@@ -412,11 +431,12 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS
return sendPostRequest(url, requestDetails);
},
- togglePortStatus: function(requestParams) {
+ togglePortStatus: function(requestParams, configuration, defaultParams) {
+
var requestDetails = {
"modelInfo": requestParams.configurationModel,
"cloudConfiguration": {
- "lcpCloudRegionId": "mdt1"
+ "lcpCloudRegionId": configuration && configuration.configData ? configuration.configData.cloudRegionId : null
},
"requestInfo": {
"source": "VID",
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js
index 942bd795..b8ef406a 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js
@@ -63,29 +63,24 @@
* string for some known conditions.
*/
-var UtilityService = function($log, DataService, PARAMETER) {
+var UtilityService = function($log, DataService, PARAMETER, _) {
var _this = this;
+
+ function hasCustomizationUuidFields(mapOfVfs) {
+ return _.some(mapOfVfs, function (o) {
+ return _.has(o, "customizationUuid");
+ });
+ }
+
var convertModel = function (serviceModel) {
- var isNewFlow = false;
+ var isNewFlow =
+ hasCustomizationUuidFields(serviceModel.networks)
+ || hasCustomizationUuidFields(serviceModel.pnfs)
+ || hasCustomizationUuidFields(serviceModel.vnfs)
+ || hasCustomizationUuidFields(serviceModel.configurations);
- for (var networkCustomizationName in serviceModel.networks) {
- var networkModel = serviceModel.networks[networkCustomizationName];
- if ( networkModel.customizationUuid != null ) {
- isNewFlow = true;
- break;
- }
- }
- if ( !isNewFlow ) {
- for (var vnfCustomizationName in serviceModel.vnfs) {
- var vnfModel = serviceModel.vnfs[vnfCustomizationName];
- if ( vnfModel.customizationUuid != null ) {
- isNewFlow = true;
- break;
- }
- }
- }
if ( isNewFlow ) {
return (convertNewModel (serviceModel) );
}
@@ -179,7 +174,7 @@ var UtilityService = function($log, DataService, PARAMETER) {
element.isPnf= true;
element.modelCustomizationName= key;
});
- var mergedVnfs = Object.assign(serviceModel.vnfs, serviceModel.configurations, serviceModel.pnfs);
+ var mergedVnfs = Object.assign({}, serviceModel.vnfs, serviceModel.configurations, serviceModel.pnfs);
for (var vnfCustomizationName in mergedVnfs) {
var vnfModel = mergedVnfs[vnfCustomizationName];
@@ -279,13 +274,13 @@ var UtilityService = function($log, DataService, PARAMETER) {
convertedAsdcModel.vnfs[vnfCustomizationUuid]["nfFunction"] = vnf_function;
convertedAsdcModel.vnfs[vnfCustomizationUuid]["nfCode"] = vnf_code;
//
- for (var vfModuleCustomizationName in serviceModel.vnfs[vnfCustomizationName].vfModules) {
- var vfModuleModel = serviceModel.vnfs[vnfCustomizationName].vfModules[vfModuleCustomizationName];
+ for (var vfModuleCustomizationName in vnfModel.vfModules) {
+ var vfModuleModel = vnfModel.vfModules[vfModuleCustomizationName];
convertedAsdcModel.vnfs[vnfCustomizationUuid].vfModules[vfModuleModel.customizationUuid] = vfModuleModel;
}
- for (var volumeGroupCustomizationName in serviceModel.vnfs[vnfCustomizationName].volumeGroups) {
- var volumeGroupModel = serviceModel.vnfs[vnfCustomizationName].volumeGroups[volumeGroupCustomizationName];
+ for (var volumeGroupCustomizationName in mergedVnfs[vnfCustomizationName].volumeGroups) {
+ var volumeGroupModel = mergedVnfs[vnfCustomizationName].volumeGroups[volumeGroupCustomizationName];
convertedAsdcModel.vnfs[vnfCustomizationUuid].volumeGroups[volumeGroupModel.customizationUuid] = volumeGroupModel;
}
}
@@ -391,7 +386,7 @@ var UtilityService = function($log, DataService, PARAMETER) {
element.isPnf= true;
element.modelCustomizationName= key;
});
- var mergedVnfs = Object.assign(serviceModel.vnfs, serviceModel.configurations, serviceModel.pnfs);
+ var mergedVnfs = Object.assign({}, serviceModel.vnfs, serviceModel.configurations, serviceModel.pnfs);
for (var vnfCustomizationName in mergedVnfs) {
var vnfModel = mergedVnfs[vnfCustomizationName];
@@ -458,13 +453,13 @@ var UtilityService = function($log, DataService, PARAMETER) {
convertedAsdcModel.vnfs[vnfModel.uuid].displayInputs=vnfModelDisplayInputs;
}
- for (var vfModuleCustomizationName in serviceModel.vnfs[vnfCustomizationName].vfModules) {
- var vfModuleModel = serviceModel.vnfs[vnfCustomizationName].vfModules[vfModuleCustomizationName];
+ for (var vfModuleCustomizationName in vnfModel.vfModules) {
+ var vfModuleModel = vnfModel.vfModules[vfModuleCustomizationName];
convertedAsdcModel.vnfs[vnfModel.uuid].vfModules[vfModuleModel.uuid] = vfModuleModel;
}
- for (var volumeGroupCustomizationName in serviceModel.vnfs[vnfCustomizationName].volumeGroups) {
- var volumeGroupModel = serviceModel.vnfs[vnfCustomizationName].volumeGroups[volumeGroupCustomizationName];
+ for (var volumeGroupCustomizationName in vnfModel.volumeGroups) {
+ var volumeGroupModel = vnfModel.volumeGroups[volumeGroupCustomizationName];
convertedAsdcModel.vnfs[vnfModel.uuid].volumeGroups[volumeGroupModel.uuid] = volumeGroupModel;
}
}
@@ -682,4 +677,4 @@ var UtilityService = function($log, DataService, PARAMETER) {
}
//app.factory("UtilityService", UtilityService);
-appDS2.factory("UtilityService", [ "$log", "DataService", "PARAMETER", UtilityService ]);
+appDS2.factory("UtilityService", [ "$log", "DataService", "PARAMETER", "_", UtilityService ]);