diff --git a/Danilo_Denis_Eloisa_Rener_Vinicius.txt b/Danilo_Denis_Eloisa_Rener_Vinicius.txt new file mode 100644 index 00000000..54a0e7ed --- /dev/null +++ b/Danilo_Denis_Eloisa_Rener_Vinicius.txt @@ -0,0 +1,40 @@ +RESUMO DE ATIVIDADES + +- Criamos um script para instalação do Couchbase (é o arquivo 'couchbase-server.sh'). +- Criamos um script para instalação da biblioteca e dependências para desenvolver com o Couchbase (é o arquivo 'couchbase-dev.sh'). +- Criamos a classe CouchIPC.py (responsável pela conexão com o novo banco de dados e que substitui o MongoIPC.py). +- Retiramos as conversões de dados para/de bson para json (necessário no Mongo e não mais necessário). +- Alteramos as referências do rfserver e o rfproxy para utilizar o CouchIPC + + + +Alteramos os arquivos necessários para fazer o script rftest2 funcionar com o novo BD. + +Para funcionar, é necessário: + +1 - Instalar o Couchbase (mais informações em ). +2 - Criar um bucket com o nome 'routeflow' (pode ser outro nome. Mais instruções no passo 5). +3 - Instalar o Couchbase nos demais servidores que farão parte do cluster através da opção 'Join cluster now' (mais informações em http://www.couchbase.com/docs/couchbase-manual-1.8/couchbase-getting-started-setup.html>), adicionando usuário, senha e IP do servidor principal (aquele dos passos 1 e 2). +4 - O Couchbase possui uma interface (HTTP) para configuração e manipulação dos dados. Basta acessar o servidor local na porta 8091. Na aba 'Server Nodes', clicar em 'Rebalance' para balancear o uso de cada nó (mais informações em ). +5 - O arquivo rflib/defs.py possui os arquivos de configurações para conexão com o banco de dados. Lembre-se de colocar os IPs das máquinas em cluster na variável COUCH_HOST (exemplo: ["192.168.70.128", "192.168.70.129"]), o nome do Bucket criado na variável COUCH_BUCKET e o valor 0 na variável COUCH_INITIAL_VALUE (que é o valor inicial da chave do conteúdo que será inserido no BD). +6 - View + Para as pesquisas foram criadas views que consistem em funções de javascript para map dos dados dentro do CouchBase, as views são criadas dentro da interface web do CouchBase. Pode ser encontrado um guia para criação de view em + Foram criadas 2 views: + - com o nome "filter": + function (doc, meta) { + if (meta.type == "base64") { + emit("base64", doc) + } + else { + if (doc.read == false) { + emit(meta.id, doc); + } + } + } + + - com o nome "all": + function (doc, meta) { + emit(meta.id, doc) + } + + É necessário publicá-las (clicando em publish) para que o código tenha acesso à elas e funcione corretamente. diff --git a/README-RouteFlow.md b/README-RouteFlow.md new file mode 100644 index 00000000..76bac1d1 --- /dev/null +++ b/README-RouteFlow.md @@ -0,0 +1,154 @@ +# Welcome +This version of RouteFlow is a beta developers' release intended to evaluate RouteFlow for providing virtualized IP routing services on one or more OpenFlow switches. + +You can learn more about RouteFlow in our [main page in GitHub](http://cpqd.github.com/RouteFlow/) and in our [website](https://sites.google.com/site/routeflow/). + +Please be aware of POX, OpenFlow, Open vSwitch, Quagga, MongoDB, jQuery, JIT and RouteFlow licenses and terms. + +# Distribution overview +RouteFlow is a distribution composed by three basic applications: RFClient, RFServer and RFProxy. + +* RFClient runs as a daemon in the Virtual Machine (VM), detecting changes in the Linux ARP and routing tables. Routing information is sent to the RFServer when there's an update. + +* RFServer is a standalone application that manages the VMs running the RFClient daemons. The RFServer keeps the mapping between the RFClient VM instances and interfaces and the corresponding switches and ports. It connects to RFProxy to instruct it about when to configure flows and also to configure the Open vSwitch to maintain the connectivity in the virtual environment formed by the set of VMs. + +* RFProxy is an application (for POX and other controllers) responsible for the interactions with the OpenFlow switches (identified by datapaths) via the OpenFlow protocol. It listens to instructions from the RFServer and notifies it about events in the network. We recommend running POX when you are experimenting and testing your network. Other implementations in different controllers will be available soon. + +There is also a library of common functions (rflib). It has implementations of the IPC, utilities like custom types for IP and MAC addresses manipulation and OpenFlow message creation. + +Additionally, there's `rfweb`, an extra module that provides an web interface for RouteFlow. + +``` +The RouteFlow Architecture + ++--------VM---------+ +| Quagga | RFClient | ++-------------------+ + \ +M:1 \ RFProtocol + \ ++-------------------+ +| RFServer | ++-------------------+ + \ +1:1 \ RFProtocol + \ ++-------------------+ +| RFProxy | +|-------------------| +| Controller | ++-------------------+ + \ +1:N \ OpenFlow Protocol + \ ++-------------------+ +| OpenFlow Switch | ++-------------------+ +``` + +# Building + +RouteFlow runs on Ubuntu 12.04. + +1. Install the dependencies: +``` +sudo apt-get install build-essential git libboost-dev \ + libboost-program-options-dev libboost-thread-dev \ + libboost-filesystem-dev iproute-dev openvswitch-switch \ + mongodb python-pymongo +``` + +2. Clone RouteFlow's repository on GitHub: +``` +$ git clone git://github.com/CPqD/RouteFlow.git +``` + +3. Build `rfclient` +``` +make rfclient +``` + +That's it! Now you can run tests 1 and 2. The setup to run them is described in the "Running" section. + +# Running +The folder rftest contains all that is needed to create and run two test cases. + +## Virtual environment +First, create the default LXC containers that will run as virtual machines: +``` +$ cd rftest +$ sudo ./create +``` +The containers will have a default ubuntu/ubuntu user/password combination. **You should change that if you plan to deploy RouteFlow**. + +By default, the tests below will use the LXC containers created by the `create` script. You can use other virtualization technologies. If you have experience with or questions about setting up RouteFlow on a particular technology, contact us! See the "Support" section. + +## Test cases + +Default configuration files are provided for these tests in the `rftest` directory (you don't need to change anything). +You can stops them at any time by pressing CTRL+C. + +### rftest1 +1. Run: +``` +$ sudo ./rftest1 +``` + +2. You can then log in to the LXC container b1 and try to ping b2: +``` +$ sudo lxc-console -n b1 +``` + +3. Inside b1, run: +``` +# ping 172.31.2.2 +``` + +For more details on this test, see its [tutorial](https://github.com/CPqD/RouteFlow/wiki/Tutorial-1:-rftest1). + +### rftest2 +This test should be run with a [Mininet](http://mininet.org/) simulated network. +In the steps below, replace [guest address] with the IP address you use to access your Mininet VM. +The same applies to [host address], that should be the address to access the host from inside the VM. + +1. Run: +``` +$ sudo ./rftest2 +``` + +2. Once you have a Mininet VM up and running, copy the network topology files in rftest to the VM: +``` +$ scp topo-4sw-4host.py mininet@[guest address]:/home/mininet/mininet/custom +$ scp ipconf mininet@[guest address]:/home/mininet +``` + +3. Then start the network: +``` +$ sudo mn --custom mininet/custom/topo-4sw-4host.py --topo=rftest2 --controller=remote,ip=[host address],port=6633 --pre=ipconf +``` + +Wait for the network to converge (it should take a few seconds), and try to ping: +``` +mininet> pingall +... +mininet> h2 ping h3 +``` + +For more details on this test, see its [tutorial](https://github.com/CPqD/RouteFlow/wiki/Tutorial-2:-rftest2). + + +# Now what? +If you want to use the web interface to inspect RouteFlow behavior, see the wiki page on [rfweb](https://github.com/CPqD/RouteFlow/wiki/The-web-interface). + +If you want to create your custom configurations schemes for a given setup, check out the [configuration section of the first tutorial](https://github.com/CPqD/RouteFlow/wiki/Tutorial-1:-rftest1#configuration-file) and the guide on [how to create your virtual environment](https://github.com/CPqD/RouteFlow/wiki/Virtual-environment-creation). + +If you're developing for RouteFlow, there are more advanced options and components that can be installed through the `build.sh` script. See its [source](https://github.com/CPqD/RouteFlow/blob/master/build.sh) for more information. + + +# Support +If you want to know more or need to contact us regarding the project for anything (questions, suggestions, bug reports, discussions about RouteFlow and SDN in general) you can use the following resources: +* RouteFlow repository [wiki](https://github.com/CPqD/RouteFlow/wiki) and [issues](https://github.com/CPqD/RouteFlow/issues) in GitHub + +* Google Groups [mailing list](http://groups.google.com/group/routeflow-discuss?hl=en_US) + +_RouteFlow - Copyright (c) 2012 CPqD_ diff --git a/README.md b/README.md index 76bac1d1..9d6d63c3 100644 --- a/README.md +++ b/README.md @@ -1,154 +1,71 @@ -# Welcome -This version of RouteFlow is a beta developers' release intended to evaluate RouteFlow for providing virtualized IP routing services on one or more OpenFlow switches. - -You can learn more about RouteFlow in our [main page in GitHub](http://cpqd.github.com/RouteFlow/) and in our [website](https://sites.google.com/site/routeflow/). - -Please be aware of POX, OpenFlow, Open vSwitch, Quagga, MongoDB, jQuery, JIT and RouteFlow licenses and terms. - -# Distribution overview -RouteFlow is a distribution composed by three basic applications: RFClient, RFServer and RFProxy. - -* RFClient runs as a daemon in the Virtual Machine (VM), detecting changes in the Linux ARP and routing tables. Routing information is sent to the RFServer when there's an update. - -* RFServer is a standalone application that manages the VMs running the RFClient daemons. The RFServer keeps the mapping between the RFClient VM instances and interfaces and the corresponding switches and ports. It connects to RFProxy to instruct it about when to configure flows and also to configure the Open vSwitch to maintain the connectivity in the virtual environment formed by the set of VMs. - -* RFProxy is an application (for POX and other controllers) responsible for the interactions with the OpenFlow switches (identified by datapaths) via the OpenFlow protocol. It listens to instructions from the RFServer and notifies it about events in the network. We recommend running POX when you are experimenting and testing your network. Other implementations in different controllers will be available soon. - -There is also a library of common functions (rflib). It has implementations of the IPC, utilities like custom types for IP and MAC addresses manipulation and OpenFlow message creation. - -Additionally, there's `rfweb`, an extra module that provides an web interface for RouteFlow. - -``` -The RouteFlow Architecture - -+--------VM---------+ -| Quagga | RFClient | -+-------------------+ - \ -M:1 \ RFProtocol - \ -+-------------------+ -| RFServer | -+-------------------+ - \ -1:1 \ RFProtocol - \ -+-------------------+ -| RFProxy | -|-------------------| -| Controller | -+-------------------+ - \ -1:N \ OpenFlow Protocol - \ -+-------------------+ -| OpenFlow Switch | -+-------------------+ -``` +# RouteFlow with Database in cluster mode -# Building +- Introduction +- What's new +- Installation +- Licensing/legal +- Feedback -RouteFlow runs on Ubuntu 12.04. -1. Install the dependencies: -``` -sudo apt-get install build-essential git libboost-dev \ - libboost-program-options-dev libboost-thread-dev \ - libboost-filesystem-dev iproute-dev openvswitch-switch \ - mongodb python-pymongo -``` +# Introduction +This is a version of RouteFlow project managed by CPqD with better support to scalability through a DB in cluster mode. RouteFlow is an open source project to provide virtualized IP routing services over OpenFlow enabled hardware. -2. Clone RouteFlow's repository on GitHub: -``` -$ git clone git://github.com/CPqD/RouteFlow.git -``` +Minimum Requirements: +- CouchBase 2.0.1 or newer -3. Build `rfclient` -``` -make rfclient -``` +Recommended Requirements: +- CouchBase 2.0.1 -That's it! Now you can run tests 1 and 2. The setup to run them is described in the "Running" section. +Source: https://github.com/renerbaffa/RouteFlow -# Running -The folder rftest contains all that is needed to create and run two test cases. -## Virtual environment -First, create the default LXC containers that will run as virtual machines: -``` -$ cd rftest -$ sudo ./create -``` -The containers will have a default ubuntu/ubuntu user/password combination. **You should change that if you plan to deploy RouteFlow**. +# What's New -By default, the tests below will use the LXC containers created by the `create` script. You can use other virtualization technologies. If you have experience with or questions about setting up RouteFlow on a particular technology, contact us! See the "Support" section. +This release sees some significant advances in the RouteFlow project. +Notable changes are: -## Test cases +- Couchbase as new Database Management System. +- Support for use RouteFlow with DB in cluster mode. +- Improved scalability of RouteFlow. +- Scripts to install Couchbase and development libraries. +- MongoIPC class was replaced for CouchIPC class. CouchIPC class is responsable for management of connection with Database. +- Conversion from BSon (Binary JSON) to JSON was removed, because this conversion it isn't necessary in Couchbase. +- References for MongoIPC class were changed to CouchIPC class. +- Script rftest2 was updated to use CouchIPC. -Default configuration files are provided for these tests in the `rftest` directory (you don't need to change anything). -You can stops them at any time by pressing CTRL+C. -### rftest1 -1. Run: -``` -$ sudo ./rftest1 -``` +# Installation -2. You can then log in to the LXC container b1 and try to ping b2: -``` -$ sudo lxc-console -n b1 -``` +## Manual Installation -3. Inside b1, run: -``` -# ping 172.31.2.2 -``` +1. Download and install Couchbase Server on main server. Also, you can run script ```couchbase-server.sh``` to download and install Couchbase server. -For more details on this test, see its [tutorial](https://github.com/CPqD/RouteFlow/wiki/Tutorial-1:-rftest1). +2. Start Couchbase Server, create a bucket with name 'routeflow' and desired configurations. -### rftest2 -This test should be run with a [Mininet](http://mininet.org/) simulated network. -In the steps below, replace [guest address] with the IP address you use to access your Mininet VM. -The same applies to [host address], that should be the address to access the host from inside the VM. - -1. Run: -``` -$ sudo ./rftest2 -``` - -2. Once you have a Mininet VM up and running, copy the network topology files in rftest to the VM: -``` -$ scp topo-4sw-4host.py mininet@[guest address]:/home/mininet/mininet/custom -$ scp ipconf mininet@[guest address]:/home/mininet -``` - -3. Then start the network: -``` -$ sudo mn --custom mininet/custom/topo-4sw-4host.py --topo=rftest2 --controller=remote,ip=[host address],port=6633 --pre=ipconf -``` - -Wait for the network to converge (it should take a few seconds), and try to ping: -``` -mininet> pingall -... -mininet> h2 ping h3 -``` +3. Install Couchbase Server on others servers and choose ```Join Cluster Now```. Set the following data: ```user```, ```password``` and ```main server ip address```. If you have any questions, you can follow this manual: -For more details on this test, see its [tutorial](https://github.com/CPqD/RouteFlow/wiki/Tutorial-2:-rftest2). +4. Access Couchbase's administration, go to ```Server Nodes``` and click ```Rebalance``` to optimize all servers. More information are available in: +5. Setup the file ```rflib/defs.py``` with following data: bucket's name (variable: ```COUCH_BUCKET```); list of all servers in cluster mode (variable: ```COUCH_HOST```, example: ```["192.168.70.128", "192.168.70.129"]```); set variable ```COUCH_INITIAL_VALUE``` with ```0```. -# Now what? -If you want to use the web interface to inspect RouteFlow behavior, see the wiki page on [rfweb](https://github.com/CPqD/RouteFlow/wiki/The-web-interface). +6. Run script ```couchbase-dev.sh``` to install Development libraries. -If you want to create your custom configurations schemes for a given setup, check out the [configuration section of the first tutorial](https://github.com/CPqD/RouteFlow/wiki/Tutorial-1:-rftest1#configuration-file) and the guide on [how to create your virtual environment](https://github.com/CPqD/RouteFlow/wiki/Virtual-environment-creation). +7. Create views in Couchbase, for more information: -If you're developing for RouteFlow, there are more advanced options and components that can be installed through the `build.sh` script. See its [source](https://github.com/CPqD/RouteFlow/blob/master/build.sh) for more information. +# Licensing/Legal -# Support -If you want to know more or need to contact us regarding the project for anything (questions, suggestions, bug reports, discussions about RouteFlow and SDN in general) you can use the following resources: -* RouteFlow repository [wiki](https://github.com/CPqD/RouteFlow/wiki) and [issues](https://github.com/CPqD/RouteFlow/issues) in GitHub +This version is released under the Apache License, Version 2.0. +The License can be found here: http://www.apache.org/licenses/LICENSE-2.0 -* Google Groups [mailing list](http://groups.google.com/group/routeflow-discuss?hl=en_US) -_RouteFlow - Copyright (c) 2012 CPqD_ +# Feedback + +If you find a problem, obsolete or improper code or such, please let us know by contacting us. +Suggestions and corrections are welcome. Below are contacts of the authors of this project. + +- Danilo Pinto da Silva ( *danilo.silva (at) dc.ufscar.br* ) +- Denis Wilson de Souza Oliveira ( *denis.oliveira (at) dc.ufscar.br* ) +- Eloisa Cristina Silva Santos ( *eloisa.santos (at) dc.ufscar.br* ) +- Rener Baffa da Silva ( *rener.silva (at) dc.ufscar.br* ) +- Vinícius Afonso Raimundo Ferreira ( *vinicius.ferreira (at) dc.ufscar.br* ) diff --git a/couchbase-dev.sh b/couchbase-dev.sh new file mode 100755 index 00000000..f05b4040 --- /dev/null +++ b/couchbase-dev.sh @@ -0,0 +1,16 @@ +#!/bin/bash + + user=`whoami` + + if [ "$user" == "root" ] + then + wget -O /etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list + wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | apt-key add - + apt-get update + apt-get install libcouchbase2 libcouchbase-dev python-pip python-dev + pip install couchbase + else + echo "You must be a root user." + fi + +exit 0 diff --git a/couchbase-server.sh b/couchbase-server.sh new file mode 100755 index 00000000..f49fa3fc --- /dev/null +++ b/couchbase-server.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + user=`whoami` + + if [ "$whoami" == root] + then + wget http://packages.couchbase.com/releases/2.0.1/couchbase-server-enterprise_x86_2.0.1.deb + dpkg -i http://packages.couchbase.com/releases/2.0.1/couchbase-server-enterprise_x86_2.0.1.deb + else + echo "You must be a root user." + fi + +exit 0 diff --git a/pox/ext/rfproxy.py b/pox/ext/rfproxy.py index 8c0388e3..a1b01661 100644 --- a/pox/ext/rfproxy.py +++ b/pox/ext/rfproxy.py @@ -5,10 +5,9 @@ from pox.core import core from pox.openflow.libopenflow_01 import * -import pymongo as mongo import rflib.ipc.IPC as IPC -import rflib.ipc.MongoIPC as MongoIPC +import rflib.ipc.CouchIPC as CouchIPC from rflib.ipc.RFProtocol import * from rflib.ipc.RFProtocolFactory import RFProtocolFactory from rflib.defs import * @@ -16,6 +15,7 @@ FAILURE = 0 SUCCESS = 1 +ID = 0 # Association table class Table: @@ -62,10 +62,7 @@ def delete_dp(self, dp_id): netmask_prefix = lambda a: sum([bin(int(x)).count("1") for x in a.split(".", 4)]) -# TODO: add proper support for ID -ID = 0 -ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, str(ID), - threading.Thread, time.sleep) +ipc = CouchIPC.CouchIPCMessageService ( COUCH_HOST, COUCH_BUCKET, str(ID), threading.Thread, time.sleep) table = Table() # Logging diff --git a/rflib/defs.py b/rflib/defs.py index df310f1e..9cf33293 100644 --- a/rflib/defs.py +++ b/rflib/defs.py @@ -1,6 +1,11 @@ MONGO_ADDRESS = "192.169.1.1:27017" MONGO_DB_NAME = "db" +#COUCH_HOST = ["rener-notebook.local", "elantra-CQ43.local"] +COUCH_HOST = ["192.168.70.128", "192.168.70.129"] +COUCH_BUCKET = "default" +COUCH_INITIAL_VALUE = 0 + RFCLIENT_RFSERVER_CHANNEL = "rfclient<->rfserver" RFSERVER_RFPROXY_CHANNEL = "rfserver<->rfproxy" diff --git a/rflib/ipc/CouchIPC.py b/rflib/ipc/CouchIPC.py new file mode 100644 index 00000000..d7ce3d74 --- /dev/null +++ b/rflib/ipc/CouchIPC.py @@ -0,0 +1,116 @@ +from couchbase import Couchbase, LOCKMODE_WAIT +import couchbase.views + +import rflib.ipc.IPC as IPC +from rflib.defs import * + +FROM_FIELD = "from" +TO_FIELD = "to" +TYPE_FIELD = "type" +READ_FIELD = "read" +CONTENT_FIELD = "content" + +def put_in_envelope(from_, to, msg): + envelope = {} + + envelope[FROM_FIELD] = from_ + envelope[TO_FIELD] = to + envelope[READ_FIELD] = False + envelope[TYPE_FIELD] = msg.get_type() + + envelope[CONTENT_FIELD] = {} + for (k, v) in msg.to_dict().items(): + envelope[CONTENT_FIELD][k] = v + + return envelope + +def take_from_envelope(envelope, factory): + msg = factory.build_for_type(envelope[TYPE_FIELD]); + msg.from_dict(envelope[CONTENT_FIELD]); + return msg; + +class CouchIPCMessageService(IPC.IPCMessageService): + def __init__(self, host, bucket, id_, thread_constructor, sleep_function): + """Construct an IPCMessageService + + Args: + bucket: Bucket name of CouchBase. + hosts: list of hosts in the CouchBase cluster. + thread_constructor: function that takes 'target' and 'args' + parameters for the function to run and arguments to pass, and + return an object that has start() and join() functions. + sleep_function: function that takes a float and delays processing + for the specified period. + """ + self._host = host + self._bucket = bucket + self._connection = Couchbase.connect( + bucket=self._bucket, + host=self._host, + unlock_gil=False + ) + self._id = id_ + self._threading = thread_constructor + self._sleep = sleep_function + self._connection.set("key", COUCH_INITIAL_VALUE) + + #mudar... + def listen(self, channel_id, factory, processor, block=True): + worker = self._threading(target=self._listen_worker, args=(channel_id, factory, processor)) + worker.start() + if block: + worker.join() + + def send(self, channel_id, to, msg): + key = self._connection.incr("key").value + envelope = put_in_envelope(self.get_id(), to, msg) + key = "{0}-{1}".format( key, to) + self._connection.set( str(key), envelope ) + return True + + # Denis alterou + #mudar... + def _listen_worker(self, channel_id, factory, processor): + connection = Couchbase.connect( + bucket=self._bucket, + host=self._host, + unlock_gil=False + ) + while True: + cursor = connection.query("all", "filter") + for envelope in cursor: + if envelope.value[TO_FIELD] == self.get_id(): + msg = take_from_envelope(envelope.value, factory) + processor.process(envelope.value[FROM_FIELD], envelope.value[TO_FIELD], channel_id, msg); + envelope.value[READ_FIELD] = True + self._connection.set(envelope.docid, envelope.value) + # work is better without with CouchBase + #self._sleep(0.05) + +class CouchIPCMessage(dict, IPC.IPCMessage): + def __init__(self, type_, **kwargs): + dict.__init__(self) + self.from_dict(kwargs) + self._type = type_ + + def get_type(self): + return self._type + + def from_dict(self, data): + for (k, v) in data.items(): + self[k] = v + + def from_bson(self, data): + self.from_dict(data) + + def to_bson(self): + return self + + def str(self): + string = "" + for (k, v) in self.items(): + string += str(k) + ": " + str(v) + "\n" + return string + + def __str__(self): + return IPC.IPCMessage.__str__(self) diff --git a/rfserver/rfserver.py b/rfserver/rfserver.py index 9b7a2db3..27a83d60 100755 --- a/rfserver/rfserver.py +++ b/rfserver/rfserver.py @@ -8,10 +8,11 @@ import time import argparse -from bson.binary import Binary +#from bson.binary import Binary import rflib.ipc.IPC as IPC -import rflib.ipc.MongoIPC as MongoIPC +#import rflib.ipc.MongoIPC as MongoIPC +import rflib.ipc.CouchIPC as CouchIPC from rflib.ipc.RFProtocol import * from rflib.ipc.RFProtocolFactory import RFProtocolFactory from rflib.defs import * @@ -41,12 +42,17 @@ def __init__(self, configfile, islconffile): ch.setFormatter(logging.Formatter(logging.BASIC_FORMAT)) self.log.addHandler(ch) + self.ipc = CouchIPC.CouchIPCMessageService( COUCH_HOST, COUCH_BUCKET, RFSERVER_ID, threading.Thread, time.sleep ) + ''' self.ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, RFSERVER_ID, threading.Thread, time.sleep) + ''' + # alterar funcoes no listen self.ipc.listen(RFCLIENT_RFSERVER_CHANNEL, self, self, False) + # alterar funcoes no listen self.ipc.listen(RFSERVER_RFPROXY_CHANNEL, self, self, True) def process(self, from_, to, channel, msg):