Exemplo n.º 1
0
def Teardown(tc):
    if tc.is_config_updated:
        rs = config_api.RestoreObjects('Update', tc.selected_objs)
        if rs is False:
            api.Logger.error(
                f"Teardown failed to restore objs from Update operation: {rs}")
    if tc.is_config_deleted:
        rs = config_api.RestoreObjects('Delete', tc.selected_objs)
        if rs is False:
            api.Logger.error(
                f"Teardown failed to restore objs from Delete operation: {rs}")
        h2h_test = getattr(tc.args, "h2h_test", False)
        if h2h_test:
            if not arp_utils.SendGratArp(api.GetWorkloads()):
                api.Logger.error(
                    f"Teardown failed to send ARP to all workloads")
            else:
                api.Logger.info("Running overlay connectivity test")
                cmd_cookies, resp = conn_utils.TriggerConnectivityTestAll(
                    proto="icmp", sec_ip_test_type="random")
                ret = conn_utils.VerifyConnectivityTest(
                    "icmp", cmd_cookies, resp)
                if ret != api.types.status.SUCCESS:
                    api.Logger.error("Connectivity verification failed.")
    return api.types.status.SUCCESS
Exemplo n.º 2
0
def Teardown(tc):
    if tc.is_config_updated:
        rs = config_api.RestoreObjects("Update", tc.selected_objs)
        if rs is False:
            api.Logger.error(
                f"Teardown failed to restore objs from Update operation: {rs}")
    if tc.is_config_deleted:
        rs = config_api.RestoreObjects("Delete", tc.selected_objs)
        if rs is False:
            api.Logger.error(
                f"Teardown failed to restore objs from Delete operation: {rs}")
    return flow_utils.clearFlowTable(tc.workload_pairs)
Exemplo n.º 3
0
def Teardown(tc):
    if tc.is_config_updated:
        rs = config_api.RestoreObjects('Update', tc.selected_objs)
        if rs is False:
            api.Logger.error(
                f"Teardown failed to restore objs from Update operation: {rs}")
    if tc.is_config_deleted:
        rs = config_api.RestoreObjects('Delete', tc.selected_objs)
        if rs is False:
            api.Logger.error(
                f"Teardown failed to restore objs from Delete operation: {rs}")
    rs = conn_utils.ConnectivityTest(tc.workload_pairs, ['icmp'],
                                     [tc.iterators.ipaf], [64], 0)
    api.Logger.info(f"Teardown result: {rs}")
    return rs
Exemplo n.º 4
0
def configRestoreTrigger(tc):
    res = api.types.status.SUCCESS
    if tc.is_config_deleted:
        api.Logger.info("configRestoreTrigger for %s" % tc.obj_sel)
        rs = config_api.RestoreObjects('Delete', tc.selected_objs)
        if rs is False:
            api.Logger.error(f"config restore operation failed : {rs}")
            res = api.types.status.FAILURE
    return res
Exemplo n.º 5
0
def configRestoreTrigger(tc):
    res = api.types.status.SUCCESS
    if tc.is_config_deleted:
        api.Logger.debug("configRestoreTrigger oper: %s for objtype: %s" %
                         (tc.opers, tc.obj_sel))
        rs = config_api.RestoreObjects('Delete', tc.selected_objs)
        if rs is False:
            api.Logger.error(f"configRestoreTrigger operation failed : {rs}")
            res = api.types.status.FAILURE
    api.Logger.debug(
        "configRestoreTrigger:%s for %s completed with result: %s" %
        (tc.is_config_deleted, tc.obj_sel, res))
    return res