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} _ ELSE IF
82 ... '${left_str}' == 'ObjectKeys' Catenate ${right_str} _ ELSE IF '${left_str}' == 'TimeStamp'
83 ... Get Epoch Time ${right_str} ELSE Catenate ${SPACE}
86 Create the Hbase table row
87 [Arguments] ${tsdr_line} ${metrics}
88 [Documentation] Create the Hbase table row from tsdr:list
89 @{words}= Split String ${tsdr_line} |
90 : FOR ${li} IN @{words}
91 \ ${key}= Fetch From Left ${li} =
92 \ ${value}= Fetch From Right ${li} =
93 \ ${each_value}= Prepare HBase Filter ${key} ${value} _
94 \ ${final}= Concatenate the String ${final} ${each_value}
95 ${query}= Concatenate the String ${metrics} ${final}
96 ${query}= Remove Space on String ${query}
99 Query Metrics on H2 Datastore
100 [Arguments] ${category} ${attribute} ${nodeid}=openflow:1
101 [Documentation] Generate the JDBC query for H2 Datastore
102 ${h2_query}= Concatenate the String jdbc:query metric "select * from Metric where MetricCategory= '${category}' and
103 ${h2_query}= Concatenate the String ${h2_query} MetricName = '${attribute}' and NODEID = '${nodeid}' order by ID desc limit 5"
104 ${output}= Issue Command On Karaf Console ${h2_query} ${CONTROLLER} ${KARAF_SHELL_PORT} 30
108 [Arguments] ${table} ${filter}
109 [Documentation] Scan the Hbase Table with Filter
110 ${hbase_query}= Concatenate the String scan '${table}'
111 ${hbase_query}= Concatenate the String ${hbase_query} ,{ FILTER =>\"(RowFilter(=,
112 ${hbase_query}= Concatenate the String ${hbase_query} 'regexstring:${filter}*\'))\",LIMIT=>10}
113 [Return] ${hbase_query}
116 [Arguments] ${tsdr_line}
117 [Documentation] Get Metric Value from tsdr:list
118 ${value}= Fetch From Right ${tsdr_line} |
119 ${value}= Replace String ${value} MetricValue value
120 ${value}= Replace String ${value} [m ${EMPTY}
121 ${value}= Replace String ${value} = \=
122 ${value}= Remove Space on String ${value}
123 ${value}= Convert to String ${value}
126 Verify the Metrics Attributes on Hbase Client
127 [Arguments] ${attribute} ${rowfilter} ${table}=PortStats
128 [Documentation] Verification on Metrics attributes on Hbase Client
129 ${pattern}= Concatenate the String ${attribute} _
130 ${pattern}= Concatenate the String ${pattern} ${rowfilter}
131 ${pattern}= Remove Space on String ${pattern}
132 ${query}= Generate HBase Query ${table} ${pattern}
133 ${out}= Query the Data from HBaseClient ${query}
134 Should Match Regexp ${out} (?mui)${attribute}