# Path: sts/util/convenience.py
# def object_fullname(obj):
#   """Return the fullname of an object"""
#   return obj.__module__ + "." + obj.__class__.__name__
# 
# Path: sts/util/convenience.py
# def class_fullname(cls):
#   """Return the fullname of a class"""
#   return cls.__module__ + "." + cls.__name__
# 
# Path: sts/util/convenience.py
# def load_class(str_full_type):
#   """
#   Load a python class given full qualified name.
#   """
#   type_s = str_full_type.split('.')
#   mod = importlib.import_module('.'.join(type_s[:-1]))
#   cls = getattr(mod, type_s[-1])
#   return cls


import abc
import logging
import sts.util.network_namespace as ns
from itertools import count
from pox.openflow.software_switch import DpPacketOut
from pox.lib.revent import EventMixin
from pox.lib.packet.ethernet import ethernet
from pox.lib.packet.ipv4 import ipv4
from pox.lib.packet.tcp import tcp
from pox.lib.packet.arp import arp
from pox.lib.addresses import EthAddr
from pox.lib.addresses import IPAddr
from sts.util.convenience import object_fullname
from sts.util.convenience import class_fullname
from sts.util.convenience import load_class
  @property
  def hid(self):
    return self._hid

  @abc.abstractmethod
  def send(self, interface, packet):
    """
    Send packet on a specific interface.
    """
    raise NotImplementedError()

  @abc.abstractmethod
  def receive(self, interface, packet):
    """
    Receive a packet from a specific interface.
    """
    raise NotImplementedError()

  def has_port(self, port):
    """Return True if the port is one of the interfaces"""
    return port in self.interfaces

  def __str__(self):
    return "%s (%d)" % (self.name, self.hid)

  def __repr__(self):
    return "Host(%d)" % self.hid

  def to_json(self):
    """Serialize to JSON dict"""

# Path: sts/util/convenience.py
# def object_fullname(obj):
#   """Return the fullname of an object"""
#   return obj.__module__ + "." + obj.__class__.__name__
# 
# Path: sts/util/convenience.py
# def class_fullname(cls):
#   """Return the fullname of a class"""
#   return cls.__module__ + "." + cls.__name__
# 
# Path: sts/util/convenience.py
# def load_class(str_full_type):
#   """
#   Load a python class given full qualified name.
#   """
#   type_s = str_full_type.split('.')
#   mod = importlib.import_module('.'.join(type_s[:-1]))
#   cls = getattr(mod, type_s[-1])
#   return cls


# Path: sts/entities/hosts.py
import abc
import logging
import sts.util.network_namespace as ns
from itertools import count
from pox.openflow.software_switch import DpPacketOut
from pox.lib.revent import EventMixin
from pox.lib.packet.ethernet import ethernet
from pox.lib.packet.ipv4 import ipv4
from pox.lib.packet.tcp import tcp
from pox.lib.packet.arp import arp
from pox.lib.addresses import EthAddr
from pox.lib.addresses import IPAddr
from sts.util.convenience import object_fullname
from sts.util.convenience import class_fullname
from sts.util.convenience import load_class

  @property
  def hid(self):
    return self._hid

  @abc.abstractmethod
  def send(self, interface, packet):
    """
    Send packet on a specific interface.
    """
    raise NotImplementedError()

  @abc.abstractmethod
  def receive(self, interface, packet):
    """
    Receive a packet from a specific interface.
    """
    raise NotImplementedError()

  def has_port(self, port):
    """Return True if the port is one of the interfaces"""
    return port in self.interfaces

  def __str__(self):
    return "%s (%d)" % (self.name, self.hid)

  def __repr__(self):
    return "Host(%d)" % self.hid

  def to_json(self):
    """Serialize to JSON dict"""

    return {'__type__': object_fullname(self),