Commit 92ec3bf1 authored by Qasim Lone's avatar Qasim Lone

initial commit

parent e3977cbb

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
\ No newline at end of file
include README.md
include bin/config.yaml
WiSHFUL Node Agent Framework
============================
This is a prototypic implementation of a wireless agent providing the Unified
Programming Interfaces (UPIs) of the Wishful software platform for
radio and network control.
## Acknowledgement
The research leading to these results has received funding from the European
Horizon 2020 Programme under grant agreement n645274 (WiSHFUL project).
from setuptools import setup, find_packages
def readme():
with open('README.md') as f:
return f.read()
setup(
name='wishful_agent',
version='0.1.0',
packages=find_packages(),
url='http://www.wishful-project.eu/software',
license='',
author='Piotr Gawlowicz, Mikolaj Chwalisz',
author_email='{gawlowicz, chwalisz}@tkn.tu-berlin.de',
description='WiSHFUL Agent Implementation Framework',
long_description='Implementation of a wireless agent using the unified programming interfaces (UPIs) of the Wishful project.',
keywords='wireless control',
install_requires=['pyzmq', 'apscheduler', 'dill']
)
from .agent import *
from .local_controller import *
from .local_control_module import *
\ No newline at end of file
import logging
import time
import sys
import datetime
import uuid
from apscheduler.schedulers.background import BackgroundScheduler
import wishful_framework as msgs
from .transport_channel import TransportChannel, get_ip_address
from .controller_monitor import ControllerMonitor
from .module_manager import ModuleManager
from .local_controller import LocalController
from .local_control_module import LocalControlModule
__author__ = "Piotr Gawlowicz, Mikolaj Chwalisz"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "{gawlowicz, chwalisz}@tkn.tu-berlin.de"
class Agent(object):
def __init__(self, local=False):
self.log = logging.getLogger("{module}.{name}".format(
module=self.__class__.__module__, name=self.__class__.__name__))
self.local = local
self.config = None
self.uuid = str(uuid.uuid4())
self.name = None
self.info = None
self.iface = None
self.ip = None
self.capabilities = None
apscheduler_logger = logging.getLogger('apscheduler')
apscheduler_logger.setLevel(logging.CRITICAL)
self.jobScheduler = BackgroundScheduler()
self.jobScheduler.start()
self.moduleManager = ModuleManager(self)
if not self.local:
self.controllerMonitor = ControllerMonitor(self)
self.transport = TransportChannel(self)
self.transport.set_recv_callback(self.process_msgs)
localControlProgramManager = LocalControlModule()
self.moduleManager.add_local_control_program_manager(localControlProgramManager)
else:
self.local_controller = LocalController()
self.local_controller.set_agent(self)
def get_local_controller(self):
assert self.local_controller, "Start agent in local mode"
return self.local_controller
def set_agent_info(self, name=None, info=None, iface=None, ip=None):
self.name = name
self.info = info
self.iface = iface
self.ip = ip
if self.ip == None and self.iface:
self.ip = get_ip_address(self.iface)
def add_module_obj(self, moduleName, moduleObj):
return self.moduleManager.add_module_obj(moduleName, moduleObj)
def add_module(self, moduleName, pyModule, className, interfaces=None, kwargs={}):
return self.moduleManager.add_module(moduleName, pyModule, className, interfaces, kwargs)
def load_config(self, config):
self.log.debug("Config: {0}".format(config))
agent_info = config['agent_info']
if 'name' in agent_info:
self.name = agent_info['name']
if 'info' in agent_info:
self.info = agent_info['info']
if 'iface' in agent_info:
self.iface = agent_info['iface']
self.ip = get_ip_address(self.iface)
#load modules
moduleDesc = config['modules']
for m_name, m_params in moduleDesc.items():
supported_interfaces = None
if 'interfaces' in m_params:
supported_interfaces=