Commit 030bb269 authored by Elian Kraja's avatar Elian Kraja
Browse files

Fix on json schema check

parent 7ec8d395
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Library    REST    ${VNF_SCHEMA}://${VNF_HOST}:${VNF_PORT} 
...        spec=SOL002-VNFConfiguration-API.yaml
Library    REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    OperatingSystem
Library    DependencyLibrary

*** Variables ***
${Etag}=    an etag
${Etag_modified}=    12345
${response}=    httpresponse

*** Test Cases ***
POST Configuration - Method not implemented
@@ -122,8 +117,7 @@ Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    ${contentType}=    Get Value From Json    ${response.headers}    $..Content-Type
    Should Be Equal    ${contentType}    ${CONTENT_TYPE}
    ${json}=    evaluate    json.loads('''${response.body}''')    json
    Validate Json    ${schema}    ${json}
    Validate Json    ${schema}    ${response.body}
    Log    Json Schema Validation OK
    
Check Postcondition VNF Configuration Untouched
+12 −37
Original line number Diff line number Diff line
*** Variables ***
${VNFM_HOST}      localhost    # Hostname of the VNFM
${VNFM_PORT}      8080    # Listening port of the VNFM
${VNF_HOST}      localhost    # Hostname of the NFVO
${VNF_PORT}      8081    # Listening port of the NFVO
${VNFM_SCHEMA}    https
${VNF_SCHEMA}    https

${Etag}=    an etag
${Etag_modified}=    12345
${response}=    httpresponse

${EM-VNF_HOST}      localhost    # Hostname of the NFVO
${EM-VNF_PORT}      8081    # Listening port of the NFVO
${EM-VNF_SCHEMA}    https

${ACCEPT}         application/json
${AUTH_USAGE}     1
${AUTHORIZATION}    Bearer    QWxhZGRpbjpvcGVuIHNlc2FtZQ==
${CONTENT_TYPE}    application/json
${CONTENT_TYPE_PATCH}    application/merge-patch+json 
${ACCEPT}         application/json
${apiRoot}        /
${apiName}        vnfconfig
${apiVersion}     v1
${AUTH_USAGE}     1
${WRONG_AUTHORIZATION}    Bearer    XXXXXWRONGXXXXX
${alarm_filter}       managedObjectId
${managedObjectId}    007c111c-38a1-42c0-a666-7475ecb1567c
${invalid_alarm_filter}    badFilter 
${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${vnfInstanceDescription}    description vnf
${vnfInstanceDescription_Update}    Updated description vnf 
${SINGLE_FILE_VNFD}    1    # If VNFD is PLAIN TEXT
${ACCEPT_PLAIN}    text/plain
${ACCEPT_ZIP}     application/zip
${vnfPkgId_processing}    007c111c-38a1-42c0-a666-7475ecb1567c
${ARTIFACT_TYPE}    application/octet-stream
${ARTIFACT_ID}    artifactId
${WRONG_ACCEPT}    application/json
${vnfLcmOpOccId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${CancelMode}    GRACEFUL
${LccnSubscriptionRequest}    {}
${NVFM_DUPLICATION}    0
${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
${notification_ep}    /notification
${notification_port}    9091
${AlarmNotification}    {}
${AlarmClearedNotification}    {}
${AlarmListRebuiltNotification}    {}
${PerceivedSeverity}    CRITICAL
 No newline at end of file
+3 −7
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
# Suite setup     Expect spec    SOL003-VNFLifecycleManagement-API.yaml
Resource    environment/variables.txt 
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} 
...        spec=SOL002-VNFFaultManagement-API.yaml
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    OperatingSystem
@@ -35,8 +34,7 @@ Get information about multiple alarms
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    ${result}=    Output    response body
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    alarms.schema.json    ${json}
    Validate Json    alarms.schema.json    ${result}
    Log    Validation OK

Get information about multiple alarms with filters 
@@ -58,8 +56,7 @@ Get information about multiple alarms with filters
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    ${result}=    Output    response body
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    alarms.schema.json    ${json}
    Validate Json    alarms.schema.json    ${result}
    Log    Validation OK

Get information about multiple alarms Bad Request Invalid attribute-based filtering parameters
@@ -78,8 +75,7 @@ Get information about multiple alarms Bad Request Invalid attribute-based filter
    Log    Validate Status code
    Integer    response status    400
    ${problemDetails}=    Output    response body
    ${json}=    evaluate    json.loads('''${problemDetails}''')    json
    Validate Json    ProblemDetails.schema.json    ${json}
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    
PUT Alarms - Method not implemented
+0 −1
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} 
...        spec=SOL002-VNFFaultManagement-API.yaml
Suite Setup    Check resource existance

*** Test Cases ***
+4 −9
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
# Suite setup     Expect spec    SOL003-VNFLifecycleManagement-API.yaml
Resource    environment/variables.txt  
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} 
...        spec=SOL002-VNFFaultManagement-API.yaml
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
@@ -42,8 +41,7 @@ Get information about a configuration
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    ${result}=    Output    response body
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    alarm.schema.json    ${json}
    Validate Json    alarm.schema.json    ${result}
    Log    Validation OK

PUT Alarm - Method not implemented
@@ -75,8 +73,7 @@ PATCH Alarm
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    ${result}=    Output    response body
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    alarmModifications.schema.json    ${json}
    Validate Json    alarmModifications.schema.json    ${result}
    Log    Validation OK

PATCH Alarm - Conflict
@@ -98,8 +95,7 @@ PATCH Alarm - Conflict
    Log    Validate Status code
    Integer    response status    409
    ${problemDetails}=    Output    response body
    ${json}=    evaluate    json.loads('''${problemDetails}''')    json
    Validate Json    ProblemDetails.schema.json    ${json}
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK

PATCH Alarm - Precondition failed
@@ -122,8 +118,7 @@ PATCH Alarm - Precondition failed
    Log    Validate Status code
    Integer    response status    412
    ${problemDetails}=    Output    response body
    ${json}=    evaluate    json.loads('''${problemDetails}''')    json
    Validate Json    ProblemDetails.schema.json    ${json}
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK

DELETE Alarm - Method not implemented
Loading