# Path: shakedown/dcos/network.py
# def restore_iptables(host):
# def save_iptables(host):
# def run_iptables(host, rule):
# def flush_all_rules(host):
# def allow_all_traffic(host):
# def iptable_rules(host):


from shakedown import *
from dcos import (marathon, mesos)
from shakedown.dcos import network
import os
import pytest

    agent_list = []
    agents = __get_all_agents()
    for agent in agents:
        agent_list.append(agent["hostname"])

    return agent_list


def __get_all_agents():
    """Provides all agent json in the cluster which can be used for filtering"""

    client = mesos.DCOSClient()
    agents = client.get_state_summary()['slaves']
    return agents

ALLOW_SSH = '-I INPUT -p tcp --dport 22 -j ACCEPT'
ALLOW_PING = '-I INPUT -p icmp -j ACCEPT'
DISALLOW_MESOS = '-I OUTPUT -p tcp --sport 5051  -j REJECT'
DISALLOW_INPUT = '-A INPUT -j REJECT'


def partition_agent(host):
    """ Partition a node from all network traffic except for SSH and loopback

        :param hostname: host or IP of the machine to partition from the cluster
    """

    network.save_iptables(host)
    network.flush_all_rules(host)

# Path: shakedown/dcos/network.py
# def restore_iptables(host):
# def save_iptables(host):
# def run_iptables(host, rule):
# def flush_all_rules(host):
# def allow_all_traffic(host):
# def iptable_rules(host):


# Path: shakedown/dcos/agent.py
from shakedown import *
from dcos import (marathon, mesos)
from shakedown.dcos import network
import os
import pytest


    agent_list = []
    agents = __get_all_agents()
    for agent in agents:
        agent_list.append(agent["hostname"])

    return agent_list


def __get_all_agents():
    """Provides all agent json in the cluster which can be used for filtering"""

    client = mesos.DCOSClient()
    agents = client.get_state_summary()['slaves']
    return agents

ALLOW_SSH = '-I INPUT -p tcp --dport 22 -j ACCEPT'
ALLOW_PING = '-I INPUT -p icmp -j ACCEPT'
DISALLOW_MESOS = '-I OUTPUT -p tcp --sport 5051  -j REJECT'
DISALLOW_INPUT = '-A INPUT -j REJECT'


def partition_agent(host):
    """ Partition a node from all network traffic except for SSH and loopback

        :param hostname: host or IP of the machine to partition from the cluster
    """

    network.save_iptables(host)
    network.flush_all_rules(host)

    network.allow_all_traffic(host)