aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests/vnfsdk-marketplace/provision/sanity_test_vnfsdktestfunction.robot
blob: c57642a2e34bcd8f09aba247d6dec0bfaeebbb9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
*** settings ***
Library           OperatingSystem
Library           Process
Library           String
Library           Collections
Library           RequestsLibrary
Library           json


*** Variables ***
${csarpath}   ${SCRIPTS}/../tests/vnfsdk-marketplace/provision/enterprise2DC.csar
${csarId}  0

*** Test Cases ***

Upload VNF Package to VNF Repository
    [Documentation]    Upload the VNF Package
    ${resp}=   Run    curl -s -X POST -H "Content-Type: multipart/form-data" -F "file=@${csarpath}" http://${REPO_IP}:8702/openoapi/vnfsdk-marketplace/v1/PackageResource/csars
    Should Contain    ${resp}    csarId
    ${csarjson}=    Evaluate    ${resp}
    ${csarId}=    Set Variable    ${csarjson["csarId"]}
    Set Global Variable    ${csarId}

Get VNF Package Information from Repository
    Create Session   refrepo  http://${REPO_IP}:8702
    &{headers}=  Create Dictionary      Content-Type=application/json
    ${resp}=    Get Request    refrepo   /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}   headers=${headers}
    ${response_json}    json.loads    ${resp.content}
    ${downloadUri}=    Convert To String      ${response_json['downloadUri']}
    Should Contain    ${downloadUri}     ${csarId}
    Should Be Equal As Strings  ${resp.status_code}     200

Get List Of Requests 
    Create Session   refrepo  http://${REPO_IP}:8702
    &{headers}=  Create Dictionary      Content-Type=application/json
    ${resp}=    Get Request    refrepo   /openoapi/vnfsdk-marketplace/v1/PackageResource/csars?name=enterprise2DC&version=1.0&type=SSAR&provider=huawei   headers=${headers}  
    Should Be Equal As Strings  ${resp.status_code}     200

Download VNF Package from Repository
    Create Session   refrepo  http://${REPO_IP}:8702
    &{headers}=  Create Dictionary      Content-Type=application/json
    ${resp}=    Get Request    refrepo   /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}/files   headers=${headers}
    Should Be Equal As Strings  ${resp.status_code}     200
    ${downloadUri}=    Convert To String    ${resp.content}
    ${downloadUri1}=    Run    curl http://${REPO_IP}:8702/openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}/files
    ${string}=    Convert To String    ${downloadUri1}
    Should Contain    ${downloadUri1}    '  % Total    % Received % Xferd  Average
    Should Contain    ${string}    '  % Total    % Received % Xferd  Average

Delete VNF Package from Repository
    Create Session   refrepo  http://${REPO_IP}:8702
    &{headers}=  Create Dictionary      Content-Type=application/json
    ${resp}=    Delete Request    refrepo    /openoapi/vnfsdk-marketplace/v1/PackageResource/csars/${csarId}   headers=${headers}
    Should Be Equal As Strings  ${resp.status_code}     200