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 __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 test_key_allocation(self): tunnel_key = db_api_v2.TunnelKey() session = db.get_session() with nested(self.network('network-0'), self.network('network-1') ) as (network_0, network_1): network_id0 = network_0['network']['id'] key0 = tunnel_key.allocate(session, network_id0) network_id1 = network_1['network']['id'] key1 = tunnel_key.allocate(session, network_id1) key_list = tunnel_key.all_list() self.assertEqual(len(key_list), 2) expected_list = [(network_id0, key0), (network_id1, key1)] self.assertEqual(self._tunnel_key_sort(key_list), expected_list) tunnel_key.delete(session, network_id0) key_list = tunnel_key.all_list() self.assertEqual(self._tunnel_key_sort(key_list), [(network_id1, key1)]) tunnel_key.delete(session, network_id1) self.assertEqual(tunnel_key.all_list(), [])
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.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): 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()