PerformanceManagementNotification.robot 6.29 KB
Newer Older
1
*** Setting ***
2
Resource	environment/notifications.txt
3
Resource	environment/variables.txt
4
5
Suite Setup    Create Sessions
Suite Teardown    Terminate All Processes    kill=true
6
7
8
9
10
11
12
13
Library    MockServerLibrary
Library    Process
Library    OperatingSystem
Library    BuiltIn
Library    Collections
Library    String


14
*** Test Cases ***
15
16
17
VNF Performance Information Availability Notification
    [Documentation]    Test ID: 7.3.4.8.1
    ...    Test title: VNF Performance Information Availability Notification
18
    ...    Test objective: The objective is to test the dispatch of VNF Performance Information Availability Notification when new VNF performance information is available in the NFVO, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
19
    ...    Pre-conditions: A VNF performance job is created, and a subscription for information availability notifications is available in the VNFM.
20
    ...    Reference: clause 6.4.9.3.1 - ETSI GS NFV-SOL 003 [1] v2.6.1
21
22
23
24
25
26
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger the availability of VNF Performance Information (external action) 
    Check Performance Information Available Notification Http POST Request Body Json Schema Is    PerformanceInformationAvailableNotification
    Check Performance Information Available Notification Http POST Request Body notificationType attribute Is    PerformanceInformationAvailableNotification
27

28
29
30
VNF Threshold Crossed Notification
    [Documentation]    Test ID: 7.3.4.8.2
    ...    Test title: VNF Threshold Crossed Notification
31
    ...    Test objective: The objective is to test the dispatch of VNF Threshold Crossed Notification when a previously set VNF performance metric threshold is crossed, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system.
32
    ...    Pre-conditions: A VNF performance job is created, and a threshold subscription is available in the VNFM.
33
    ...    Reference: clause 6.4.9.3.1 - ETSI GS NFV-SOL 003 [1] v2.6.1
34
35
36
37
38
39
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none 
    Trigger the cross of VNF Performance Threshold (external action) 
    Check Threshold Crossed Notification Http POST Request Body Json Schema Is    ThresholdCrossedNotification
    Check Threshold Crossed Notification Http POST Request Body notificationType attribute Is    ThresholdCrossedNotification
40
41


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
*** Keywords ***
Trigger the availability of VNF Performance Information (external action) 
    #do nothing
    Log    do nothing

Trigger the cross of VNF Performance Threshold (external action) 
    #do nothing
    Log    do nothing   
  
Check Performance Information Available Notification Http POST Request Body Json Schema Is    
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}

Check Performance Information Available Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Performance Information Available Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}

Check Threshold Crossed Notification Http POST Request Body Json Schema Is    
    [Arguments]    ${element}
    ${schema}=	Get File	schemas/${element}.schema.json
    Configure Notification Forward    ${schema}    ${callback_endpoint}    ${callback_endpoint_fwd}
67
    
68
69
70
71
72
73
74

Check Threshold Crossed Notification Http POST Request Body notificationType attribute Is
    [Arguments]    ${type}
    Configure Notification Threshold Crossed Handler    ${callback_endpoint_fwd}    ${type}
    Wait Until Keyword Succeeds    2 min   10 sec   Verify Mock Expectation    ${notification_request}
    Clear Requests    ${callback_endpoint}
    Clear Requests    ${callback_endpoint_fwd}
75
76
    
    
77
78
79
80
Check Threshold Crossed Notification Http POST Request Body changeType attribute Is
    [Arguments]    ${type}
    #do nothing
    Log    do nothing 
81
82
    
    
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Configure Notification Performance Information Available Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary    ${json}    notificationType    ${type}    
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}

Configure Notification Threshold Crossed Handler
    [Arguments]    ${endpoint}    ${type}
    ${json}=    evaluate    {}
    set to dictionary   ${json}    notificationType    ${type}
    ${BODY}=    evaluate    json.dumps(${json})    json
    Log  Creating mock request and response to handle status notification
    &{notification_request}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON"    body=${BODY}
    &{notification_response}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${notification_request}  ${notification_response}
  
Configure Notification Forward
    [Arguments]    ${schema}    ${endpoint}    ${endpoint_fwd}    
    Log  Creating mock Http POST forward to handle ${schema}
    &{notification_tmp}=  Create Mock Request Matcher	POST  ${endpoint}  body_type="JSON_SCHEMA"    body=${schema}
    &{notification_fwd}=  Create Mock Http Forward	${endpoint_fwd}
    Create Mock Expectation With Http Forward  ${notification_tmp}  ${notification_fwd}
109
110

Create Sessions
111
    Start Process  java  -jar  ${MOCK_SERVER_JAR}  -serverPort  ${callback_port}  alias=mockInstance
112
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
113
    Create Mock Session  ${callback_uri}:${callback_port}