Exemplo n.º 1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController

desc_file_name = 'address_extractor_service.xml'

controller = DevServiceController(desc_file_name)
try:
    while True:
        print controller.read_object('2')
except:
    pass
finally:
    controller.close_all_connections()
Exemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import random
import time

desc_file_name = "decision_maker_service1.xml"
controller = DevServiceController(desc_file_name)

UPDATE_PARAMS_INTERVAL = 20

try:
    iters_to_update = UPDATE_PARAMS_INTERVAL
    while True:
        controller.send_data("2", "1")
        print "1"
        time.sleep(0.5)
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController

desc_file_name = 'http_extractor_service.xml'

controller = DevServiceController(desc_file_name)
try:
    while True:
        print controller.read_data('2')
except:
    pass
finally:
    controller.close_all_connections()
	
Exemplo n.º 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import fileinput

desc_file_name = 'byte_extractor_service.xml'
controller = DevServiceController(desc_file_name)

try:
    for line in fileinput.input(['../servers_emulator/data/http_server.log']):
        controller.send_data('1', line)
        print line
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import random
import time

chars_to_send = 'qwertyQWERTY'

desc_file_name = 'servers_emulator.xml'
controller = DevServiceController(desc_file_name)
try:
    while True:
        char = random.choice(chars_to_send)
        controller.send_data('1', char)
        print "SENT:", char
        time.sleep(0.5)
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import random
import time

desc_file_name = 'bayes_classifier_service.xml'
controller = DevServiceController(desc_file_name)

UPDATE_PARAMS_INTERVAL = 20

try:
    iters_to_update = UPDATE_PARAMS_INTERVAL
    while True:

        controller.send_object('1', 201)
        controller.send_object('2', 213123)
        print "SENT:"
        time.sleep(0.5)
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import random
import time
import os

desc_file_name = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../lower_service/lower_service.xml')  # prepare proper absolute path
controller = DevServiceController(desc_file_name)

def get_random_case(str_val):
    if random.random() > 0.5:
        return str_val.upper()
    else:
        return str_val.lower()

try:
    while True:
        dict_to_send = {get_random_case('a'): random.randint(0, 100),
                        get_random_case('b'): random.randint(0, 100),
                        get_random_case('c'): random.randint(0, 100),
                        }
        controller.send_object('1', dict_to_send)
        print "SENT:", dict_to_send
        time.sleep(0.5)
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import sys

desc_file_name = "servers_emulator.xml"
controller = DevServiceController(desc_file_name)
try:
    while True:
        sys.stdout.write(controller.read_data("2", 1024))
        sys.stdout.flush()
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 9
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import time
import re

desc_file_name = 'servers_emulator.xml'
controller = DevServiceController(desc_file_name)
try:
    print("##### Server SMTP Start #####")

    with open('data/smtp_server.log', 'rb') as file:
        block = ''
        for line in file.readlines():
            line = line.strip()
            block_end = re.search('[-]*=_[0-9]*-[0-9]*-[0-9]*', line)
            block += line
            if block_end:
                controller.send_data('2', block)
                print "SENT:", block
                time.sleep(1)
except:
    raise
finally:
    controller.close_all_connections()
Exemplo n.º 10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from ComssService.dev.control import DevServiceController
import random
import time

desc_file_name = "address_extractor_service.xml"
controller = DevServiceController(desc_file_name)

UPDATE_PARAMS_INTERVAL = 20

try:
    iters_to_update = UPDATE_PARAMS_INTERVAL
    while True:
        iters_to_update -= 1
        if iters_to_update <= 0:
            new_params = {"multiply_by": random.randint(0, 3), "value_to_multiply": random.choice(["a", "b", "c"])}
            controller.update_params(new_params)
            print "PARAMS UPDATED", new_params
            iters_to_update = UPDATE_PARAMS_INTERVAL

        dict_to_send = {"a": random.randint(0, 100), "b": random.randint(0, 100), "c": random.randint(0, 100)}
        controller.send_object("1", dict_to_send)
        print "SENT:", dict_to_send
        time.sleep(0.5)
except:
    raise
finally:
    controller.close_all_connections()