Example #1
0
def delete_datapath(dp):

    if dp not in dpctl.dump_dps():
        return 'Datapath Does Not Exist'
    else:
        dpctl.del_dp(dp)
        return 'Deleted'
Example #2
0
def create_datapath(dp):

    if dp not in dpctl.dump_dps():
        dpctl.add_dp(dp)
        return 'Success!'
    else:
        return 'DataPath Already Exists'
Example #3
0
def update_if(dp, port):
    if dp in dpctl.dump_dps():
        if port in dpctl.show(dp):
            dpctl.set_if(dp, port)
            return 'Success'
        else:
            return 'netdev is not associated with the datapath'
    else:
        return 'Datapath Does Not Exist'
Example #4
0
def show_flow(dp):
    if dp in dpctl.dump_dps():
        if dpctl.dump_flows(dp) == None:
            return dpctl.dump_flows(dp)
        else:
            return 'No Flows'

    else:
        return 'Datapath Does Not Exist'
Example #5
0
def del_if(dp, netdev):
    if dp in dpctl.dump_dps():
        if netdev in dpctl.show(dp):
            dpctl.del_if(dp, netdev)
            return 'Success'
        else:
            return 'netdev is not associated with the datapath'
    else:
        return 'Datapath Does Not Exist'
Example #6
0
def add_if(dp, netdev):
    if dp in dpctl.dump_dps():
        if netdev in dpctl.show(dp):
            return 'Error: netdev already exists for datapath or netdev does not exist'
        else:
            dpctl.add_if(dp, netdev)
            return 'Success'
    else:
        return 'Datapath Does Not Exist'
Example #7
0
def show_alldp():
    return dpctl.dump_dps()
Example #8
0
def get_dps(dp):
    if dp not in dpctl.dump_dps():
        return 'Datapath Does Not Exist'
    else:
        return dpctl.show(dp)
Example #9
0
def delete_flow(dp):
    if dp in dpctl.dump_dps():
        dpctl.del_flows(dp)
        return 'Flows Deleted'
    else:
        return 'Datapath Does Not Exist'