Tidied updated tests.
[integration/test.git] / csit / suites / tsdr / HBase / 070_Netflow.robot
1 *** Settings ***
2 Documentation     Test suite for Hbase DataStore Netflow Stats Verification
3 Suite Setup       Initialize Netflow
4 Suite Teardown    Stop Tsdr Suite
5 Library           SSHLibrary
6 Library           Collections
7 Library           String
8 Library           ../../../libraries/Common.py
9 Resource          ../../../libraries/KarafKeywords.robot
10 Resource          ../../../libraries/TsdrUtils.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${IP_1}           10.0.0.1
15 ${IP_2}           10.0.0.2
16 ${NODE_ID}        127.0.0.1
17 ${engine_type}    11
18 ${engine_id}      11
19 ${nextHop}        0
20 ${port}           0
21 ${protocol}       1
22 ${int1}           1
23 ${int2}           2
24 ${version}        5
25
26 *** Test Cases ***
27 Verification of Full Record Text for Netflow Dumps
28     [Documentation]    Verify the Netflow Record Text Hbase client
29     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1' , LIMIT => 10, FILTER => "ValueFilter( =, 'regexstring:srcAddr=${IP_2}' )" }
30     Should Contain    ${out}    srcAddr=${IP_2}
31     Should Contain    ${out}    dstAddr=${IP_1}
32     Should Contain    ${out}    srcPort=${port}
33     Should Contain    ${out}    protocol=${protocol}
34     Should Contain    ${out}    nextHop=${nexthop}
35     Should Contain    ${out}    engine_type
36     Should Contain    ${out}    engine_id
37     Should Contain    ${out}    input=${int2}
38     Should Contain    ${out}    output=${int1}
39     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1' , LIMIT => 10, FILTER => "ValueFilter( =, 'regexstring:srcAddr=${IP_1}' )" }
40     Should Contain    ${out}    srcAddr=${IP_1}
41     Should Contain    ${out}    dstAddr=${IP_2}
42     Should Contain    ${out}    dstPort=${port}
43     Should Contain    ${out}    protocol=${protocol}
44     Should Contain    ${out}    nextHop=${nexthop}
45     Should Contain    ${out}    engine_type
46     Should Contain    ${out}    engine_id
47     Should Contain    ${out}    input=${int1}
48     Should Contain    ${out}    output=${int2}
49     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW'
50     Should Contain    ${out}    sysUpTime
51     Should Contain    ${out}    flow_sequence
52     Should Contain    ${out}    unix_nsecs
53     Should Contain    ${out}    dPkts
54     Should Contain    ${out}    tcpFlags
55     Should Contain    ${out}    dstAS=0
56     Should Contain    ${out}    srcAS=0
57     Should Contain    ${out}    dstMask=0
58     Should Contain    ${out}    srcMask=0
59
60 Verification of Metric Record for Netflow Dumps
61     [Documentation]    Verify the Netflow Metric Record Hbase client
62     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:dstAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_1}' )" }
63     Should Contain    ${out}    value=${IP_1}
64     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:srcAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_1}' )" }
65     Should Contain    ${out}    value=${IP_1}
66     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:dstAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_2}' )" }
67     Should Contain    ${out}    value=${IP_2}
68     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:srcAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_2}' )" }
69     Should Contain    ${out}    value=${IP_2}
70     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:input' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int1}' )" }
71     Should Contain    ${out}    value=${int1}
72     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:output' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int2}' )" }
73     Should Contain    ${out}    value=${int2}
74     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:input' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int2}' )" }
75     Should Contain    ${out}    value=${int2}
76     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:output' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int1}' )" }
77     Should Contain    ${out}    value=${int1}
78     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:flowDuration' , LIMIT => 10}
79     Should Contain    ${out}    flowDuration
80     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:nextHop' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${nextHop}' )" }
81     Should Contain    ${out}    value=${nextHop}
82     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:version' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${version}' )" }
83     Should Contain    ${out}    value=${version}
84     ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:protocol' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${protocol}' )" }
85     Should Contain    ${out}    value=${protocol}
86
87 *** Keywords ***
88 Initialize Netflow
89     [Documentation]    Initialize Netflow setup and start collecting the netflow samples.
90     Query the Data from HBaseClient    truncate 'NETFLOW'
91     Bringup Netflow
92     Wait Until Keyword Succeeds    36x    5 sec    Ping Pair Hosts Hbase    \\d{2} row