def delete_datapath(dp): if dp not in dpctl.dump_dps(): return 'Datapath Does Not Exist' else: dpctl.del_dp(dp) return 'Deleted'
def create_datapath(dp): if dp not in dpctl.dump_dps(): dpctl.add_dp(dp) return 'Success!' else: return 'DataPath Already Exists'
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'
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'
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'
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'
def show_alldp(): return dpctl.dump_dps()
def get_dps(dp): if dp not in dpctl.dump_dps(): return 'Datapath Does Not Exist' else: return dpctl.show(dp)
def delete_flow(dp): if dp in dpctl.dump_dps(): dpctl.del_flows(dp) return 'Flows Deleted' else: return 'Datapath Does Not Exist'