Small bugs

This commit is contained in:
root
2024-04-16 15:13:46 +02:00
parent e2fcc56ce0
commit 58a04d51b3
9 changed files with 184 additions and 71 deletions

View File

@@ -44,18 +44,28 @@ def get_int(net_name):
def create_vswitch_int(net_int):
cmd="ovs-vsctl add-br "+net_int
subprocess.call(cmd, shell=True)
out = subprocess.call(cmd, shell=True)
if out2 != 0:
raise Exception("Error on creating interface")
def delete_network(net_name,net_int):
cmd = "ovs-vsctl del-br "+net_int
subprocess.call(cmd, shell=True)
network = conn.networkLookupByName(net_name) #Lapin
out = subprocess.call(cmd, shell=True)
if out != 0:
raise Exception("Error deleting interface")
network = conn.networkLookupByName(net_name)
network.destroy()
network.undefine()
cmd2="kill $(cat /run/dhypecp_"+net_int+".pid)"
subprocess.call(cmd2, shell=True)
out2 = subprocess.call(cmd2, shell=True)
if out2 != 0:
raise Exception("Error on killing DHCP process")
cmd3="rm -f /run/dhypecp_"+net_int+".pid"
subprocess.call(cmd3, shell=True)
out3 = subprocess.call(cmd3, shell=True)
if out3 != 0:
raise Exception("Error on Deleting DHCP process")
def create_network(net_name,net_int):
create_vswitch_int(net_int)