self.all_tests_data_table = reduce(lambda x, y: pd.merge(x, y, how='outer'), all_tests_trend_data)\r
\r
def plot_trend_graph_all_tests(self, save_path='', file_name='_trend_graph.png'):\r
- time_format = '%d-%m-%Y-%H:%M'\r
+ time_format1 = '%d-%m-%Y-%H:%M'\r
+ time_format2 = '%Y-%m-%d-%H:%M'\r
for test in self.tests:\r
test_data = test.results_df[test.results_df.columns[2]].tolist()\r
test_time_stamps = test.results_df[test.results_df.columns[3]].tolist()\r
test_time_stamps.append(self.end_date+'-23:59')\r
test_data.append(test_data[-1])\r
- float_test_time_stamps = [matdates.date2num(datetime.strptime(x, time_format)) for x in test_time_stamps]\r
+ float_test_time_stamps = []\r
+ for ts in test_time_stamps:\r
+ try:\r
+ float_test_time_stamps.append(matdates.date2num(datetime.strptime(ts, time_format1)))\r
+ except:\r
+ float_test_time_stamps.append(matdates.date2num(datetime.strptime(ts, time_format2)))\r
plt.plot_date(x=float_test_time_stamps, y=test_data, label=test.name, fmt='-', xdate=True)\r
plt.legend(fontsize='small', loc='best')\r
plt.ylabel('MPPS/Core (Norm)')\r
self.cmd_link.run_single_command(cache)
self.config_history['basic_if_config'] = True
- def configure_basic_filtered_interfaces(self, intf_list, mtu = 9050):
+ def configure_basic_filtered_interfaces(self, intf_list, mtu = 9050, vlan = False):
cache = CCommandCache()
for intf in intf_list:
if_command_set = []
+ if_command_set_vlan = []
if_command_set.append ('mac-address {mac}'.format( mac = intf.get_src_mac_addr()) )
if_command_set.append ('mtu %s' % mtu)
+ ip_commands = ['ip address {ip} 255.255.255.0'.format( ip = intf.get_ipv4_addr() ),
+ 'ipv6 address {ip}/64'.format( ip = intf.get_ipv6_addr() )]
if vlan:
- if_command_set.append ('ip address {ip} 255.255.255.0'.format( ip = intf.get_ipv4_addr() ))
- if_command_set.append ('ipv6 address {ip}/64'.format( ip = intf.get_ipv6_addr() ))
+ if_command_set_vlan.extend(ip_commands)
+ else:
+ if_command_set.extend(ip_commands)
cache.add('IF', if_command_set, intf.get_name())
+ if vlan:
+ if_name = intf.get_name() + '.' + (self.client_vlan if intf.is_client() else self.server_vlan)
+ cache.add('IF', if_command_set_vlan, if_name)
self.cmd_link.run_single_command(cache)
if i < 4:
continue
raise Exception('Could not load clean config, response: %s' % res)
+ break
def config_pbr (self, mode = 'config', vlan = False):
idx = 1
if self.config_history['basic_if_config']:
# in this case, duplicated interfaces will lose its ip address.
# re-config IPv4 addresses
- self.configure_basic_filtered_interfaces(self.if_mngr.get_duplicated_if() )
+ self.configure_basic_filtered_interfaces(self.if_mngr.get_duplicated_if(), vlan = vlan)
def config_no_pbr (self, vlan = False):
self.config_pbr(mode = 'unconfig', vlan = vlan)
if self.config_history['basic_if_config']:
# in this case, duplicated interfaces will lose its ip address.
# re-config IPv4 addresses
- self.configure_basic_filtered_interfaces(self.if_mngr.get_duplicated_if() )
+ self.configure_basic_filtered_interfaces(self.if_mngr.get_duplicated_if(), vlan = vlan)
def config_no_static_routing (self, stat_route_obj = None):