% (vm_source.name, vm_target.name))
if expected == "PASS":
logger.debug("[PASS] %s" % msg)
- self.add_to_summary(2, "PASS", test_case_name)
+ self.add_success(test_case_name)
else:
logger.debug("[FAIL] %s" % msg)
self.test_result = "FAIL"
- self.add_to_summary(2, "FAIL", test_case_name)
+ self.add_failure(test_case_name)
logger.debug("\n%s" % last_n_lines)
break
elif ("ping %s KO" % ip_target) in last_n_lines:
(vm_source.name, vm_target.name))
if expected == "FAIL":
logger.debug("[PASS] %s" % msg)
- self.add_to_summary(2, "PASS", test_case_name)
+ self.add_success(test_case_name)
else:
logger.debug("[FAIL] %s" % msg)
self.test_result = "FAIL"
- self.add_to_summary(2, "FAIL", test_case_name)
+ self.add_failure(test_case_name)
break
time.sleep(1)
timeout -= 1
logger.debug("[FAIL] Timeout reached for '%s'. "
"No ping output captured in the console log"
% vm_source.name)
- self.add_to_summary(2, "FAIL", test_case_name)
+ self.add_failure(test_case_name)
break
def add_to_summary(self, num_cols, col1, col2=""):
if col1 == "FAIL":
self.num_tests_failed += 1
+ def record_action(self, msg):
+ """Record and log an action and display it in the summary."""
+ logger.info(msg)
+ self.add_to_summary(1, msg)
+
+ def add_failure(self, test):
+ self.add_to_summary(2, "FAIL", test)
+
+ def add_success(self, test):
+ self.add_to_summary(2, "PASS", test)
+
def check_ssh_output(self, vm_source, ip_source,
vm_target, ip_target,
expected, timeout=30):
last_n_lines = lines[-5:]
if ("%s %s" % (ip_target, expected)) in last_n_lines:
logger.debug("[PASS] %s" % test_case_name)
- self.add_to_summary(2, "PASS", test_case_name)
+ self.add_success(test_case_name)
break
elif ("%s not reachable" % ip_target) in last_n_lines:
logger.debug("[FAIL] %s" % test_case_name)
- self.add_to_summary(2, "FAIL", test_case_name)
+ self.add_failure(test_case_name)
self.test_result = "FAIL"
break
time.sleep(1)
logger.debug("[FAIL] Timeout reached for '%s'."
" No ping output captured in the console log"
% vm_source.name)
- self.add_to_summary(2, "FAIL", test_case_name)
+ self.add_failure(test_case_name)
break
def compile_summary(self, SUCCESS_CRITERIA):
vm_1_ip = vm_1.networks.itervalues().next()[0]
msg = ("Create VPN with eRT<>iRT")
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
vpn_name = "sdnvpn-" + str(randint(100000, 999999))
kwargs = {
"import_targets": TESTCASE_CONFIG.targets1,
logger.debug("VPN created details: %s" % bgpvpn)
msg = ("Associate network '%s' to the VPN." % TESTCASE_CONFIG.net_1_name)
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
os_utils.create_network_association(
expected="FAIL", timeout=30)
msg = ("Associate network '%s' to the VPN." % TESTCASE_CONFIG.net_2_name)
- logger.info(msg)
results.add_to_summary(0, "-")
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
os_utils.create_network_association(
neutron_client, bgpvpn_id, network_2_id)
expected="FAIL", timeout=30)
msg = ("Update VPN with eRT=iRT ...")
- logger.info(msg)
results.add_to_summary(0, "-")
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
"export_targets": TESTCASE_CONFIG.targets1,
vm_1_ip = vm_1.networks.itervalues().next()[0]
msg = ("Create VPN1 with eRT=iRT")
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
vpn1_name = "sdnvpn-1-" + str(randint(100000, 999999))
kwargs = {"import_targets": TESTCASE_CONFIG.targets2,
"export_targets": TESTCASE_CONFIG.targets2,
logger.debug("VPN1 created details: %s" % bgpvpn1)
msg = ("Associate network '%s' to the VPN." % TESTCASE_CONFIG.net_1_name)
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
os_utils.create_network_association(
results.add_to_summary(0, "-")
msg = ("Create VPN2 with eRT=iRT")
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
vpn2_name = "sdnvpn-2-" + str(randint(100000, 999999))
kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
"export_targets": TESTCASE_CONFIG.targets1,
logger.debug("VPN created details: %s" % bgpvpn2)
msg = ("Associate network '%s' to the VPN2." % TESTCASE_CONFIG.net_2_name)
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
os_utils.create_network_association(
vm_1_ip = vm_1.networks.itervalues().next()[0]
msg = ("Create VPN with eRT<>iRT")
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
vpn_name = "sdnvpn-" + str(randint(100000, 999999))
kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
"export_targets": TESTCASE_CONFIG.targets2,
logger.debug("VPN created details: %s" % bgpvpn)
msg = ("Associate router '%s' to the VPN." % TESTCASE_CONFIG.router_1_name)
- logger.info(msg)
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
os_utils.create_router_association(
expected="FAIL", timeout=30)
msg = ("Associate network '%s' to the VPN." % TESTCASE_CONFIG.net_2_name)
- logger.info(msg)
results.add_to_summary(0, "-")
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
os_utils.create_network_association(
neutron_client, bgpvpn_id, network_2_id)
expected="FAIL", timeout=30)
msg = ("Update VPN with eRT=iRT ...")
- logger.info(msg)
results.add_to_summary(0, "-")
- results.add_to_summary(1, msg)
+ results.record_action(msg)
results.add_to_summary(0, "-")
kwargs = {"import_targets": TESTCASE_CONFIG.targets1,
"export_targets": TESTCASE_CONFIG.targets1,