User Guide
User Guide
1 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Table of Contents
1 PURPOSE OF THIS DOCUMENT ......................................................................................................................................... 3
2 SYSTEM REQUIREMENTS.................................................................................................................................................. 3
3 STEPS TO DOWNLOAD THE SCRIPT................................................................................................................................... 3
4 INSTRUCTIONS FOR RUNNING PYTHON CLI FILE UPLOAD ................................................................................................ 3
4.1 SHORT AND LONG VERSION COMMAND LINE ARGUMENTS ........................................................................................... 4
4.2 SCRIPT EXECUTION FROM WINDOWS ............................................................................................................................. 5
4.3 SCRIPT EXECUTION FROM LINUX ..................................................................................................................................... 6
5 STEPS TO CHANGE THE CONFIGURATIONS ....................................................................................................................... 6
6 STEPS TO GENERATE THE AUTHENTICATION TOKEN ........................................................................................................ 7
7 UPLOAD A FILE USING WINDOWS EXECUTABLE ............................................................................................................... 8
8 ERROR MESSAGES .......................................................................................................................................................... 10
9 TROUBLESHOOTING STEPS ............................................................................................................................................ 13
10 API CALLS & EXECUTION FLOW .................................................................................................................................. 15
10.1 API CALLS ....................................................................................................................................................................... 15
10.2 API EXECUTION FLOW .................................................................................................................................................... 26
11 API HELP..................................................................................................................................................................... 27
12 SWAGGER DOCUMENT .............................................................................................................................................. 28
2 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
1 PURPOSE OF THIS DOCUMENT
This document covers the steps that are required to run NAFU CLI file upload python script and the steps
required to generate the authentication token (that is required to run the script).
2 SYSTEM REQUIREMENTS
Current version of CLI script supports Linux, Mac, and Windows. Please make sure python and pip3 are
installed and available in the system path.
NAFU CLI script has been verified for the following OS versions:
3 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
➢ Run ‘python’ executable followed by the script name and input parameters
Where:
casenumber – An Active Technical Case Number.
upload – Full path to input file
bugcheck – To check for known bugs (applicable to core files)
token – Authentication Token (generated from NAFU Web Application)
log – File path to save logs generated during script execution
region – Nearest server name where you want to upload the file
debug – Logging level for log file
override – PMBTA password to proceed with upload after a bug is identified
noresume – To resume from a previous upload
batchsize – Batch size to upload files
api – API help
4 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
For example --token is a mandatory argument, whereas --casenumber is an optional argument. For optional
arguments, upload will take default values as provided in the above table.
Below are the regions that are currently supported by the tool:
"North America (West)"
"North America (East)"
"Canada"
"Europe"
"Mumbai"
“Singapore”
“Bahrain”
“Hong Kong”
“Japan”
“Australia”
“São Paulo”
cd c:\netapp_auth_file_upload_cli_2.2\netapp_auth_file_upload_cli_2.2_python
5 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
4.3 SCRIPT EXECUTION FROM LINUX
cd /home/netapp_auth_file_upload_cli_2.2/netapp_auth_file_upload_cli_2.2_python
$ python nafu_auth_file_upload.py -t
"eyJhbGciOiJSUzI1NiIsInR5cCI6IXkpXVCJ9.eyJ1XXXXXXXXXXXXXXXXXXXXXXXTYwMjQ4NzkwNCwiZXhwIjoxNjEwMjYzOTA0fQ.Ifj
KNvsA65MdXTthspM4DN8zT0w" -c 2007XXXXXX -u "/home/200757xxxx.core.xxxx19xxxx.2020-11-02.16_53_Retry.nz" -d
debug -s 8 -p True -b "N"
To run with proxy, the user should assign appropriate values to the below property parameters.
PROXY_SERVER_URL = <SERVERIP>
PROXY_SERVER_PORT =<PORT>
PROXY_USER = <USERNAME>
6 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
PROXY_PASSWORD = <PASSWROD>
7 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
7 UPLOAD A FILE USING WINDOWS EXECUTABLE
User can also use windows executable to upload the files from Windows machines.
If script is downloaded and extracted to c:\ netapp_auth_file_upload_cli_2.2, then it will have below file structure:
8 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Change directory to “netapp_auth_file_upload_cli_2.2_Win64” under extracted directory
(e.g., cd c:\netapp_auth_file_upload_cli_2.2\netapp_auth_file_upload_cli_2.2_Win64).
netapp_upload_cli_input.txt needs to be updated with all the required parameters as shown in the below
screenshot.
Click on netapp_authe_file_upload_cli_2.2_Win64.exe and execute it.
Where:
casenumber – An Active Technical Case Number.
upload – Full path to input file
bugcheck – To check for known bugs (applicable to core files)
token – Authentication Token (generated from NAFU Web Application)
log – File path to save logs generated during script execution
region – Nearest server name where you want to upload the file
debug – Logging level for log file
override – PMBTA password to proceed with upload after a bug is identified
noresume – To resume from a previous upload
batchsize – Batch size to upload files
apihelp – API help
9 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
8 ERROR MESSAGES
Below are the CLI error messages and the description.
10 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
(In case of windows executable, update
netapp_upload_cli_input.txt file)
Network proxy port is required. You can update
p_config.py file under conf directory.
(In case of windows executable, update
Proxy port is missing! netapp_upload_cli_input.txt file)
Network proxy URL/host/IP is required. You can
update p_config.py file under conf directory.
(In case of windows executable, update
Proxy url is missing! netapp_upload_cli_input.txt file)
Unable to delete the chunk file! Unable to delete the temporary chunk file.
EIU010 Error occurred while validating access token. If we get any error while validating access
token.
EIU011 Invalid case number! Please enter a valid 10 If case number is invalid.
digit case number.
EIU012 Invalid PMBTA override password. If invalid PMBTA override password is
provided.
EIU013 Internal server error while executing PMBTA If any error while executing PMBTA
command. command.
EGP001 Upload ID is missing. If upload id is not specified.
EGP002 File type is missing. If file type is not specified.
EGP003 Mask file name is missing. If mask file name is not specified.
EGP004 Batch size is missing. If batch size is not specified.
EGP005 Part size is missing. If part size is not specified.
EGP006 Part numbers are missing. If part numbers are not specified.
EGP007 Part numbers are empty. If part numbers are empty.
EGP008 File name is missing. If file name is not specified.
EGP009 Invalid part numbers. If invalid part numbers specified.
11 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
EGP010 Invalid upload ID is found. If upload id is invalid.
EGP011 Access token is missing. If token is not specified.
EGP013 Access token is expired. If Access token is expired.
EGP014 Error occurred while validating access token. If any error while validating access token.
ECU011 Error occurred while validating access token. If we get any error while validating token.
EFS001 Upload ID is missing. If upload id is not specified.
EFS002 Upload status operation is missing. If upload status operation is not specified.
EFS003 No file found for the given uploadId. If upload id is invalid.
EFS004 Parts completed number is missing. If parts completed is not specified.
EFS005 UploadId is not found. Failed to update upload Invalid upload id is identified while
progress status. updating status.
EFS006 Invalid request payload. If invalid request payload.
EFS008 Access token is expired. If access token is expired.
EFS009 Error occurred while validating access token. If we get any error while validating token.
EFS010 Total parts number is missing. If total parts number are not specified.
EFS011 Access token is missing. If token is not specified.
EGS001 Access token is missing. If token is not specified.
EGS003 Access token is expired. If access token is expired.
EGS004 Error occurred while validating access token. If we get any error while validating access
token.
EGT001 Missing user token, please provide one. If user token is not specified.
EGT002 Error while fetching token. If database connection error.
EGT003 Error while saving token. If database connection error.
EGT004 Error while generating token. If any error occurs while generating token.
EGT005 Token is not matching the user id, please The token provided does not match the
generate a new token and re-upload. user profile.
EGT006 Token is not matching any of the active user The token provided is not associated with
id, please generate a new token and re- any active user profile.
upload.
12 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
ERT001 Error while updating new token. If any error occurs while updating new
token to database.
ERT002 Refresh token update failed. The user token The user token and the expired access
and the expired access token are mis-matched token are mis-matched for the provided
for the given user id. Please check both the user profile.
tokens and retry the command to generate a
new access token.
ERT003 Either user token or expired access token is Either the user token or the expired access
missing, please provide both. token is missing.
ERT004 Error while generating token. If any error while generating token.
ERT005 Token is not matching any of the active user If provided token is invalid.
id, please generate a new token and re-
upload.
9 TROUBLESHOOTING STEPS
Note: For questions associated with NetApp Authenticated File Upload CLI Script, contact ng-nafu-cli-
[email protected]. Support for SDK is limited to API reference implementation. Questions will be addressed on
a ‘Best Effort’ basis.
i) If “MemoryError()” is encountered as shown in below screenshot, ensure you have enough memory space
on your system before running again
ii) Valid arguments list can be found by using -h (or) --help option while running the python script
nafu_auth_file_upload.py (use correct script file). Otherwise, below given error occurs.
iii) Below error will be shown when invalid arguments are provided. To provide valid arguments for script,
please refer README.txt (or) UserGuide.docx.
13 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
iv) If the below error is encountered, try running the same script after 5 minutes.
“Unable to get a (API name) response from a server, retry after 5 minutes!”
v) To troubleshoot script execution with more details, please use -d (or) --debug parameter.
14 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
10 API CALLS & EXECUTION FLOW
10.1 API CALLS
Below are the different API calls invoked sequentially during the file upload process. .
i) getNearestServer
Description: Get the nearest server location for the file upload.
Request URL: https://upload.netapp.com/sg/api/public/getNearestServer
Request Method: POST
Content type: application/json
Request attributes:
token (Mandatory) Type: String
Response attributes:
data Type: Array
optionsLabel Type: String
optionsValue Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
}
15 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Sample Failure Responses:
1) If token is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Access token is missing.",
"data": null,
"errorCode": "EGS001",
"errorMessage": "Access token is missing."
ii) initiateUpload
Request attributes:
file (Mandatory) Type: multipart
casenumber (Optional) Type: String
token (Mandatory) Type: String
fileName (Mandatory) Type: String
site (Mandatory) Type: String
fileSize (Mandatory) Type: Number
noResume (Optional) Type: String
bugFlag (Optional) Type: String
overridePassword (Optional) Type: String
batchSize (Optional) Type: Number
Response attributes:
uploadId Type: String
maskedFileName Type: String
type Type: String
isOrphan Type: String
partSize Type: Number
batchSize Type: Number
totalParts Type: Number
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"caseNumber": "2018092782",
"site": "AMER",
"fileName": "test_file_upload.txt",
"fileSize":84857600,
"batchSize":1,
"file": need small part of file attachment here as multipart
}
16 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Sample Success Response:
{
"data": {
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"maskedFileName":"2018092782_23C5691Add0a41FE9839BA5a78eed3.txt",
"type":"NonCore",
"isOrphan":"N",
"partSize":84857600,
"batchSize":1,
"totalParts":1
},
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}
‘Parts’ key in the below response is a combination of a part number and E-tag value respectively, separated by a
semicolon.
17 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"statusCode":400,
"error": "Bad Request",
"message": "Access token is missing.",
"data":null,
"errorCode":"EIU002",
"errorMessage":"Access token is missing."
}
2) If file name is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "File name is missing.",
"data": null,
"errorCode": "EIU003",
"errorMessage": "File name is missing."
}
iii) getPresignedUrls
Description: Get Pre-Signed URL list for the multipart file upload.
Request URL: https://upload.netapp.com/sg/api/public/getPresignUrls
Request Method: POST
Content type: application/json
Request attributes:
token: (Mandatory) Type: String
uploadId: (Mandatory) Type: String
maskFileName (Mandatory) Type: String
fileName (Mandatory) Type: String
fileType (Mandatory) Type: String
site (Mandatory) Type: String
partNums (Mandatory) Type: String
partSize (Mandatory) Type: String
batchSize (Mandatory) Type: String
Response attributes:
data Type: Array
partNum Type: Number
presignedUrl Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"maskFileName":"2018092782_23C5691Add0a41FE9839BA5a78eed3.txt",
"fileName":"test_file_upload.txt",
"fileType":"NonCore",
18 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"site":"AMER",
"partNums":[
1
],
"partSize":84857600,
"batchSize":1
}
}
2) If upload id is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "EGP001",
"errorMessage": "Upload ID is missing."
}
3) If upload id is invalid:
{
"statusCode": 400,
"error": "Bad Request",
"message": " Invalid upload ID is found.",
"data": null,
"errorCode": "EGP010",
"errorMessage": " Invalid upload ID is found."
19 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
}
iv) uploadStatus
Description: Get the file upload status for a given uploadId or update the multipart file progress in the database.
Request URL: https://upload.netapp.com/sg/api/public/uploadStatus
Request Method: POST
Content type: application/json
Response attributes:
data Type: Object
uploadedPercentage Type: Number
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"operation":"fetch"
}
Sample Success Response:
{
"data": {
"uploadedPercentage": 0
},
"statusCode": 200,
"message": "success",
"errorCode": null,
"errorMessage": null
}
20 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"error": "Bad Request",
"message": "Invalid request payload.",
"data": null,
"errorCode": "EFS006",
"errorMessage": "Invalid request payload."
}
3) If upload id is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "EFS001",
"errorMessage": "Upload ID is missing."
}
Response attributes:
data Type: Object
partsCompleted Type: Number
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"totalParts":1,
"partsCompleted":1,
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"operation":"update"
}
21 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
{
"statusCode": 400,
"error": "Bad Request",
"message": "Upload ID is missing.",
"data": null,
"errorCode": "EFS001",
"errorMessage": "Upload ID is missing."
}
{
"statusCode": 400,
"error": "Bad Request",
"message": "Total parts number is missing.",
"data": null,
"errorCode": "EFS010",
"errorMessage": "Total parts number is missing."
}
3) If ‘partsCompleted’ parameter is not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Parts completed number is missing.",
"data": null,
"errorCode": "EFS004",
"errorMessage": "Parts completed number is missing."
}
v) completeUpload
Request attributes:
token (Mandatory) Type: String
uploadId (Mandatory) Type: String
maskFileName (Mandatory) Type: String
fileName (Mandatory) Type: String
fileType (Mandatory) Type: String
site (Mandatory) Type: String
eTagList (Mandatory) Type: Array
Response attributes:
data Type: Object
statusMessage Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
22 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"uploadId":"ICq0juSM59DSKPk5rNuLg3uYGOZEKs-9HwFrG6rsl5Yehe--24Qu5X22qw",
"maskFileName":"2018092782_23C5691Add0a41FE9839BA5a78eed3.txt",
"fileName":"test_file_upload.txt",
"fileType":"NonCore",
"site":"AMER",
"eTagList":[
"00257af974e00d5b394a8394550a1c3d"
]
}
23 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
vi) generateToken
Description: This API is used to generate access token for a given user token. This access token is used across all
the APIs to perform NAFU file upload functionalities.
Request URL: https://upload.netapp.com/api/public/generateToken.
Request Method: POST
Content type: application/json
Request attributes:
token (Mandatory) Type: String
Response attributes:
data Type: Object
accessToken Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
}
24 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
"errorMessage": "Missing user token, please provide one."
}
vii) refreshToken
Description: Generates new access token, if the current access token is expired for a given user token.
Request URL: https://upload.netapp.com/api/public/refreshToken.
Request Method: POST
Content type: application/json
Request attributes:
utoken (Mandatory) Type: String
rtoken (Mandatory) Type: String
Response attributes:
data Type: Object
accessToken Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
{
"utoken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
"rtoken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9"
}
1) If any of the required tokens (user token and expired access token (rtoken)) not provided:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Either user token or expired access token is missing, please provide both. ",
"data": null,
"errorCode": "ERT003",
"errorMessage": "Either the user token or the expired access token is missing. Please provide both the
tokens and re-run the command to generate a new access token."
}
25 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
10.2 API EXECUTION FLOW
26 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
11 API HELP
The below are the two different ways to get details about the NetApp Authenticated File Upload public APIs.
Providing a valid Service/API name will list out all required arguments, argument types, sample request and
sample response for the requested/given API.
getNearestServer
initiateUpload
getPresignedUrls
uploadStatus
completeUpload
generateToken
refreshToken
help (only for windows executable)
e.g.,
./nafu_auth_file_upload.py -a getNearestServer
(or)
./nafu_auth_file_upload.py -apihelp getNearestServer
Sample Request:
https://upload.netapp.com/sg/api/public/help?serviceName= getnearestserver
Sample Response:
Description: Get the nearest server location for file upload.
Request URL: https://upload.netapp.com/sg/api/public/getNearestServer
Request Method: POST
27 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
Content type: application/json
-------------------
Request attributes:
-------------------
token: (Mandatory) Type: String
Response attributes:
--------------------
data Type: Array
optionsLabel Type: String
optionsValue Type: String
statusCode Type: Number
message Type: String
errorCode Type: Number
errorMessage Type: String
Sample Request:
---------------
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
}
Sample Response:
----------------
{
"data":[
{
"optionsLabel":"North America (East)",
"optionsValue":"AMER"
},
{
"optionsLabel":"Europe",
"optionsValue":"EMEA"
}
],
"statusCode":200,
"message":"success",
"errorCode":null,
"errorMessage":null
}
12 Swagger Document
• Swagger file path: netapp_auth_file_upload_cli_2.2_python/NAFU_PUBLIC_APIs_SWAGGER_DOC.txt
• Go to Swagger file path and open the file with name as “NAFU_PUBLIC_APIs_SWAGGER_DOC.txt” in
Notepad and copy the entire text.
28 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
• Open this swagger editor using this URL https://editor.swagger.io/ in any browser. Please refer below given
screen shot.
• Select all the text on the left side and remove/delete it. The screen looks like the below provided screenshot after
deletion.
• Copy all the text from NAFU_PUBLIC_APIs_SWAGGER_DOC.txt and paste in the left side of swagger editor as shown
in the below screen shot.
29 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
• All the APIs will be seen with the specifications on the right side of the editor.
• Click on the individual API or use the expand button from the right-side panel to view the details. Below is the
screenshot shown for the reference:
30 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.
NOTE: “Try it out” functionality is currently not supported.
31 NAFU Command Line Interface – User Guide © 2021 NetApp, Inc. All Rights Reserved.