本文整理汇总了Python中ryu.app.client.OFPClient.delete_port方法的典型用法代码示例。如果您正苦于以下问题:Python OFPClient.delete_port方法的具体用法?Python OFPClient.delete_port怎么用?Python OFPClient.delete_port使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ryu.app.client.OFPClient
的用法示例。
在下文中一共展示了OFPClient.delete_port方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LibvirtOpenVswitchOFPRyuDriver
# 需要导入模块: from ryu.app.client import OFPClient [as 别名]
# 或者: from ryu.app.client.OFPClient import delete_port [as 别名]
class LibvirtOpenVswitchOFPRyuDriver(libvirt_vif.LibvirtOpenVswitchDriver):
def __init__(self, **kwargs):
super(LibvirtOpenVswitchOFPRyuDriver, self).__init__()
LOG.debug('ryu rest host %s', FLAGS.libvirt_ovs_bridge)
self.ryu_client = OFPClient(FLAGS.libvirt_ovs_ryu_api_host)
self.datapath_id = ovs_utils.get_datapath_id(FLAGS.libvirt_ovs_bridge)
def _get_port_no(self, mapping):
iface_id = mapping['vif_uuid']
dev = self.get_dev_name(iface_id)
return ovs_utils.get_port_no(dev)
def plug(self, instance, network, mapping):
result = super(LibvirtOpenVswitchOFPRyuDriver, self).plug(
instance, network, mapping)
port_no = self._get_port_no(mapping)
self.ryu_client.create_port(network['id'],
self.datapath_id, port_no)
return result
def unplug(self, instance, network, mapping):
port_no = self._get_port_no(mapping)
try:
self.ryu_client.delete_port(network['id'],
self.datapath_id, port_no)
except httplib.HTTPException as e:
res = e.args[0]
if res.status != httplib.NOT_FOUND:
raise
super(LibvirtOpenVswitchOFPRyuDriver, self).unplug(instance, network,
mapping)