Resolved Support Version 2.0.0 changes for /v1/bequeath-your-data-and-die#173
Resolved Support Version 2.0.0 changes for /v1/bequeath-your-data-and-die#173
Conversation
|
Reviewer is @DanaSunal |
| let requestBody = {}; | ||
| requestBody.applicationName = oldApplicationName; | ||
| requestBody.applicationReleaseNumber = oldReleaseNumber; | ||
| requestBody.ReleaseNumber = oldReleaseNumber; |
| } | ||
|
|
||
|
|
||
| var resolveHttpClient = exports.resolveHttpClientLtpUuidFromForwardingName = function (forwardingName) { |
There was a problem hiding this comment.
You don't need to assign the function to a variable.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Variable names should start lowercase.
| try{ | ||
| let ForwardConstructName = await ForwardingDomain.getForwardingConstructForTheForwardingNameAsync(forwardingName) | ||
| if (ForwardConstructName === undefined) { | ||
| return null; |
There was a problem hiding this comment.
This function is supposed to return a list, so return an empty list instead of null.
| if (ForwardConstructName === undefined) { | ||
| return null; | ||
| } | ||
| let LogicalTerminationPointlist; |
There was a problem hiding this comment.
Do not name a variable 'list' if it's not one. Makes the code very hard to read.
| console.log(error) | ||
| } | ||
| }) | ||
| } No newline at end of file |
There was a problem hiding this comment.
Please format the function properly, with aligned brackets and proper whitespaces.
| let currentNewReleaseRemotePort = await tcpClientInterface.getRemotePortAsync(tcpclientUuid); | ||
| let update = {}; | ||
| let logicalTerminationPointConfigurationStatus = {}; | ||
| if (newReleaseHttpClientLtpUuid != undefined) { |
There was a problem hiding this comment.
Reversing the condition makes the code more readable.
| } | ||
|
|
||
| let newReleaseTcpClientUuidList = await logicalTerminationPoint.getServerLtpListAsync(newReleaseHttpClientLtpUuid); | ||
| let newReleaseTcpClientUuid = newReleaseTcpClientUuidList[0]; |
There was a problem hiding this comment.
You already have this value: tcpclientUuid.
| if(protocol != currentNewReleaseRemoteProtocol){ | ||
| update.isProtocolUpdated = await tcpClientInterface.setRemoteProtocolAsync(newReleaseTcpClientUuid, applicationProtocol); | ||
| } | ||
| if(address != currentNewReleaseRemoteAddress) { |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
You are defining this constant twice. Define it just once.
| try { | ||
|
|
||
| const FcportValue = 'PromptForBequeathingDataCausesTransferOfListOfApplications'; | ||
| const fcportValue = 'PromptForBequeathingDataCausesTransferOfListOfApplications'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
removed the fcportvalue done
|
|
||
| let forwardConstructName = await ForwardingDomain.getForwardingConstructForTheForwardingNameAsync(forwardingName) | ||
| if (forwardConstructName === undefined) { | ||
| return []; |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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.
| if (protocol != currentNewReleaseRemoteProtocol) { | ||
| update.isProtocolUpdated = await tcpClientInterface.setRemoteProtocolAsync(newReleaseTcpClientUuid, protocol); | ||
| } | ||
| if (address["ip-address"]["ipv-4-address"] !== currentNewReleaseRemoteAddress["ip-address"]["ipv-4-address"]) { |
There was a problem hiding this comment.
domain-name can be present and has to be checked
Fixes #98
Fixes #94
Fixes #95
Fixes #96
Fixes #97
Fixes #156