* Configure tests to raise exception if cli_inband fails.
* Fix failing tests.
* Add filename detail to pcap.stat clib_error_return for debugging.
Note: this change identifies spurious issues with packet-generator such as:
CliFailedCommandError: packet-generator capture: pcap file
'/tmp/vpp-unittest-Test6RD-v09RPA/pg0_out.pcap' does not exist.
These issues resolve themselves on remaining test passes.
Change-Id: Iecbd09daee954d892306d11baff3864a43c5b603
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
{
struct stat sb;
if (stat ((char *) a->pcap_file_name, &sb) != -1)
- return clib_error_return (0, "Cannot create pcap file");
+ return clib_error_return (0, "pcap file '%s' does not exist.",
+ a->pcap_file_name);
}
pi = pool_elt_at_index (pg->interfaces, a->dev_instance);
raise
finally:
self.logger.info(self.vapi.ppcli("show error"))
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
pkts = p.tra_sa_in.get_stats()['packets']
self.assertEqual(pkts, count,
raise
finally:
self.logger.info(self.vapi.ppcli("show error"))
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
pkts = p.tra_sa_in.get_stats()['packets']
self.assertEqual(pkts, count,
finally:
self.logger.info(self.vapi.ppcli("show error"))
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
self.verify_counters(p, count)
raise
finally:
self.logger.info(self.vapi.ppcli("show error"))
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
self.verify_counters(p, count)
raise
finally:
self.logger.info(self.vapi.ppcli("show error"))
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
self.verify_counters(p, count)
def verify_tun_46(self, p, count=1):
raise
finally:
self.logger.info(self.vapi.ppcli("show error"))
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
self.verify_counters(p, count)
def test_gbp_learn_l3(self):
""" GBP L3 Endpoint Learning """
- self.vapi.cli("set logging class gbp debug")
+ self.vapi.cli("set logging class gbp level debug")
ep_flags = VppEnum.vl_api_gbp_endpoint_flags_t
routed_dst_mac = "00:0c:0c:0c:0c:0c"
def test_gbp_redirect(self):
""" GBP Endpoint Redirect """
- self.vapi.cli("set logging class gbp debug")
+ self.vapi.cli("set logging class gbp level debug")
ep_flags = VppEnum.vl_api_gbp_endpoint_flags_t
routed_dst_mac = "00:0c:0c:0c:0c:0c"
""" GBP L3 Out """
ep_flags = VppEnum.vl_api_gbp_endpoint_flags_t
- self.vapi.cli("set logging class gbp debug")
+ self.vapi.cli("set logging class gbp level debug")
routed_dst_mac = "00:0c:0c:0c:0c:0c"
routed_src_mac = "00:22:bd:f8:19:ff"
p = self.ipv4_params
self.config_esp_tun(p)
- self.logger.info(self.vapi.ppcli("show ipsec"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
d = DpoProto.DPO_PROTO_IP6 if p.is_ipv6 else DpoProto.DPO_PROTO_IP4
VppIpRoute(self, p.remote_tun_if_host, p.addr_len,
def show_commands_at_teardown(self):
self.logger.info(self.vapi.ppcli("show l2fib verbose"))
- self.logger.info(self.vapi.ppcli("show bridge-domain 1 detail"))
+ # many tests delete bridge-domain 1 as the last task. don't output
+ # the details of a non-existent bridge-domain.
+ if self.vapi.l2_fib_table_dump(bd_id=1):
+ self.logger.info(self.vapi.ppcli("show bridge-domain 1 detail"))
def add_del_arp_term_hosts(self, entries, bd_id=1, is_add=1, is_ipv6=0):
for e in entries:
self.logger.info(self.vapi.cli("show punt stats"))
self.logger.info(self.vapi.cli("show punt db"))
- self.vapi.cli("test punt clear")
-
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
self.server_port]
def tearDown(self):
- self.cut_thru_tear_down()
super(LDPCutThruTestCase, self).tearDown()
+ self.cut_thru_tear_down()
def show_commands_at_teardown(self):
self.logger.debug(self.vapi.cli("show session verbose 2"))
self.server_port]
def tearDown(self):
- self.cut_thru_tear_down()
-
super(LDPIpv6CutThruTestCase, self).tearDown()
+ self.cut_thru_tear_down()
def test_ldp_ipv6_cut_thru_echo(self):
""" run LDP IPv6 cut thru echo test """
self.server_port]
def tearDown(self):
- self.cut_thru_tear_down()
-
super(VCLIpv6CutThruTestCase, self).tearDown()
+ self.cut_thru_tear_down()
def test_vcl_ipv6_cut_thru_echo(self):
""" run VCL IPv6 cut thru echo test """
}
+class CliFailedCommandError(Exception):
+ """ cli command failed."""
+
+
+class CliSyntaxError(Exception):
+ """ cli command had a syntax error."""
+
+
class UnexpectedApiReturnValueError(Exception):
""" exception raised when the API return value is unexpected """
pass
cli += '\n'
r = self.papi.cli_inband(cmd=cli)
self.hook.after_cli(cli)
+ if r.retval == -156:
+ raise CliSyntaxError(r.reply)
+ if r.retval != 0:
+ raise CliFailedCommandError(r.reply)
if hasattr(r, 'reply'):
return r.reply