# Path: shapy/framework/executor.py
# def run(command, **kwargs):
# def get_command(name, **kwargs):
#     def __init__(self, **kwargs):
#     def __setitem__(self, key, item):
#     def __getitem__(self, key):
#     def cmd(self):
#     def get(self):
#     def get_context(self):
#     def get_interface(self):
#     def execute(self):
# class Executable(object):
# 
# Path: shapy/framework/utils.py
# def validate_ip(addr):
# def validate_full_ip(ip):
# def align(l, alignto=4):
# def convert_handle(handle):
# def get_if_index(if_name):
# def nl_us2ticks(delay):
# def nl_ticks2us(ticks):
# def convert_to_bytes(rate):
#     def register(cls, interpreter, content_types):
#     def select(cls, selector):
# class InterpreterMixin(object):


import logging
from shapy.framework import executor, utils
            self.__traverse_tree(self.root)
    
    def teardown(self):
        """
        Tears down all custom qdiscs, classes and filters on this interface.
        """
        cmd_e = executor.get_command('TCInterfaceTeardown', interface=self.name,
                                   handle='root')
        cmd_i = executor.get_command('TCInterfaceTeardown', interface=self.name,
                                   handle='ingress')
        executor.run(cmd_e)
        executor.run(cmd_i)
        
    def __traverse_tree(self, element):
        logger.debug("Interface '{0!s}' executing {1}"\
                     .format(self, element.__class__.__name__))
        element.execute()
        for ch in element.children:
            self.__traverse_tree(ch)


class IFB(Interface, executor.Executable):
    module_loaded = False
    
    def __init__(self, name):
        executor.Executable.__init__(self)
        self.name = name
        #Interface.__init__(self, name)

    def set_shaping(self):

# Path: shapy/framework/executor.py
# def run(command, **kwargs):
# def get_command(name, **kwargs):
#     def __init__(self, **kwargs):
#     def __setitem__(self, key, item):
#     def __getitem__(self, key):
#     def cmd(self):
#     def get(self):
#     def get_context(self):
#     def get_interface(self):
#     def execute(self):
# class Executable(object):
# 
# Path: shapy/framework/utils.py
# def validate_ip(addr):
# def validate_full_ip(ip):
# def align(l, alignto=4):
# def convert_handle(handle):
# def get_if_index(if_name):
# def nl_us2ticks(delay):
# def nl_ticks2us(ticks):
# def convert_to_bytes(rate):
#     def register(cls, interpreter, content_types):
#     def select(cls, selector):
# class InterpreterMixin(object):


# Path: shapy/framework/interface.py
import logging
from shapy.framework import executor, utils

            self.__traverse_tree(self.root)
    
    def teardown(self):
        """
        Tears down all custom qdiscs, classes and filters on this interface.
        """
        cmd_e = executor.get_command('TCInterfaceTeardown', interface=self.name,
                                   handle='root')
        cmd_i = executor.get_command('TCInterfaceTeardown', interface=self.name,
                                   handle='ingress')
        executor.run(cmd_e)
        executor.run(cmd_i)
        
    def __traverse_tree(self, element):
        logger.debug("Interface '{0!s}' executing {1}"\
                     .format(self, element.__class__.__name__))
        element.execute()
        for ch in element.children:
            self.__traverse_tree(ch)


class IFB(Interface, executor.Executable):
    module_loaded = False
    
    def __init__(self, name):
        executor.Executable.__init__(self)
        self.name = name
        #Interface.__init__(self, name)

    def set_shaping(self):

        self.if_index = utils.get_if_index(self.name)