Commit fe6bdd4e authored by Elian Kraja's avatar Elian Kraja
Browse files

Enhancement on Instrumentation platform hooks

parent 37a10eba
Loading
Loading
Loading
Loading
+16 −23
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Resource    environment/variables.txt 
Resource    environment/variables.txt 
Resource    NSFMOperationKeywords.robot
Resource    NSFMOperationKeywords.robot
Resource    ../../instrumentationPlatformHooks/InstrumentationPlatformHooksKeywords.robot


Library    MockServerLibrary
Library    MockServerLibrary
Library    Process
Library    Process
@@ -62,8 +63,8 @@ NS Fault Alarm Notification with instrumental platform hook
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none 
    ...    Post-Conditions: none 
    Trigger the fault of a virtualised resource in the NS instance
    Trigger the fault of a virtualised resource in the NS instance
    Check Alarm Notification Http POST Request Body Json Schema Is    alarmNotification
    Check Instrumentation Platform Alarm Notification Http POST Request Body Json Schema Is    alarmNotification
    Check Alarm Notification Http POST Request Body notificationType attribute Is    alarmNotification
    Check Instrumentation Platform Alarm Notification Http POST Request Body notificationType attribute Is    alarmNotification


*** Keywords ***
*** Keywords ***
Trigger the fault of a virtualised resource in the NS instance
Trigger the fault of a virtualised resource in the NS instance
@@ -100,6 +101,12 @@ Check Alarm Notification Http POST Request Body Json Schema Is
    ${schema}=	Get File	schemas/${element}.schema.json
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}


Check Instrumentation Platform Alarm Notification Http POST Request Body Json Schema Is
    [Arguments]    ${element}
    Pass Execution If   ${instrumentationPlatformSkip}  Skip Test step -- Instrumentation platform not supported 
    Check Alarm Notification Http POST Request Body Json Schema Is   ${element}


Check Alarm Notification Http POST Request Body notificationType attribute Is
Check Alarm Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    [Arguments]    ${type}
    Configure Notification Alarm Handler    ${callback_endpoint_fwd}    ${type}
    Configure Notification Alarm Handler    ${callback_endpoint_fwd}    ${type}
@@ -107,6 +114,11 @@ Check Alarm Notification Http POST Request Body notificationType attribute Is
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
    Clear Requests    ${callback_endpoint_fwd}


Check Instrumentation Platform Alarm Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Pass Execution If   ${instrumentationPlatformSkip}  Skip Test step -- Instrumentation platform not supported 
    Check Alarm Notification Http POST Request Body notificationType attribute Is   ${type}

Check Alarm cleared Notification Http POST Request Body Json Schema Is    
Check Alarm cleared Notification Http POST Request Body Json Schema Is    
    [Arguments]    ${element}
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    ${schema}=	Get File	schemas/${element}.schema.json
@@ -190,22 +202,3 @@ Create Alarm Subscription
    Set Global Variable    ${response}    ${output}
    Set Global Variable    ${response}    ${output}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint}
	
	
 No newline at end of file

Trigger instrumentation platform    
     [Arguments]    ${upperTesterUrl}    ${resourceId}    ${resourceType}    ${event}    ${value}    &{keyvalues}
     ${alarmNotificationBoolean}    Run Keyword And Return Status    Should Be Equal As Strings    ${event}    AlarmNotification        
     ${alarmClearedNotificationBoolean}    Run Keyword And Return Status    Should Be Equal As Strings    ${event}    AlarmClearedNotification        
     ${alarmListRebuiltNotificationBoolean}    Run Keyword And Return Status    Should Be Equal As Strings    ${event}    AlarmListRebuiltNotification        
     Run Keyword If    ${alarmNotificationBoolean} == True or ${alarmClearedNotificationBoolean} == True or ${alarmListRebuiltNotificationBoolean} == True
     ...    Trigger Alarm Management UpperTester     ${upperTesterUrl}    ${resourceId}    ${resourceType}    ${event}    ${value}    &{keyvalues}
     
    
Trigger Alarm Management UpperTester
    [Arguments]    ${upperTesterUrl}    ${resourceId}    ${resourceType}    ${event}    ${value}    &{keyvalues}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE_UPPERTESTER} == 1    Set Headers    {"${AUTHORIZATION_HEADER_UPPERTESTER}":"${AUTHORIZATION_TOKEN_UPPERTESTER}"}
    ${template}=    Get File    jsons/AlarmNotificationUpperTester.json
    ${body}=        Format String   ${template}     resourceId=${resourceId}    resourceType=${resourceType}   event=${event}    value=${value}     keyvalues=${keyvalues}
    POST    ${upperTesterUrl}       ${body}
    ${output}=    Output    response
    Should Be Equal As Strings    ${output['status']}    202     
+1 −6
Original line number Original line Diff line number Diff line
@@ -70,10 +70,5 @@ ${callbackResp} 127.0.0.1


### Instrumentation platform variables
### Instrumentation platform variables
${nsInstanceIdForNotifications}    SOME-ID
${nsInstanceIdForNotifications}    SOME-ID
${AUTHORIZATION_HEADER_UPPERTESTER}    Authorization
${AUTHORIZATION_TOKEN_UPPERTESTER}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${AUTH_USAGE_UPPERTESTER}     0


${upperTesterUrlForAlarmNotifications}    http://localhost:9999/uppertester
${upperTesterUrlForAlarmNotifications}    http://localhost:9999/uppertester
${instrumentationPlatformSkip}      True
 No newline at end of file
+27 −0
Original line number Original line Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 

Library    OperatingSystem
Library    Collections
Library    REST     http://localhost:8080    ssl_verify=false


*** Keywords ***
Trigger instrumentation platform    
     [Arguments]    ${upperTesterUrl}    ${resourceId}    ${resourceType}    ${event}    ${value}    &{keyvalues}
     ${alarmNotificationBoolean}    Run Keyword And Return Status    Should Be Equal As Strings    ${event}    AlarmNotification        
     ${alarmClearedNotificationBoolean}    Run Keyword And Return Status    Should Be Equal As Strings    ${event}    AlarmClearedNotification        
     ${alarmListRebuiltNotificationBoolean}    Run Keyword And Return Status    Should Be Equal As Strings    ${event}    AlarmListRebuiltNotification        
     Run Keyword If    ${alarmNotificationBoolean} == True or ${alarmClearedNotificationBoolean} == True or ${alarmListRebuiltNotificationBoolean} == True
     ...    Trigger Alarm Management UpperTester     ${upperTesterUrl}    ${resourceId}    ${resourceType}    ${event}    ${value}    &{keyvalues}
     
    
Trigger Alarm Management UpperTester
    [Arguments]    ${upperTesterUrl}    ${resourceId}    ${resourceType}    ${event}    ${value}    &{keyvalues}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE_UPPERTESTER} == 1    Set Headers    {"${AUTHORIZATION_HEADER_UPPERTESTER}":"${AUTHORIZATION_TOKEN_UPPERTESTER}"}
    ${template}=    Get File    ../../instrumentationPlatformHooks/jsons/AlarmNotificationUpperTester.json
    ${body}=        Format String   ${template}     resourceId=${resourceId}    resourceType=${resourceType}   event=${event}    value=${value}     keyvalues=${keyvalues}
    POST    ${upperTesterUrl}       ${body}
    ${output}=    Output    response
    Should Be Equal As Strings    ${output['status']}    202
 No newline at end of file
+6 −0
Original line number Original line Diff line number Diff line
*** Variables ***

### Instrumentation platform variables
${AUTHORIZATION_HEADER_UPPERTESTER}    Authorization
${AUTHORIZATION_TOKEN_UPPERTESTER}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${AUTH_USAGE_UPPERTESTER}     0