2 Library OperatingSystem
4 Variables ../variables/Variables.py
7 ${HBASE_CLIENT} /tmp/Hbase/hbase-0.94.15/bin
12 [Arguments] ${switch}=ovsk
13 [Documentation] TSDR specific setup/cleanup work that can be done safely before any system
16 ${mininet_conn_id1}= Open Connection ${MININET} prompt=${DEFAULT_LINUX_PROMPT} timeout=30s
17 Set Suite Variable ${mininet_conn_id1}
18 Login With Public Key ${MININET_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
19 Execute Command sudo ovs-vsctl set-manager ptcp:6644
20 ${start}= Set Variable sudo mn --controller=remote,ip=${CONTROLLER} --topo=linear,3 --switch ${switch},protocols=OpenFlow13
26 [Documentation] Cleanup/Shutdown work that should be done at the completion of all
28 Switch Connection ${mininet_conn_id1}
31 Read Until ${DEFAULT_LINUX_PROMPT}
34 Initialize the HBase for TSDR
35 [Documentation] Install and initialize the tsdr tables on HBase Server
36 ${hbase_server}= Run Command On Remote System ${CONTROLLER} export JAVA_HOME=/usr && ${HBASE_CLIENT}/start-hbase.sh ${MININET_USER} ${prompt_timeout}=120
38 ${hbase_process}= Run Command On Remote System ${CONTROLLER} ps -ef | grep HMaster
42 [Documentation] Stop the HBase server
43 ${hbase_server}= Run Command On Remote System ${CONTROLLER} export JAVA_HOME=/usr && ${HBASE_CLIENT}/stop-hbase.sh ${MININET_USER} ${prompt_timeout}=90
46 Configure the Queue on Switch
47 [Arguments] ${queue_interface} ${user}=${MININET_USER} ${prompt_timeout}=120s
48 [Documentation] Configure the 2 queues on specified openvswitch interface
49 Log Configure the queue on ${queue_interface}
50 ${output}= Run Command On Remote System ${MININET} sudo ovs-vsctl set port ${queue_interface} qos=@newqos -- --id=@newqos create qos type=linux-htb other-config:max-rate=200000000 queues=0=@q0,1=@q1,2=@q2 -- --id=@q0 create queue other-config:min-rate=100000 other-config:max-rate=200000 -- --id=@q1 create queue other-config:min-rate=10001 other-config:max-rate=300000 -- --id=@q2 create queue other-config:min-rate=300001 other-config:max-rate=200000000 ${MININET_USER} ${prompt_timeout}=90
53 Query the Data from HBaseClient
54 [Arguments] ${query} ${remote}=${CONTROLLER} ${user}=${MININET_USER} ${prompt_timeout}=120s
55 [Documentation] Execute the HBase Query and return the result
56 Log Attempting to execute ${query} on ${remote} via HbaseClient
57 ${conn_id}= Open Connection ${remote} prompt=${DEFAULT_LINUX_PROMPT} timeout=${prompt_timeout}
58 Login With Public Key ${user} ${USER_HOME}/.ssh/${SSH_KEY} any
59 Write export JAVA_HOME=/usr
60 Write ${HBASE_CLIENT}/hbase shell
61 Read Until hbase(main):001:0>
63 ${output}= Read Until hbase(main):
66 Comment ${output}= Read Until ${DEFAULT_LINUX_PROMPT}
70 Verify the Metric is Collected?
71 [Arguments] ${tsdr_cmd} ${metric} ${remote}=${CONTROLLER} ${user}=${MININET_USER} ${prompt_timeout}=120s
72 [Documentation] Verify the ${tsdr_cmd} output contains ${metric}
73 ${output}= Issue Command On Karaf Console ${tsdr_cmd} ${remote} ${KARAF_SHELL_PORT} ${prompt_timeout}
74 Should Contain ${output} ${metric}
77 [Arguments] ${left_str} ${right_str} ${connector}
78 [Documentation] Prepare the Hbase Filter from Tsdr List output
79 ${left_str}= Remove Space on String ${left_str}
80 ${right_str}= Remove Space on String ${right_str} 1
81 ${x}= Run Keyword If '${left_str}' == 'MetricID' Catenate ${SPACE} _
82 ... ELSE IF '${left_str}' == 'ObjectKeys' Catenate ${right_str} _
83 ... ELSE IF '${left_str}' == 'TimeStamp' Get Epoch Time ${right_str}
84 ... ELSE Catenate ${SPACE}
87 Create the Hbase table row
88 [Arguments] ${tsdr_line} ${metrics}
89 [Documentation] Create the Hbase table row from tsdr:list
90 @{words}= Split String ${tsdr_line} |
91 : FOR ${li} IN @{words}
92 \ ${key}= Fetch From Left ${li} =
93 \ ${value}= Fetch From Right ${li} =
94 \ ${each_value}= Prepare HBase Filter ${key} ${value} _
95 \ ${final}= Concatenate the String ${final} ${each_value}
96 ${query}= Concatenate the String ${metrics} ${final}
97 ${query}= Remove Space on String ${query}
100 Query Metrics on H2 Datastore
101 [Arguments] ${category} ${attribute} ${nodeid}=openflow:1
102 [Documentation] Generate the JDBC query for H2 Datastore
103 ${h2_query}= Concatenate the String jdbc:query metric "select * from Metric where MetricCategory= '${category}' and
104 ${h2_query}= Concatenate the String ${h2_query} MetricName = '${attribute}' and NODEID = '${nodeid}' order by ID desc limit 5"
105 ${output}= Issue Command On Karaf Console ${h2_query} ${CONTROLLER} ${KARAF_SHELL_PORT} 30
109 [Arguments] ${table} ${filter}
110 [Documentation] Scan the Hbase Table with Filter
111 ${hbase_query}= Concatenate the String scan '${table}'
112 ${hbase_query}= Concatenate the String ${hbase_query} ,{ FILTER =>\"(RowFilter(=,
113 ${hbase_query}= Concatenate the String ${hbase_query} 'regexstring:${filter}*\'))\",LIMIT=>10}
114 [Return] ${hbase_query}
117 [Arguments] ${tsdr_line}
118 [Documentation] Get Metric Value from tsdr:list
119 ${value}= Fetch From Right ${tsdr_line} |
120 ${value}= Replace String ${value} MetricValue value
121 ${value}= Replace String ${value} [m ${EMPTY}
122 ${value}= Replace String ${value} = \=
123 ${value}= Remove Space on String ${value}
124 ${value}= Convert to String ${value}
127 Verify the Metrics Attributes on Hbase Client
128 [Arguments] ${attribute} ${rowfilter} ${table}=PortStats
129 [Documentation] Verification on Metrics attributes on Hbase Client
130 ${pattern}= Concatenate the String ${attribute} _
131 ${pattern}= Concatenate the String ${pattern} ${rowfilter}
132 ${pattern}= Remove Space on String ${pattern}
133 ${query}= Generate HBase Query ${table} ${pattern}
134 ${out}= Query the Data from HBaseClient ${query}
135 Should Match Regexp ${out} (?mui)${attribute}