Skip to content

Resolved Support Version 2.0.0 changes for /v1/bequeath-your-data-and-die#173

Merged
DanaSunal merged 4 commits intodevelopfrom
ManasaBM1/issue98
Feb 10, 2023
Merged

Resolved Support Version 2.0.0 changes for /v1/bequeath-your-data-and-die#173
DanaSunal merged 4 commits intodevelopfrom
ManasaBM1/issue98

Conversation

@ManasaBM1
Copy link
Copy Markdown
Collaborator

Fixes #98
Fixes #94
Fixes #95
Fixes #96
Fixes #97
Fixes #156

@ManasaBM1
Copy link
Copy Markdown
Collaborator Author

Reviewer is @DanaSunal

let requestBody = {};
requestBody.applicationName = oldApplicationName;
requestBody.applicationReleaseNumber = oldReleaseNumber;
requestBody.ReleaseNumber = oldReleaseNumber;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lowercase

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}


var resolveHttpClient = exports.resolveHttpClientLtpUuidFromForwardingName = function (forwardingName) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to assign the function to a variable.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to access this function in the softwareUpgrade.js file ( to get newReleaseHttpClientLtpUuid and operationclientUuid) I assign the function to a variable.

var resolveHttpClient = exports.resolveHttpClientLtpUuidFromForwardingName = function (forwardingName) {
return new Promise(async function (resolve, reject) {
try{
let ForwardConstructName = await ForwardingDomain.getForwardingConstructForTheForwardingNameAsync(forwardingName)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names should start lowercase.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

try{
let ForwardConstructName = await ForwardingDomain.getForwardingConstructForTheForwardingNameAsync(forwardingName)
if (ForwardConstructName === undefined) {
return null;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is supposed to return a list, so return an empty list instead of null.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (ForwardConstructName === undefined) {
return null;
}
let LogicalTerminationPointlist;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not name a variable 'list' if it's not one. Makes the code very hard to read.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok done

console.log(error)
}
})
} No newline at end of file
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format the function properly, with aligned brackets and proper whitespaces.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

let currentNewReleaseRemotePort = await tcpClientInterface.getRemotePortAsync(tcpclientUuid);
let update = {};
let logicalTerminationPointConfigurationStatus = {};
if (newReleaseHttpClientLtpUuid != undefined) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reversing the condition makes the code more readable.

}

let newReleaseTcpClientUuidList = await logicalTerminationPoint.getServerLtpListAsync(newReleaseHttpClientLtpUuid);
let newReleaseTcpClientUuid = newReleaseTcpClientUuidList[0];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already have this value: tcpclientUuid.

if(protocol != currentNewReleaseRemoteProtocol){
update.isProtocolUpdated = await tcpClientInterface.setRemoteProtocolAsync(newReleaseTcpClientUuid, applicationProtocol);
}
if(address != currentNewReleaseRemoteAddress) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot compare objects like this. It will result in true even if the values of ipv4 adresses or domain-names stay the same.

const eventDispatcher = require('onf-core-model-ap/applicationPattern/rest/client/eventDispatcher');
const ProfileCollection = require('onf-core-model-ap/applicationPattern/onfModel/models/ProfileCollection');
const OamRecordProfile = require('onf-core-model-ap/applicationPattern/onfModel/models/profile/OamRecordProfile');
const FcportValue = 'PromptForBequeathingDataCausesTransferOfListOfApplications';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are defining this constant twice. Define it just once.

try {

const FcportValue = 'PromptForBequeathingDataCausesTransferOfListOfApplications';
const fcportValue = 'PromptForBequeathingDataCausesTransferOfListOfApplications';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make this a constant in SoftwareUpgrade file, you can use it here and you don't have to send it over as parameter.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the fcportvalue done


let forwardConstructName = await ForwardingDomain.getForwardingConstructForTheForwardingNameAsync(forwardingName)
if (forwardConstructName === undefined) {
return [];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make a decision, if you are returning an object, or a list.

let operationClientUuid = listofUuid[i][onfAttributes.CONTROL_CONSTRUCT.LOGICAL_TERMINATION_POINT]
let httpClientUuid = (await logicalTerminationPoint.getServerLtpListAsync(operationClientUuid))[0];
let tcpClientUuid = (await logicalTerminationPoint.getServerLtpListAsync(httpClientUuid))[0];
uuidList = { httpClientUuid, tcpClientUuid,operationClientUuid }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since object is used here, the for cycle doesn't make sense, because if there would be two output ports, you'd override the first value with the second.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (protocol != currentNewReleaseRemoteProtocol) {
update.isProtocolUpdated = await tcpClientInterface.setRemoteProtocolAsync(newReleaseTcpClientUuid, protocol);
}
if (address["ip-address"]["ipv-4-address"] !== currentNewReleaseRemoteAddress["ip-address"]["ipv-4-address"]) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain-name can be present and has to be checked

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@DanaSunal DanaSunal merged commit 2a61c20 into develop Feb 10, 2023
@ManasaBM1 ManasaBM1 deleted the ManasaBM1/issue98 branch August 10, 2023 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants