* ============LICENSE_START=======================================================\r
* VID\r
* ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.\r
+ * Modifications Copyright (C) 2019 IBM.\r
* ================================================================================\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "$uibModal", "VIDCONFIGURATION", "UtilityService", "vidService", "AaiService", "MsoService", "OwningEntityService", "AsdcService","featureFlags", "$q", "_",\r
function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, $uibModal, VIDCONFIGURATION, UtilityService, vidService, AaiService, MsoService, OwningEntityService, AsdcService, featureFlags, $q, _) {\r
\r
+ $scope.showReportWindow = function() {\r
+ let GuiMessage;\r
+\r
+ if ($scope.errorMsg !== undefined && $scope.errorMsg !== null) {\r
+ GuiMessage = $scope.errorMsg;\r
+ } else {\r
+ GuiMessage = $scope.status;\r
+ }\r
+\r
+ const modalWindow = $uibModal.open({\r
+ templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html',\r
+ controller: 'reportModalController',\r
+ controllerAs: 'vm',\r
+ resolve: {\r
+ errorMsg: function () {\r
+ return GuiMessage;\r
+ }\r
+ }\r
+ });\r
+ };\r
+\r
$scope.showVnfDetails = function (vnf) {\r
console.log("showVnfDetails");\r
DataService.setVnfInstanceId(COMPONENT.VNF_INSTANCE_ID);\r
$scope.init();\r
$scope.fetchSubs(FIELD.PROMPT.FETCHING_SUBS);\r
$scope.fetchServices();\r
-\r
};\r
\r
$scope.cancelCreateSI = function () {\r
\r
window.location.href = COMPONENT.WELCOME_PATH;\r
-\r
};\r
\r
$scope.getServiceTypes = function (globalCustomerId) {\r
console.log("Instantiating ASDC service " + service.uuid);\r
\r
$http.get('rest/models/services/' + service.uuid)\r
- .then(function successCallback(getServiceResponse) {\r
+ .then(function (getServiceResponse) {\r
getServiceResponse.data['service'].serviceTypeName = $scope.serviceTypeName;\r
getServiceResponse.data['service'].createSubscriberName = $scope.createSubscriberName;\r
var serviceModel = getServiceResponse.data;\r
$scope.createType = "a la carte";\r
var broadcastType = "createComponent";\r
\r
+ DataService.setShouldIncludeInAsyncInstantiationFlow(AsdcService.shouldTakeTheAsyncInstantiationFlow(serviceModel));\r
+\r
if (AsdcService.isMacro(serviceModel)) {\r
- DataService.setShouldExcludeMacroFromAsyncInstatiationFlow(AsdcService.shouldExcludeMacroFromAsyncInstatiationFlow(serviceModel));\r
DataService.setALaCarte(false);\r
$scope.createType = "Macro";\r
var convertedAsdcModel = UtilityService.convertModel(serviceModel);\r
"serviceRole": serviceModel.service.serviceRole\r
});\r
}\r
- ;\r
\r
$scope.$broadcast(broadcastType, {\r
componentId: COMPONENT.SERVICE,\r
}\r
});\r
\r
- }, function errorCallback(response) {\r
+ }, function (response) {\r
$log.error("Error: ", response);\r
});\r
};\r
var polls = PropertyService.retrieveMsoMaxPolls();\r
PropertyService.setMsoMaxPolls(polls);\r
\r
- //PropertyService.setMsoBaseUrl("testmso");\r
- PropertyService.setServerResponseTimeoutMsec();\r
-\r
/*\r
* Common parameters that would typically be set when the page is\r
* displayed for a specific service instance id.\r
return deferred.promise;\r
}\r
\r
+ var serviceNetworkVlans = [];\r
+ var vnfNetworksAndVlans = [];\r
\r
$scope.getComponentList = function (event, request) {\r
\r
\r
//$scope.getAsdcModel($location.search().modelUuid);\r
\r
+ //make sure view/edit don't open new deploy service popup\r
+ DataService.setShouldIncludeInAsyncInstantiationFlow(false);\r
+\r
return getModelVersionIdForServiceInstance({\r
globalCustomerId: $location.search().subscriberId,\r
serviceInstanceId: $location.search().serviceInstanceId,\r
.then(resolveModelDataIfMissing)\r
.then($scope.prepareScopeWithModel)\r
.then(function () {\r
-\r
+ return AaiService.getVlansByNetworksMapping($scope.globalCustomerId, $scope.serviceType, $scope.serviceInstanceId, $scope.service.model.service.uuid);\r
+ })\r
+ .then(function (vlanByNetwork) {\r
+ serviceNetworkVlans = vlanByNetwork.serviceNetworks ? vlanByNetwork.serviceNetworks : [];\r
+ vnfNetworksAndVlans = vlanByNetwork.vnfNetworks ? vlanByNetwork.vnfNetworks : [];\r
+ $log.debug('vlanByNetwork', vlanByNetwork);\r
$scope.namedQueryId = VIDCONFIGURATION.COMPONENT_LIST_NAMED_QUERY_ID;\r
$scope.status = FIELD.STATUS.FETCHING_SERVICE_INST_DATA + $scope.serviceInstanceId;\r
\r
+ $scope.hasFabricConfigurations = !UtilityService.isObjectEmpty($scope.service.model.fabricConfigurations);\r
return AaiService.runNamedQuery($scope.namedQueryId, $scope.globalCustomerId, $scope.serviceType, $scope.serviceInstanceId,\r
function (response) { //success\r
$scope.handleInitialResponseInventoryItems(response);\r
$scope.errorMsg = FIELD.ERROR.FETCHING_SERVICE_INSTANCE_DATA + response.status;\r
$scope.errorDetails = response.data;\r
}\r
- )\r
- })\r
+ );\r
+ });\r
};\r
\r
$scope.handleServerError = function (response, status) {\r
alert(response.statusText);\r
- }\r
+ };\r
\r
function handleGetRelatedInstanceGroupsResponseForVnf(response, genericVnf) {\r
_.forEach(response.data, function (instanceGroup) {\r
type: instanceGroup.type\r
};\r
genericVnf.instanceGroups.push(newInstanceGroup);\r
- })\r
+ });\r
}\r
\r
\r
\r
\r
function navigateToViewEditPage() {\r
- window.location.href =\r
- COMPONENT.INSTANTIATE_ROOT_PATH + disData.globalCustomerId +\r
+ window.location.href = AsdcService.shouldTakeTheDrawingBoardViewEdit(vidService.getModel()) ?\r
+ drawingBoardViewEditUrl() : oldViewEditUrl();\r
+ }\r
+\r
+ function oldViewEditUrl() {\r
+ return COMPONENT.INSTANTIATE_ROOT_PATH + disData.globalCustomerId +\r
COMPONENT.SUBSCRIBERNAME_SUB_PATH + disData.subscriberName +\r
COMPONENT.SERVICETYPE_SUB_PATH + disData.serviceType +\r
COMPONENT.SERVICEINSTANCEID_SUB_PATH + disData.serviceInstanceId +\r
COMPONENT.MODELVERSIONID_SUB_PATH + disData.aaiModelVersionId +\r
COMPONENT.IS_PERMITTED_SUB_PATH + disData.isPermitted;\r
}\r
+\r
+ function drawingBoardViewEditUrl() {\r
+ return 'serviceModels.htm#/servicePlanning/EDIT?' +\r
+ 'serviceModelId=' + disData.aaiModelVersionId +\r
+ '&subscriberId=' + disData.globalCustomerId +\r
+ '&serviceType=' + disData.serviceType +\r
+ '&serviceInstanceId=' + disData.serviceInstanceId;\r
+ }\r
};\r
\r
function handleErrorGettingModelVersion(err) {\r
return $http({\r
method: 'GET',\r
url: pathQuery\r
- }).then(function successCallback(response) {\r
+ }).then(function (response) {\r
if (response.headers()['content-type'].includes('json')) {\r
vidService.setModel(response.data);\r
console.log("aaiSubscriber getAsdcModel DONE!!!!");\r
\r
$scope.getTenants = function (globalCustomerId) {\r
$http.get(FIELD.ID.AAI_GET_TENTANTS + globalCustomerId)\r
- .then(function successCallback(response) {\r
+ .then(function (response) {\r
return response.data;\r
//$location.path("/instantiate");\r
- }, function errorCallback(response) {\r
+ }, function (response) {\r
//TODO\r
});\r
}\r
$scope.isConfigurationDataAvailiable = function (configuration) {\r
$log.debug(configuration);\r
return configuration.configData && (!configuration.configData.errorDescription);\r
- }\r
+ };\r
+\r
+ $scope.allowConfigurationActions = function (configuration) {\r
+ $log.debug(configuration);\r
+ return configuration.nodeStatus &&\r
+ _.some(\r
+ [FIELD.STATUS.AAI_ACTIVE, FIELD.STATUS.AAI_INACTIVE, FIELD.STATUS.AAI_CREATED],\r
+ function (s) {\r
+ return s.toLowerCase() === configuration.nodeStatus.toLowerCase();\r
+ });\r
+ };\r
\r
$scope.isActivateDeactivateEnabled = function(btnType) {\r
if ($scope.serviceOrchestrationStatus) {\r
return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_VERIFY_SERVICE);\r
}\r
\r
+ $scope.isShowErrorReport = function() {\r
+ return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_CREATE_ERROR_REPORTS);\r
+ }\r
+\r
$scope.isEnableVerifyService = function () {\r
//Button should only be enabled when the service type is A la carte\r
if (DataService.getALaCarte()) {\r
return false;\r
};\r
\r
+ $scope.isActivateFabricConfiguration = function () {\r
+\r
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS) && $scope.hasFabricConfigurations) {\r
+ if ($scope.serviceOrchestrationStatus) {\r
+ return $scope.serviceOrchestrationStatus.toLowerCase() === 'assigned';\r
+ }\r
+ }\r
+ return false;\r
+ };\r
+\r
$scope.isResumeShown = function (status) {\r
var vfModuleStatus = status.toLowerCase();\r
- var serviceStatus = $scope.serviceOrchestrationStatus && $scope.serviceOrchestrationStatus.toLowerCase();\r
- return _.includes(['pendingactivation', 'assigned'], vfModuleStatus) && !$scope.isActivateDeactivateEnabled("activate");\r
+ var vfModuleStatusHasAllowedResume = ['pendingactivation', 'assigned'];\r
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_VF_MODULE_RESUME_STATUS_CREATE)) {\r
+ vfModuleStatusHasAllowedResume.push('created');\r
+ }\r
+ return _.includes(vfModuleStatusHasAllowedResume, vfModuleStatus) && !$scope.isActivateDeactivateEnabled("activate");\r
};\r
\r
$scope.handleInitialResponseInventoryItems = function (response) {\r
$scope.counter = 100;\r
\r
$scope.subscriberName = "";\r
+\r
+ $scope.allConfigurationsAssigned = true;\r
// just look up the subscriber name in A&AI here...\r
AaiService.getSubscriberName($scope.globalCustomerId, function (response) {\r
$scope.subscriberName = response.subscriberName;\r
DataService.setSubscriberName($scope.subscriberName);\r
$scope.serviceOrchestrationStatus = returnMatchingServiceSubscription(response.serviceSubscriptions[FIELD.ID.SERVICE_SUBSCRIPTION], $scope.serviceInstanceId);\r
-\r
+ if ($scope.serviceOrchestrationStatus.toLowerCase() !== FIELD.STATUS.ASSIGNED.toLowerCase()) {\r
+ $scope.allConfigurationsAssigned = false;\r
+ }\r
angular.forEach($scope.inventoryResponseItemList, function (inventoryResponseItem, key) {\r
\r
$scope.inventoryResponseItem = inventoryResponseItem;\r
"nodeStatus": l3NetworkObject[FIELD.ID.ORCHESTRATION_STATUS],\r
"object": l3NetworkObject,\r
"nodes": [],\r
- "subnets": []\r
+ "subnets": [],\r
+ "vlans": []\r
};\r
if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {\r
//console.log ("subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS]=");\r
}\r
});\r
}\r
+\r
+ \r
+ var networkObj = _.find(serviceNetworkVlans, { 'networkId': l3Network.nodeId});\r
+ if (networkObj !== undefined && networkObj.vlans !== undefined) {\r
+ l3Network["vlans"] = networkObj.vlans;\r
+ }\r
$scope.service.instance[FIELD.ID.NETWORKS].push(l3Network);\r
}\r
\r
"vfModules": [],\r
"volumeGroups": [],\r
"instanceGroups": [],\r
- "availableVolumeGroups": []\r
+ "availableVolumeGroups": [],\r
+ "networks": []\r
};\r
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_VLAN_TAGGING_VIEW_EDIT)) {\r
-\r
- //TODO should be changed after integration\r
- genericVnf["instanceGroups"] = [{"name":"a2"}];\r
\r
+ var vnfNetworkObj = _.find(vnfNetworksAndVlans, { 'vnfId': genericVnf.nodeId});\r
+ if (vnfNetworkObj !== undefined && vnfNetworkObj.networks !== undefined) {\r
+ genericVnf["networks"] = vnfNetworkObj.networks;\r
}\r
+\r
$scope.service.instance[FIELD.ID.VNFS].push(genericVnf);\r
getRelatedInstanceGroupsByVnfId(genericVnf);\r
\r
"ports": [],\r
"configData" : null\r
};\r
+ if( !$scope.hasFabricConfigurations ) {\r
portMirroringConfigurationIds.push(configObject[FIELD.ID.CONFIGURATION_ID]);\r
-\r
- $scope.allowConfigurationActions = [FIELD.STATUS.AAI_ACTIVE, FIELD.STATUS.AAI_INACTIVE, FIELD.STATUS.AAI_CREATED].indexOf(config.nodeStatus) != -1;\r
-\r
- $scope.service.instance[FIELD.ID.CONFIGURATIONS].push(config);\r
+ $scope.service.instance[FIELD.ID.CONFIGURATIONS].push(config);\r
+ } else {\r
+ if (config.nodeStatus.toLowerCase() !== FIELD.STATUS.ASSIGNED.toLowerCase()) {\r
+ $scope.allConfigurationsAssigned = false;\r
+ if ($scope.isActivateFabricConfiguration()) {\r
+ $scope.errorMsg = "Activate fabric configuration button is not available as some of the configuration objects are not in Assigned status. Check MSO logs for the reasons for this abnormal case.";\r
+ }\r
+ }\r
+ }\r
}\r
\r
});\r
\r
AaiService.getPortMirroringData(portMirroringConfigurationIds).then(function(result){\r
angular.forEach($scope.service.instance[FIELD.ID.CONFIGURATIONS], function(config){\r
- config['configData'] = result.data[config['nodeId']]\r
+ config['configData'] = result.data[config['nodeId']];\r
\r
if (config.configData && config.configData.errorDescription) {\r
$scope.errorMsg = ($scope.errorMsg ? $scope.errorMsg + "\n" : "") +\r
}\r
});\r
\r
- });\r
-\r
-\r
+ var aaiNetworkIds = _.map(serviceNetworkVlans, 'networkId');\r
+ var serviceInstanceNetworkIds = _.map($scope.service.instance[FIELD.ID.NETWORKS], 'nodeId');\r
+ var isContains = aaiNetworkIds.every(function(val) { return serviceInstanceNetworkIds.indexOf(val) >= 0; });\r
+ if (aaiNetworkIds.length && !isContains) {\r
+ $log.error("vlansByNetworks contain network that not found in service instance", aaiNetworkIds, serviceInstanceNetworkIds);\r
+ }\r
\r
- }\r
+ });\r
+ };\r
\r
\r
\r
}\r
};\r
\r
+\r
+ var activateFabricConfigurationInstance = function (msoType) {\r
+ var requestParams = {\r
+ model: $scope.service.model,\r
+ service: $scope.service,\r
+ serviceInstanceId: $scope.serviceInstanceId\r
+ };\r
+\r
+ if (DataService.getLoggedInUserId()) {\r
+ requestParams.userId = DataService.getLoggedInUserId();\r
+ openMsoModal(COMPONENT.MSO_ACTIVATE_FABRIC_CONFIGURATION_REQ, requestParams);\r
+ } else {\r
+ AaiService.getLoggedInUserID(function (response) {\r
+ var userID = response.data;\r
+ DataService.setLoggedInUserId(userID);\r
+ requestParams.userId = userID;\r
+ openMsoModal(COMPONENT.MSO_ACTIVATE_FABRIC_CONFIGURATION_REQ, requestParams);\r
+ });\r
+ }\r
+ };\r
+\r
$scope.showAssignmentsSDNC = function () {\r
\r
if ($scope.service && $scope.service.instance) {\r
return null;\r
};\r
\r
+ $scope.activateFabricConfigurationMSO = function () {\r
+ activateFabricConfigurationInstance(COMPONENT.MSO_ACTIVATE_FABRIC_CONFIGURATION_REQ);\r
+ };\r
+\r
$scope.activateMSOInstance = function () {\r
\r
activateDeactivateServiceInstance(COMPONENT.MSO_ACTIVATE_SERVICE_REQ);\r
$scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_EXPANDALL);\r
};\r
\r
-\r
}]);\r
\r
\r