Skip to content

Commit

Permalink
Adding test cases for session logging and SLO
Browse files Browse the repository at this point in the history
Partial-bug: #1741461
Partial-bug: #1741836

Change-Id: I6a1093d1fdfc4f9a304d2cba1c5e3109a225a7f5
  • Loading branch information
alokkumar223 committed Apr 4, 2018
1 parent 1be71cd commit 3aa27b7
Show file tree
Hide file tree
Showing 4 changed files with 586 additions and 26 deletions.
31 changes: 12 additions & 19 deletions serial_scripts/policy/test_policy_serial.py
Expand Up @@ -862,10 +862,8 @@ def policy_test_with_multi_proto_traffic(self, topo):
'sourceip',
'destvn',
'destip',
'sum(packets)',
'flow_count',
'sum(bytes)',
'sum(bytes)'],
'SUM(packets)',
'SUM(bytes)'],
where_clause=query[proto])
msg1 = proto + \
" Flow count info is not matching with opserver flow series record"
Expand All @@ -874,7 +872,7 @@ def policy_test_with_multi_proto_traffic(self, topo):
expected_flow_count[proto] = total_streams[proto]
self.logger.info(flow_series_data[proto])
self.assertEqual(
flow_series_data[proto][0]['flow_count'],
len(flow_series_data[proto]),
expected_flow_count[proto],
msg1)
# 5. Stop Traffic
Expand Down Expand Up @@ -902,11 +900,10 @@ def policy_test_with_multi_proto_traffic(self, topo):
'sourceip',
'destvn',
'destip',
'sum(packets)',
'flow_count',
'sum(bytes)',
'sum(bytes)'],
'SUM(packets)',
'SUM(bytes)'],
where_clause=query[proto])

self.assertEqual(result, True, msg)
# 6. Match traffic stats against Analytics flow series data
self.logger.info("-" * 80)
Expand All @@ -924,7 +921,7 @@ def policy_test_with_multi_proto_traffic(self, topo):
"***Actual Traffic sent by agent %s \n\n stats shown by Analytics flow series%s" %
(traffic_stats[proto], flow_series_data[proto]))
self.assertGreaterEqual(
flow_series_data[proto][0]['sum(packets)'],
flow_series_data[proto][0]['SUM(packets)'],
traffic_stats[proto]['total_pkt_sent'],
msg[proto])

Expand All @@ -947,10 +944,8 @@ def policy_test_with_multi_proto_traffic(self, topo):
'sourceip',
'destvn',
'destip',
'sum(packets)',
'flow_count',
'sum(bytes)',
'sum(bytes)'],
'SUM(packets)',
'SUM(bytes)'],
where_clause=query[proto])
msg = proto + \
" Flow count info is not matching with opserver flow series record after flow age out in kernel"
Expand All @@ -966,17 +961,15 @@ def policy_test_with_multi_proto_traffic(self, topo):
'sourceip',
'destvn',
'destip',
'sum(packets)',
'flow_count',
'sum(bytes)',
'sum(bytes)'],
'SUM(packets)',
'SUM(bytes)'],
where_clause=query[proto])
msg = proto + \
" Traffic Stats is not matching with opServer flow series data after flow age out in kernel"
# Historical data should be present in the Analytics, even if flows
# age out in kernel
self.assertGreaterEqual(
flow_series_data[proto][0]['sum(packets)'],
flow_series_data[proto][0]['SUM(packets)'],
traffic_stats[proto]['total_pkt_sent'],
msg)
return result
Expand Down
15 changes: 8 additions & 7 deletions serial_scripts/vrouter/test_flow_scenarios.py
Expand Up @@ -103,14 +103,15 @@ def _test_flow_export(self, sender_vm_fixture,
interval=interval)
hping_h.start(wait=False)
self.sleep(65)
# Check for contrail stats for last 1 min for both source and
# Check for no. of sessions exported in last 1 min for both source and
# dest vrouter
vrouter1_flows_exported = self.get_flows_exported(
self.vn1_vm1_vrouter_fixture.get_agent_generator_name(),
last='1m')
vrouter2_flows_exported = self.get_flows_exported(
self.vn1_vm2_vrouter_fixture.get_agent_generator_name(),
last='1m')
end_time = self.analytics_obj.getstarttime(self.inputs.collector_ip)
start_time = str(int(end_time) - (60*1000000))

vrouter1_flows_exported = self.get_sessions_exported(
self.vn1_vm1_vrouter_fixture.ip, start_time, end_time)
vrouter2_flows_exported = self.get_sessions_exported(
self.vn1_vm2_vrouter_fixture.ip, start_time, end_time)
self.sleep(40)
(stats, hping_log) = hping_h.stop()
vrouter1_flows_expected = 60*export_rate
Expand Down

0 comments on commit 3aa27b7

Please sign in to comment.