# Path: cirque/common/cirquelog.py
# class CirqueLog:
# 
#   logger = None
# 
#   @classmethod
#   def setup_cirque_logger(cls, level=logging.INFO):
#     if cls.logger:
#       return
#     cls.logger = logging.getLogger('cirque')
#     cls.logger.setLevel(level)
#     sh = logging.StreamHandler()
#     sh.setFormatter(
#         logging.Formatter('%(asctime)s [%(name)s] %(levelname)s %(message)s'))
#     cls.logger.addHandler(sh)
# 
#   @classmethod
#   def get_cirque_logger(cls, name=None):
#     name = 'cirque' if not name else 'cirque.{}'.format(name)
#     return logging.getLogger(name)
# 
# Path: cirque/common/utils.py
# def sleep_time(logger, seconds, reason=None):
#   if reason:
#     reason = 'for ' + reason
#   logger.debug('sleeps {}s {}'.format(seconds, reason))
#   time.sleep(seconds)


import logging
import unittest
import os
import re
import time
import grpc
import cirque.proto.capability_pb2 as capability_pb2
import cirque.proto.device_pb2 as device_pb2
import cirque.proto.service_pb2 as service_pb2
import cirque.proto.service_pb2_grpc as service_pb2_grpc
from google.rpc import code_pb2, status_pb2
from cirque.proto.device_pb2 import DeviceSpecification
from cirque.common.cirquelog import CirqueLog
from cirque.common.utils import sleep_time
from cirque.proto.capability_pb2 import (WeaveCapability, ThreadCapability,
                                         WiFiCapability, XvncCapability,
                                         InteractiveCapability,
                                         LanAccessCapability)




DEVICE_CONFIG = {
    'device0': {
        'device_type': 'Generic Node',
        'base_image': 'generic_node_image',
        'wifi_capability': WiFiCapability(),
        'thread_capability': ThreadCapability(rcp_mode=True),
        'interactive_capability': InteractiveCapability()
    },
    'device1': {
        'device_type': 'GenericNode',
        'base_image': 'generic_node_image',
        'wifi_capability': WiFiCapability(),
        'thread_capability': ThreadCapability(rcp_mode=True),
        'interactive_capability': InteractiveCapability()
    },
    'wifi-ap': {
        'device_type': 'wifi_ap',
        'base_image': 'mac80211_ap_image',
    }
}


class TestGrpcVirtualHome(unittest.TestCase):

  @classmethod
  def setUpClass(cls):

# Path: cirque/common/cirquelog.py
# class CirqueLog:
# 
#   logger = None
# 
#   @classmethod
#   def setup_cirque_logger(cls, level=logging.INFO):
#     if cls.logger:
#       return
#     cls.logger = logging.getLogger('cirque')
#     cls.logger.setLevel(level)
#     sh = logging.StreamHandler()
#     sh.setFormatter(
#         logging.Formatter('%(asctime)s [%(name)s] %(levelname)s %(message)s'))
#     cls.logger.addHandler(sh)
# 
#   @classmethod
#   def get_cirque_logger(cls, name=None):
#     name = 'cirque' if not name else 'cirque.{}'.format(name)
#     return logging.getLogger(name)
# 
# Path: cirque/common/utils.py
# def sleep_time(logger, seconds, reason=None):
#   if reason:
#     reason = 'for ' + reason
#   logger.debug('sleeps {}s {}'.format(seconds, reason))
#   time.sleep(seconds)


# Path: examples/test_grpc_virtual_home.py
import logging
import unittest
import os
import re
import time
import grpc
import cirque.proto.capability_pb2 as capability_pb2
import cirque.proto.device_pb2 as device_pb2
import cirque.proto.service_pb2 as service_pb2
import cirque.proto.service_pb2_grpc as service_pb2_grpc
from google.rpc import code_pb2, status_pb2
from cirque.proto.device_pb2 import DeviceSpecification
from cirque.common.cirquelog import CirqueLog
from cirque.common.utils import sleep_time
from cirque.proto.capability_pb2 import (WeaveCapability, ThreadCapability,
                                         WiFiCapability, XvncCapability,
                                         InteractiveCapability,
                                         LanAccessCapability)





DEVICE_CONFIG = {
    'device0': {
        'device_type': 'Generic Node',
        'base_image': 'generic_node_image',
        'wifi_capability': WiFiCapability(),
        'thread_capability': ThreadCapability(rcp_mode=True),
        'interactive_capability': InteractiveCapability()
    },
    'device1': {
        'device_type': 'GenericNode',
        'base_image': 'generic_node_image',
        'wifi_capability': WiFiCapability(),
        'thread_capability': ThreadCapability(rcp_mode=True),
        'interactive_capability': InteractiveCapability()
    },
    'wifi-ap': {
        'device_type': 'wifi_ap',
        'base_image': 'mac80211_ap_image',
    }
}


class TestGrpcVirtualHome(unittest.TestCase):

  @classmethod
  def setUpClass(cls):

    CirqueLog.setup_cirque_logger(level=logging.INFO)