当前位置: 首页>>代码示例>>Python>>正文


Python client.OFPClient类代码示例

本文整理汇总了Python中ryu.app.client.OFPClient的典型用法代码示例。如果您正苦于以下问题:Python OFPClient类的具体用法?Python OFPClient怎么用?Python OFPClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OFPClient类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RyuInterfaceDriver

class RyuInterfaceDriver(OVSInterfaceDriver):
    """Driver for creating a Ryu OVS interface."""

    def __init__(self, conf):
        super(RyuInterfaceDriver, self).__init__(conf)

        from ryu.app.client import OFPClient
        LOG.debug('ryu rest host %s', self.conf.ryu_api_host)
        self.ryu_client = OFPClient(self.conf.ryu_api_host)

    def plug(self, network_id, port_id, device_name, mac_address,
             bridge=None, namespace=None, prefix=None):
        """Plug in the interface."""
        super(RyuInterfaceDriver, self).plug(network_id, port_id, device_name,
                                             mac_address, bridge=bridge,
                                             namespace=namespace,
                                             prefix=prefix)
        if not bridge:
            bridge = self.conf.ovs_integration_bridge

        self.check_bridge_exists(bridge)
        ovs_br = ovs_lib.OVSBridge(bridge, self.conf.root_helper)
        datapath_id = ovs_br.get_datapath_id()
        port_no = ovs_br.get_port_ofport(device_name)
        self.ryu_client.create_port(network_id, datapath_id, port_no)
开发者ID:ewindisch,项目名称:quantum,代码行数:25,代码来源:interface.py

示例2: LibvirtOpenVswitchOFPRyuDriver

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)
开发者ID:ykaneko,项目名称:quantum-backup,代码行数:31,代码来源:vif.py

示例3: __init__

    def __init__(self, conf):
        super(RyuInterfaceDriver, self).__init__(conf)

        from ryu.app.client import OFPClient

        LOG.debug("ryu rest host %s", self.conf.ryu_api_host)
        self.ryu_client = OFPClient(self.conf.ryu_api_host)
开发者ID:kumarcv,项目名称:openstack-nf,代码行数:7,代码来源:interface.py

示例4: __init__

    def __init__(self, integ_br, db, root_helper):
        self.root_helper = root_helper
        (ofp_controller_addr, ofp_rest_api_addr) = check_ofp_mode(db)

        self.nw_id_external = rest_nw_id.NW_ID_EXTERNAL
        self.api = OFPClient(ofp_rest_api_addr)
        self._setup_integration_br(integ_br, ofp_controller_addr)
开发者ID:codeoedoc,项目名称:quantum,代码行数:7,代码来源:ryu_quantum_agent.py

示例5: __init__

    def __init__(self, config, integ_br, db):
        ret = check_ofp_mode(db)
        assert ret

        (ofp_controller_addr, ofp_rest_api_addr) = ret

        self.nw_id_external = rest_nw_id.NW_ID_EXTERNAL
        self.api = OFPClient(ofp_rest_api_addr)
        self._setup_integration_br(integ_br, ofp_controller_addr)
开发者ID:ykaneko,项目名称:quantum-backup,代码行数:9,代码来源:ryu_quantum_agent.py

示例6: __init__

    def __init__(self, conf):
        super(RyuInterfaceDriver, self).__init__(conf)

        from ryu.app.client import OFPClient
        LOG.debug('ryu rest host %s', self.conf.ryu_api_host)
        self.ryu_client = OFPClient(self.conf.ryu_api_host)

        self.check_bridge_exists(self.conf.ovs_integration_bridge)
        self.ovs_br = ovs_lib.OVSBridge(self.conf.ovs_integration_bridge,
                                        self.conf.root_helper)
        self.datapath_id = self.ovs_br.get_datapath_id()
开发者ID:vbannai,项目名称:quantum,代码行数:11,代码来源:interface.py

示例7: LinuxOVSRyuInterfaceDriver

class LinuxOVSRyuInterfaceDriver(object):
    nova_linux_net = None

    def __init__(self):
        if self.nova_linux_net is None:
            self.nova_linux_net = utils.import_object('nova.network.linux_net')

        cls = utils.import_class(
            'nova.network.linux_net.LinuxOVSInterfaceDriver')
        self.parent = cls()

        LOG.debug('ryu rest host %s', FLAGS.linuxnet_ovs_ryu_api_host)
        self.ryu_client = OFPClient(FLAGS.linuxnet_ovs_ryu_api_host)
        self.datapath_id = ovs_utils.get_datapath_id(
            FLAGS.linuxnet_ovs_integration_bridge)

        if self.nova_linux_net.binary_name == 'nova-network':
            for tables in [
                    self.nova_linux_net.iptables_manager.ipv4,
                    self.nova_linux_net.iptables_manager.ipv6
            ]:
                tables['filter'].add_rule(
                    'FORWARD',
                    '--in-interface gw-+ --out-interface gw-+ -j DROP')
            self.nova_linux_net.iptables_manager.apply()

    def plug(self, network, mac_address, gateway=True):
        LOG.debug("network %s mac_adress %s gateway %s", network, mac_address,
                  gateway)
        ret = self.parent.plug(network, mac_address, gateway)
        port_no = ovs_utils.get_port_no(self.get_dev(network))
        self.ryu_client.create_port(network['uuid'], self.datapath_id, port_no)
        return ret

    def unplug(self, network):
        return self.parent.unplug(network)

    def get_dev(self, network):
        return self.parent.get_dev(network)
开发者ID:ykaneko,项目名称:quantum-backup,代码行数:39,代码来源:linux_net.py

示例8: __init__

    def __init__(self):
        super(LinuxOVSRyuInterfaceDriver, self).__init__()

        LOG.debug('ryu rest host %s', FLAGS.linuxnet_ovs_ryu_api_host)
        self.ryu_client = OFPClient(FLAGS.linuxnet_ovs_ryu_api_host)
        self.datapath_id = _get_datapath_id(
            FLAGS.linuxnet_ovs_integration_bridge)

        if linux_net.binary_name == 'nova-network':
            for tables in [linux_net.iptables_manager.ipv4,
                           linux_net.iptables_manager.ipv6]:
                tables['filter'].add_rule('FORWARD',
                        '--in-interface gw-+ --out-interface gw-+ -j DROP')
            linux_net.iptables_manager.apply()
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:14,代码来源:linux_net.py

示例9: __init__

    def __init__(self):
        if self.nova_linux_net is None:
            self.nova_linux_net = utils.import_object('nova.network.linux_net')

        cls = utils.import_class(
            'nova.network.linux_net.LinuxOVSInterfaceDriver')
        self.parent = cls()

        LOG.debug('ryu rest host %s', FLAGS.linuxnet_ovs_ryu_api_host)
        self.ryu_client = OFPClient(FLAGS.linuxnet_ovs_ryu_api_host)
        self.datapath_id = ovs_utils.get_datapath_id(
            FLAGS.linuxnet_ovs_integration_bridge)

        if self.nova_linux_net.binary_name == 'nova-network':
            for tables in [self.nova_linux_net.iptables_manager.ipv4,
                           self.nova_linux_net.iptables_manager.ipv6]:
                tables['filter'].add_rule('FORWARD',
                        '--in-interface gw-+ --out-interface gw-+ -j DROP')
            self.nova_linux_net.iptables_manager.apply()
开发者ID:ykaneko,项目名称:quantum-backup,代码行数:19,代码来源:linux_net.py

示例10: __init__

 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)
开发者ID:ykaneko,项目名称:quantum-backup,代码行数:5,代码来源:vif.py


注:本文中的ryu.app.client.OFPClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。