onap on kubernetes source files
[oom.git] / kubernetes / config / docker / init / src / config / robot / robot / resources / stack_validation / validate_vfw.robot
1 *** Settings ***
2 Documentation     Testing openstack.
3 Library    OperatingSystem
4 Library    SSHLibrary
5 Library    RequestsLibrary
6 Library    JSONUtils
7 Library    OpenstackLibrary
8 Library    HEATUtils
9 Library    Collections
10 Resource          ../../resources/openstack/keystone_interface.robot
11 Resource          ../../resources/openstack/nova_interface.robot
12 Resource          ../../resources/openstack/heat_interface.robot
13 Resource          ../../resources/ssh/files.robot
14 Resource          ../../resources/ssh/processes.robot
15 Resource          ../appc_interface.robot
16 Resource          packet_generator_interface.robot
17 Resource          validate_common.robot
18
19
20 *** Variables ***
21
22 *** Keywords ***
23 Validate Firewall Stack
24     [Documentation]    Identifies and validates the firewall servers in the VFW Stack
25     [Arguments]    ${STACK_NAME}
26     Run Openstack Auth Request    auth
27     ${stack_info}=    Wait for Stack to Be Deployed    auth    ${STACK_NAME}
28     ${stack_id}=    Get From Dictionary    ${stack_info}    id
29     ${server_list}=    Get Openstack Servers    auth
30
31     ${vpg_unprotected_ip}=    Get From Dictionary    ${stack_info}    vpg_private_ip_0
32     ${vsn_protected_ip}=    Get From Dictionary    ${stack_info}    vsn_private_ip_0
33     ${vpg_name_0}=    Get From Dictionary    ${stack_info}    vpg_name_0
34     ${vfw_public_ip}=    Get Server Ip    ${server_list}    ${stack_info}   vfw_name_0    network_name=public
35     ${vpg_public_ip}=    Get Server Ip    ${server_list}    ${stack_info}   vpg_name_0    network_name=public
36     ${vsn_public_ip}=    Get Server Ip    ${server_list}    ${stack_info}   vsn_name_0    network_name=public
37
38     Wait For Server    ${vfw_public_ip}
39     Wait For Server    ${vpg_public_ip}
40     Wait For Server    ${vsn_public_ip}
41     Log    Accessed all servers
42     Wait For Firewall    ${vfw_public_ip}
43     Wait For Packet Generator    ${vpg_public_ip}
44     Wait For Packet Sink    ${vsn_public_ip}
45     Log    All server processes up
46     ${vpg_oam_ip}=    Get From Dictionary    ${stack_info}    vpg_private_ip_1
47     ${appc}=    Create Mount Point In APPC    ${vpg_name_0}    ${vpg_oam_ip}
48     Wait For Packets   ${vpg_public_ip}   ${vpg_unprotected_ip}   ${vsn_protected_ip}   ${vsn_public_ip}
49
50 Wait For Packets
51     [Documentation]    Final vfw validation that packets are flowing from the pgn VM  to the snk VM
52     [Arguments]   ${vpg_public_ip}   ${vpg_unprotected_ip}   ${vsn_protected_ip}   ${vsn_public_ip}
53     ${resp}=    Enable Stream    ${vpg_public_ip}
54     Should Be Equal As Strings    ${resp.status_code}    200
55     ${syslog_message}=    Catenate    UDP: short packet: From ${vpg_unprotected_ip}:.* to ${vsn_protected_ip}:.*
56     Tail File on Host Until    ${vsn_public_ip}    UDP:    /var/log/syslog    ${syslog_message}    timeout=120s
57     Disable All Streams    ${vpg_public_ip}
58
59
60 Wait For Firewall
61     [Documentation]     Wait for the defined firewall processes to come up
62     [Arguments]    ${ip}
63     Wait for Process on Host    ./vpp_measurement_reporter    ${ip}
64     Wait for Process on Host    vpp -c /etc/vpp/startup.conf    ${ip}
65
66 Wait For Packet Generator
67     [Documentation]     Wait for the defined packet generator processes to come up
68     [Arguments]    ${ip}
69     Wait for Process on Host    vpp -c /etc/vpp/startup.conf    ${ip}
70     Wait Until Keyword Succeeds    180s    5s    Tail File on Host Until    ${ip}    Honeycomb    /var/log/honeycomb/honeycomb.log    - Honeycomb initialized   options=-c +0    timeout=120s
71     Run Keyword And Ignore Error    Wait for Process on Host    run_traffic_fw_demo.sh    ${ip}    timeout=60s
72     Pkill Process On Host    "/bin/bash ./run_traffic_fw_demo.sh"    ${ip}
73
74 Wait For Packet Sink
75     [Documentation]     Wait for the defined packet sink processes to come up
76     [Arguments]    ${ip}
77     Log    noting to check on ${ip}