Ejemplo n.º 1
0
def deleteFlowTableFile(flowtablefile):
    #if flowtablefile does not exist, cant apply, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(flowtablefile))) == 0:
        abort(404)

    sub_P01T2OpenvSwitch.delete_flowtablefile(flowtablefile)

    #check if successfully deleted
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(flowtablefile))) != 0:
        abort(400)

    return jsonify({'result': True})
Ejemplo n.º 2
0
def getFlowTableFile(flowtablefile):
    #if flowtablefile does not exist, cant read, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(flowtablefile))) == 0:
        abort(404)

    ftFile = sub_P01T2OpenvSwitch.get_flowtablefile(flowtablefile)
    return jsonify({'Flowtablefile': ftFile.splitlines()})
Ejemplo n.º 3
0
def createFlowTableFile():
    #if curl no -d, or -d not flowtablefile, abort 400
    if not request.json or not 'flowtablefile' in request.json or type(
            request.json['flowtablefile']) != unicode:
        abort(400)

    ftFile = request.json['flowtablefile']

    #if already exist, cant post, so abort 400
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(ftFile))) != 0:
        abort(400)

    sub_P01T2OpenvSwitch.create_flowtablefile(ftFile)

    #check if successfully created
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(ftFile))) == 0:
        abort(400)

    return jsonify({'flowtablefile': ftFile}), 201
Ejemplo n.º 4
0
def addFlowTablieFileToBridge(bridge, flowtablefile):
    ##if bridge does not exist, cant post, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_bridge_EH(bridge))) == 0:
        abort(404)

    #if flowtablefile does not exist, cant apply, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(flowtablefile))) == 0:
        abort(404)

    sub_P01T2OpenvSwitch.apply_flowtablefile(bridge, flowtablefile)
    return jsonify({'bridge': bridge, 'flowtablefile': flowtablefile}), 201
Ejemplo n.º 5
0
def applyUpdatedFlowTableFile(bridge):
    #if curl no -d, or -d not flowtablefile, abort 400
    if not request.json or not 'flowtablefile' in request.json or type(
            request.json['flowtablefile']) != unicode:
        abort(400)

    ftFile = request.json['flowtablefile']

    #if flowtablefile does not exist, cant apply, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(ftFile))) == 0:
        abort(404)

    ##if bridge does not exist, cant post, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_bridge_EH(bridge))) == 0:
        abort(404)

    sub_P01T2OpenvSwitch.applyupdated_flowtablefile(bridge, ftFile)
    return jsonify({'bridge': bridge, 'flowtablefile': ftFile})
Ejemplo n.º 6
0
def addFlowintoTablefile(flowtablefile):
    #if curl no -d, or -d not flow, abort 400
    if not request.json or not 'flow' in request.json or type(
            request.json['flow']) != unicode:
        abort(400)

    flow = request.json['flow']

    #if flowtablefile does not exist, cant read, so abort 404
    if len(str(sub_P01T2OpenvSwitch.get_flowtablefile_EH(flowtablefile))) == 0:
        abort(404)

    sub_P01T2OpenvSwitch.add_flowtablefile(flow, flowtablefile)

    #check if successfully created
    if len(
            str(
                sub_P01T2OpenvSwitch.get_flowentry_flowtablefile_EH(
                    flow, flowtablefile))) == 0:
        abort(400)

    return jsonify({'flowtablefile': flowtablefile, 'flow': flow}), 201