# Path: firelet/flssh.py
# def timeit(method):
#     def timed(*args, **kw):
#     def __init__(self, target, args_list, timeout=5, logger=log):
#         def wrapper(*args, **kwargs):
#     def __init__(self, targets=None, username='firelet',
#         ssh_key_autoadd=True, password=None):
#     def _connect_one(self, hostname, addrs):
#     def _connect(self):
#     def __del__(self):
#     def _disconnect(self):
#     def _execute(self, hostname, cmd, get_output=True):
#     def _get_conf(self, confs, hostname, username):
#     def get_confs(self, keep_sessions=False, logger=log):
#     def _extract_iptables_save_nat(self, li):
#     def parse_iptables_save(self, li, hostname=None):
#         def _rules(x):
#     def _is_interface(self, s):
#     def parse_ip_addr_show(self, s):
#     def _deliver_conf(self, status, hostname, username, block):
#     def deliver_confs(self, newconfs_d):
#     def _save_existing_conf(self, status, hostname, username):
#     def save_existing_confs(self, keep_sessions=False):
#     def _setup_auto_rollback(self, status, hostname, username):
#     def setup_auto_rollbacks(self, keep_sessions=False):
#     def _cancel_auto_rollback(self, status, hostname, username):
#     def cancel_auto_rollbacks(self, keep_sessions=False):
#     def _apply_remote_conf(self, status, hostname, username):
#     def apply_remote_confs(self, keep_sessions=False):
#     def _log_ping(self, status, hostname, username):
#     def log_ping(self):
#     def _connect_one(self, hostname, addrs):
#     def _disconnect(self):
#     def _execute(self, hostname, s, get_output=True):
# class Forker(object):
# class SSHConnector(object):
# class MockSSHConnector(SSHConnector):


from firelet import flssh
from nose.tools import assert_raises, with_setup
import shutil
# Firelet - Distributed firewall management.
# Copyright (C) 2010 Federico Ceratto
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.




# #  Testing flssh module locally # #

def test_sshconnector_getconf():
    # {hostname: [management ip address list ], ... }
    t = {'localhost':['127.0.0.1', ]}
    sx = flssh.SSHConnector(targets=t, username='root')
    confs = sx.get_confs()
    print repr(confs)


# Path: firelet/flssh.py
# def timeit(method):
#     def timed(*args, **kw):
#     def __init__(self, target, args_list, timeout=5, logger=log):
#         def wrapper(*args, **kwargs):
#     def __init__(self, targets=None, username='firelet',
#         ssh_key_autoadd=True, password=None):
#     def _connect_one(self, hostname, addrs):
#     def _connect(self):
#     def __del__(self):
#     def _disconnect(self):
#     def _execute(self, hostname, cmd, get_output=True):
#     def _get_conf(self, confs, hostname, username):
#     def get_confs(self, keep_sessions=False, logger=log):
#     def _extract_iptables_save_nat(self, li):
#     def parse_iptables_save(self, li, hostname=None):
#         def _rules(x):
#     def _is_interface(self, s):
#     def parse_ip_addr_show(self, s):
#     def _deliver_conf(self, status, hostname, username, block):
#     def deliver_confs(self, newconfs_d):
#     def _save_existing_conf(self, status, hostname, username):
#     def save_existing_confs(self, keep_sessions=False):
#     def _setup_auto_rollback(self, status, hostname, username):
#     def setup_auto_rollbacks(self, keep_sessions=False):
#     def _cancel_auto_rollback(self, status, hostname, username):
#     def cancel_auto_rollbacks(self, keep_sessions=False):
#     def _apply_remote_conf(self, status, hostname, username):
#     def apply_remote_confs(self, keep_sessions=False):
#     def _log_ping(self, status, hostname, username):
#     def log_ping(self):
#     def _connect_one(self, hostname, addrs):
#     def _disconnect(self):
#     def _execute(self, hostname, s, get_output=True):
# class Forker(object):
# class SSHConnector(object):
# class MockSSHConnector(SSHConnector):


# Path: tests/test_local.py
from firelet import flssh
from nose.tools import assert_raises, with_setup
import shutil

# Firelet - Distributed firewall management.
# Copyright (C) 2010 Federico Ceratto
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.




# #  Testing flssh module locally # #

def test_sshconnector_getconf():
    # {hostname: [management ip address list ], ... }
    t = {'localhost':['127.0.0.1', ]}
    sx = flssh.SSHConnector(targets=t, username='root')
    confs = sx.get_confs()
    print repr(confs)


    assert 'localhost' in confs