def __init__(self, configfile=None): super(RyuNeutronPluginV2, self).__init__() self.base_binding_dict = { portbindings.VIF_TYPE: portbindings.VIF_TYPE_OVS, portbindings.VIF_DETAILS: { # TODO(rkukura): Replace with new VIF security details portbindings.CAP_PORT_FILTER: 'security-group' in self.supported_extension_aliases, portbindings.OVS_HYBRID_PLUG: True } } portbindings_base.register_port_dict_function() self.tunnel_key = db_api_v2.TunnelKey(cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max) self.ofp_api_host = cfg.CONF.OVS.openflow_rest_api if not self.ofp_api_host: raise n_exc.Invalid(_('Invalid configuration. check ryu.ini')) self.client = client.OFPClient(self.ofp_api_host) self.tun_client = client.TunnelClient(self.ofp_api_host) self.iface_client = client.NeutronIfaceClient(self.ofp_api_host) for nw_id in rest_nw_id.RESERVED_NETWORK_IDS: if nw_id != rest_nw_id.NW_ID_UNKNOWN: self.client.update_network(nw_id) self._setup_rpc() # register known all network list on startup self._create_all_tenant_network()
def test_ryu_driver(self): from ryu.app import client as client_mod from ryu.app import rest_nw_id as rest_nw_id_mod self.mox.StubOutClassWithMocks(client_mod, 'OFPClient') client_mock = client_mod.OFPClient(utils.FAKE_REST_ADDR) self.mox.StubOutWithMock(client_mock, 'update_network') self.mox.StubOutWithMock(client_mock, 'create_network') self.mox.StubOutWithMock(client_mock, 'delete_network') client_mock.update_network(rest_nw_id_mod.NW_ID_EXTERNAL) uuid0 = '01234567-89ab-cdef-0123-456789abcdef' def fake_uuid4(): return uuid0 self.stubs.Set(uuid, 'uuid4', fake_uuid4) uuid1 = '12345678-9abc-def0-1234-56789abcdef0' net1 = utils.Net(uuid1) client_mock.update_network(uuid0) client_mock.create_network(uuid1) client_mock.delete_network(uuid1) self.mox.ReplayAll() db.network_create('test', uuid0) from quantum.plugins.ryu import ryu_quantum_plugin ryu_driver = ryu_quantum_plugin.OFPRyuDriver(self.config) ryu_driver.create_network(net1) ryu_driver.delete_network(net1) self.mox.VerifyAll() db.network_destroy(uuid0)
def __init__(self, configfile=None): self.base_binding_dict = { portbindings.VIF_TYPE: portbindings.VIF_TYPE_OVS, portbindings.CAPABILITIES: { portbindings.CAP_PORT_FILTER: 'security-group' in self.supported_extension_aliases } } portbindings_base.register_port_dict_function() db.configure_db() self.tunnel_key = db_api_v2.TunnelKey(cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max) self.ofp_api_host = cfg.CONF.OVS.openflow_rest_api if not self.ofp_api_host: raise q_exc.Invalid(_('Invalid configuration. check ryu.ini')) self.client = client.OFPClient(self.ofp_api_host) self.tun_client = client.TunnelClient(self.ofp_api_host) self.iface_client = client.NeutronIfaceClient(self.ofp_api_host) for nw_id in rest_nw_id.RESERVED_NETWORK_IDS: if nw_id != rest_nw_id.NW_ID_UNKNOWN: self.client.update_network(nw_id) self._setup_rpc() # register known all network list on startup self._create_all_tenant_network()
def __init__(self, configfile=None): options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} options.update({'base': models_v2.model_base.BASEV2}) reconnect_interval = cfg.CONF.DATABASE.reconnect_interval options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) self.tunnel_key = db_api_v2.TunnelKey(cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max) ofp_con_host = cfg.CONF.OVS.openflow_controller ofp_api_host = cfg.CONF.OVS.openflow_rest_api if ofp_con_host is None or ofp_api_host is None: raise q_exc.Invalid(_('invalid configuration. check ryu.ini')) hosts = [(ofp_con_host, ofp_service_type.CONTROLLER), (ofp_api_host, ofp_service_type.REST_API)] db_api_v2.set_ofp_servers(hosts) self.client = client.OFPClient(ofp_api_host) self.tun_client = client.TunnelClient(ofp_api_host) for nw_id in rest_nw_id.RESERVED_NETWORK_IDS: if nw_id != rest_nw_id.NW_ID_UNKNOWN: self.client.update_network(nw_id) self._setup_rpc() # register known all network list on startup self._create_all_tenant_network()
def __init__(self, config): super(OFPRyuDriver, self).__init__() ofp_con_host = config.get("OVS", "openflow-controller") ofp_api_host = config.get("OVS", "openflow-rest-api") if ofp_con_host is None or ofp_api_host is None: raise q_exc.Invalid("invalid configuration. check ryu.ini") hosts = [(ofp_con_host, ofp_service_type.CONTROLLER), (ofp_api_host, ofp_service_type.REST_API)] db_api.set_ofp_servers(hosts) self.client = client.OFPClient(ofp_api_host) self.client.update_network(rest_nw_id.NW_ID_EXTERNAL) # register known all network list on startup self._create_all_tenant_network()
def __init__(self, configfile=None): db.configure_db() self.tunnel_key = db_api_v2.TunnelKey(cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max) self.ofp_api_host = cfg.CONF.OVS.openflow_rest_api if not self.ofp_api_host: raise q_exc.Invalid(_('Invalid configuration. check ryu.ini')) self.client = client.OFPClient(self.ofp_api_host) self.tun_client = client.TunnelClient(self.ofp_api_host) self.iface_client = client.QuantumIfaceClient(self.ofp_api_host) for nw_id in rest_nw_id.RESERVED_NETWORK_IDS: if nw_id != rest_nw_id.NW_ID_UNKNOWN: self.client.update_network(nw_id) self._setup_rpc() # register known all network list on startup self._create_all_tenant_network()
def _setup_integration_br(self, root_helper, integ_br, ofp_rest_api_addr, tunnel_ip, ovsdb_port, ovsdb_ip): self.int_br = OVSBridge(integ_br, root_helper) self.int_br.find_datapath_id() ryu_rest_client = client.OFPClient(ofp_rest_api_addr) self.vif_ports = VifPortSet(self.int_br, ryu_rest_client) self.vif_ports.setup() sc_client = client.SwitchConfClient(ofp_rest_api_addr) sc_client.set_key(self.int_br.datapath_id, conf_switch_key.OVS_TUNNEL_ADDR, tunnel_ip) # Currently Ryu supports only tcp methods. (ssl isn't supported yet) self.int_br.set_manager('ptcp:%d' % ovsdb_port) sc_client.set_key(self.int_br.datapath_id, conf_switch_key.OVSDB_ADDR, 'tcp:%s:%d' % (ovsdb_ip, ovsdb_port))
def __init__(self, configfile=None): super(RyuNeutronPluginV2, self).__init__() self.base_binding_dict = self._get_base_binding_dict() portbindings_base.register_port_dict_function() self.tunnel_key = db_api_v2.TunnelKey( cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max) self.ofp_api_host = cfg.CONF.OVS.openflow_rest_api if not self.ofp_api_host: raise n_exc.Invalid(_('Invalid configuration. check ryu.ini')) self.client = client.OFPClient(self.ofp_api_host) self.tun_client = client.TunnelClient(self.ofp_api_host) self.iface_client = client.NeutronIfaceClient(self.ofp_api_host) for nw_id in rest_nw_id.RESERVED_NETWORK_IDS: if nw_id != rest_nw_id.NW_ID_UNKNOWN: self.client.update_network(nw_id) self._setup_rpc() # register known all network list on startup self._create_all_tenant_network()
def _setup_integration_br(self, root_helper, integ_br, tunnel_ip, ovsdb_port, ovsdb_ip): self.int_br = OVSBridge(integ_br, root_helper) self.int_br.find_datapath_id() rest_api_addr = self.plugin_rpc.get_ofp_rest_api_addr(self.context) if not rest_api_addr: raise q_exc.Invalid(_("Ryu rest API port isn't specified")) LOG.debug(_("Going to ofp controller mode %s"), rest_api_addr) ryu_rest_client = client.OFPClient(rest_api_addr) self.vif_ports = VifPortSet(self.int_br, ryu_rest_client) self.vif_ports.setup() sc_client = client.SwitchConfClient(rest_api_addr) sc_client.set_key(self.int_br.datapath_id, conf_switch_key.OVS_TUNNEL_ADDR, tunnel_ip) # Currently Ryu supports only tcp methods. (ssl isn't supported yet) self.int_br.set_manager('ptcp:%d' % ovsdb_port) sc_client.set_key(self.int_br.datapath_id, conf_switch_key.OVSDB_ADDR, 'tcp:%s:%d' % (ovsdb_ip, ovsdb_port))
def __init__(self, configfile=None): options = {"sql_connection": cfg.CONF.DATABASE.sql_connection} options.update({'base': models_v2.model_base.BASEV2}) reconnect_interval = cfg.CONF.DATABASE.reconnect_interval options.update({"reconnect_interval": reconnect_interval}) db.configure_db(options) ofp_con_host = cfg.CONF.OVS.openflow_controller ofp_api_host = cfg.CONF.OVS.openflow_rest_api if ofp_con_host is None or ofp_api_host is None: raise q_exc.Invalid("invalid configuration. check ryu.ini") hosts = [(ofp_con_host, ofp_service_type.CONTROLLER), (ofp_api_host, ofp_service_type.REST_API)] db_api_v2.set_ofp_servers(hosts) self.client = client.OFPClient(ofp_api_host) self.client.update_network(rest_nw_id.NW_ID_EXTERNAL) self._setup_rpc() # register known all network list on startup self._create_all_tenant_network()