Esempio n. 1
0
import tornado.web
import tornado.httpclient
import tornado.gen
import json
import threading
import traceback

from topofetch import *
from jsonrpc import *
from microsrvurl import *
from test import *
from tornado_swagger import swagger
from common import *
import datetime

swagger.docs()

flow_equip_interval = int(3600 * 1000)


class fetch_thread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.fetcher = topo_fetcher()
        self.last_fetch = 0
        pass

    def set_equips(self):
        rpc = base_rpc(microsrvurl_dict['microsrv_flow_url'])
        args = {}
        args['equips'] = self.fetcher.equips
Esempio n. 2
0
import json

import tornado.ioloop
from tornado.web import RequestHandler, HTTPError
from tornado_swagger import swagger

DEFAULT_REPRESENTATION = "application/json"
HTTP_BAD_REQUEST = 400
HTTP_FORBIDDEN = 403
HTTP_NOT_FOUND = 404

swagger.docs()


@swagger.model()
class PropertySubclass:
    def __init__(self, sub_property=None):
        self.sub_property = sub_property


@swagger.model()
class Item:
    """
        @description:
            This is an example of a model class that has parameters in its constructor
            and the fields in the swagger spec are derived from the parameters to __init__.
        @notes:
            In this case we would have property1, name as required parameters and property3 as optional parameter.
        @property property3: Item description
        @ptype property3: L{PropertySubclass}
        @ptype property4: C{list} of L{PropertySubclass}