def ovs_vsctl_del_pbridge(bridge, iface): """ This function deletes the OVS bridge and assigns the bridge IP address back to the iface. """ (ip_addr, mask) = util.interface_get_ip(bridge) util.interface_assign_ip(iface, ip_addr, mask) util.move_routes(bridge, iface) return ovs_vsctl_del_bridge(bridge)
def xmlrpc_create_test_bridge(self, bridge, iface): """ This function creates a physical bridge from iface. It moves the IP configuration from the physical interface to the bridge. """ ret = vswitch.ovs_vsctl_add_bridge(bridge) if ret == 0: self.pbridges.add((bridge, iface)) util.interface_up(bridge) (ip_addr, mask) = util.interface_get_ip(iface) util.interface_assign_ip(bridge, ip_addr, mask) util.move_routes(iface, bridge) util.interface_assign_ip(iface, "0.0.0.0", "255.255.255.255") ret = vswitch.ovs_vsctl_add_port_to_bridge(bridge, iface) if ret == 0: self.ports.add(iface) else: util.interface_assign_ip(iface, ip_addr, mask) util.move_routes(bridge, iface) vswitch.ovs_vsctl_del_bridge(bridge) return ret