Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trace-indicator in SoftwareUpgrade #324

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions server/service/individualServices/SoftwareUpgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const eventDispatcher = require('onf-core-model-ap/applicationPattern/rest/clien

const NOTIFY_APPROVALS_FD_NAME = 'PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOfNewApplicationsToNewRelease';
const NOTIFY_WITHDRAWN_APPROVALS_FD_NAME = 'PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease';
var traceIndicatorIncrementer = 1;

/**
* This method performs the set of procedure to transfer the data from this version to next version
Expand All @@ -33,14 +32,15 @@ var traceIndicatorIncrementer = 1;
exports.upgradeSoftwareVersion = async function (isdataTransferRequired, newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, _traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let traceIndicatorIncrementer = 1;
if (_traceIndicatorIncrementer !== 0) {
traceIndicatorIncrementer = _traceIndicatorIncrementer;
}
if (isdataTransferRequired) {
await PromptForBequeathingDataCausesTransferOfListOfApplications(user, xCorrelator, traceIndicator, customerJourney);
traceIndicatorIncrementer = await PromptForBequeathingDataCausesTransferOfListOfApplications(user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
}
await redirectNotificationNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney);
await replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney);
traceIndicatorIncrementer = await redirectNotificationNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
await replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
resolve();
} catch (error) {
reject(error);
Expand All @@ -60,13 +60,13 @@ exports.upgradeSoftwareVersion = async function (isdataTransferRequired, newRele
* 2. PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease
* 3. PromptForBequeathingDataCausesRObeingRequestedToStopNotificationsToOldRelease
*/
async function redirectNotificationNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney) {
async function redirectNotificationNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
await PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOfNewApplicationsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney);
await PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney);
await PromptForBequeathingDataCausesRObeingRequestedToStopNotificationsToOldRelease(user, xCorrelator, traceIndicator, customerJourney);
resolve();
traceIndicatorIncrementer = await PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOfNewApplicationsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
traceIndicatorIncrementer = await PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
traceIndicatorIncrementer = await PromptForBequeathingDataCausesRObeingRequestedToStopNotificationsToOldRelease(user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
resolve(traceIndicatorIncrementer);
} catch (error) {
reject(error);
}
Expand All @@ -83,11 +83,11 @@ async function redirectNotificationNewRelease(newReleaseUuid, user, xCorrelator,
* 1. PromptForBequeathingDataCausesRequestForBroadcastingInfoAboutServerReplacement
* 2. PromptForBequeathingDataCausesRequestForDeregisteringOfOldRelease
*/
async function replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney) {
async function replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
await promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServerReplacement(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney);
await promptForBequeathingDataCausesRequestForDeregisteringOfOldRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney);
traceIndicatorIncrementer = await promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServerReplacement(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
await promptForBequeathingDataCausesRequestForDeregisteringOfOldRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer);
resolve();
} catch (error) {
reject(error);
Expand All @@ -103,7 +103,7 @@ async function replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator
* @param {String} customerJourney Holds information supporting customer’s journey to which the execution applies
* @returns {Promise<boolean>} return true if the operation is success or else return false
*/
async function PromptForBequeathingDataCausesTransferOfListOfApplications(user, xCorrelator, traceIndicator, customerJourney) {
async function PromptForBequeathingDataCausesTransferOfListOfApplications(user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let result = true;
Expand Down Expand Up @@ -140,7 +140,8 @@ async function PromptForBequeathingDataCausesTransferOfListOfApplications(user,
throw "operation is not success";
}
}
resolve(result);

resolve(traceIndicatorIncrementer);
} catch (error) {
reject(error);
}
Expand All @@ -155,7 +156,7 @@ async function PromptForBequeathingDataCausesTransferOfListOfApplications(user,
* @param {String} customerJourney Holds information supporting customer’s journey to which the execution applies
* @returns {Promise<boolean>} return true if the operation is success or else return false
*/
async function PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOfNewApplicationsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney) {
async function PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOfNewApplicationsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let result = true;
Expand Down Expand Up @@ -186,7 +187,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOf
throw "operation is not success";
}

resolve(result);
resolve(traceIndicatorIncrementer);
} catch (error) {
reject(error);
}
Expand All @@ -201,7 +202,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOf
* @param {String} customerJourney Holds information supporting customer’s journey to which the execution applies
* @returns {Promise<boolean>} return true if the operation is success or else return false
*/
async function PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney) {
async function PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let result = true;
Expand Down Expand Up @@ -231,7 +232,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnAp
throw "operation is not success";
}

resolve(result);
resolve(traceIndicatorIncrementer);
} catch (error) {
reject(error);
}
Expand All @@ -246,7 +247,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnAp
* @param {String} customerJourney Holds information supporting customer’s journey to which the execution applies
* @returns {Promise<boolean>} return true if the operation is success or else return false
*/
async function PromptForBequeathingDataCausesRObeingRequestedToStopNotificationsToOldRelease(user, xCorrelator, traceIndicator, customerJourney) {
async function PromptForBequeathingDataCausesRObeingRequestedToStopNotificationsToOldRelease(user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let result = true;
Expand Down Expand Up @@ -280,7 +281,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToStopNotifications
throw "operation is not success";
}

resolve(result);
resolve(traceIndicatorIncrementer);
} catch (error) {
reject(error);
}
Expand All @@ -295,7 +296,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToStopNotifications
* @param {String} customerJourney Holds information supporting customer’s journey to which the execution applies
* @returns {Promise<boolean>} return true if the operation is success or else return false
*/
async function promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServerReplacement(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney) {
async function promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServerReplacement(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let result = true;
Expand Down Expand Up @@ -328,7 +329,7 @@ async function promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServ
throw "operation is not success";
}

resolve(result);
resolve(traceIndicatorIncrementer);
} catch (error) {
reject(error);
}
Expand All @@ -343,7 +344,7 @@ async function promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServ
* @param {String} customerJourney Holds information supporting customer’s journey to which the execution applies
* @returns {Promise<boolean>} return true if the operation is success or else return false
*/
async function promptForBequeathingDataCausesRequestForDeregisteringOfOldRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney) {
async function promptForBequeathingDataCausesRequestForDeregisteringOfOldRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney, traceIndicatorIncrementer) {
return new Promise(async function (resolve, reject) {
try {
let result = true;
Expand Down
Loading