Beispiel #1
0
def experimental(params=None):
    if params:
        resource = f'experimental/{params}'
        data = ApiService().list(resource, size=None)
        return data
    else:
        data = ApiService().list('experimental/object', size=None)
        return data
Beispiel #2
0
def get_resource(resource, id):
    data = ApiService().get(resource, id)
    return render_template('result.html',
                           data=data,
                           resource=resource,
                           id=id,
                           resources=resources)
 def __init__(self, my_app):
     self.api = ApiService()
     self.master_module = MasterModule()
     self.my_app = my_app
     self.press_time = [0] * settings.NUMBER_OF_PRESSES
     self.current_time = [0] * settings.NUMBER_OF_PRESSES
     self.is_open_started = [False] * settings.NUMBER_OF_PRESSES
     self.init_values()
Beispiel #4
0
def qosSetup():
    baseUrl = 'http://0.0.0.0:8080'
    datapath = '0000000000000001'
    api = ApiService(baseUrl)

    # Put db address
    ovsdbEndpoint = '/v1.0/conf/switches/' + datapath + '/ovsdb_addr'
    ovsdbData = "tcp:127.0.0.1:6632"
    api.put(ovsdbEndpoint, ovsdbData)
    sleep(2)

    # Post Queue
    queueEndpoint = '/qos/queue/' + datapath
    queueData = {
        "port_name":
        "s1-eth1",
        "type":
        "linux-htb",
        "max_rate":
        "1000000",
        "queues": [{
            "max_rate": "100000"
        }, {
            "max_rate": "500000"
        }, {
            "min_rate": "800000"
        }]
    }
    api.post(queueEndpoint, queueData)

    # Post Qos Rule
    ruleEndpoint = '/qos/rules/' + datapath
    #ruleData = {"match": {"ip_dscp": "26"},
    #            "actions": {"queue": "1"}}

    ruleData1 = {
        "match": {
            "nw_dst": "10.0.0.1",
            "nw_proto": "UDP",
            "tp_dst": "5001"
        },
        "actions": {
            "queue": "0"
        }
    }
    ruleData2 = {
        "match": {
            "nw_dst": "10.0.0.1",
            "nw_proto": "UDP",
            "tp_dst": "5002"
        },
        "actions": {
            "queue": "1"
        }
    }

    api.post(ruleEndpoint, ruleData1)
    api.post(ruleEndpoint, ruleData2)
Beispiel #5
0
 def __init__(self, controllerIp, controllerPort):
     self.controllerUrl = self.controller_query(controllerIp,
                                                controllerPort)
     self.api = ApiService(self.controllerUrl)
Beispiel #6
0
def colors(size=None):
    data = ApiService().list('color', size)
    colors = format_color_data(data)
    return render_template('colors.html', colors=colors)
Beispiel #7
0
def get_images(keyword, size=None):
    data = ApiService().find_images_by_keyword(keyword, size)
    return data
Beispiel #8
0
def list_resource(resource, size=None):
    data = ApiService().list(resource, size)
    return render_template('page.html',
                           data=data,
                           resource=resource,
                           resources=resources)
Beispiel #9
0
def load_search(keyword, size=None, page=None):
    data = ApiService().find_by_keyword(keyword, size, page)
    return data