Esempio n. 1
0
def enable_nat_docker(request, duthost):
    """
    enable NAT Docker on teardown
    :param request: pytest request object
    :param duthost: DUT host object
    """
    yield
    if request.node.rep_call.failed:
        exec_command(duthost, ["sudo docker start nat"])
Esempio n. 2
0
def teardown(duthost):
    """
    Teardown procedure for all test function
    :param duthost: DUT host object
    """
    yield
    # Teardown after test finished
    shutdown_cmds = ["sudo config nat remove {}".format(cmd) for cmd in ["static all", "bindings", "pools", "interfaces"]]
    exec_command(duthost, shutdown_cmds)
    # Clear all enries
    duthost.command("sudo sonic-clear nat translations")