<s> import abc <EOL> from neutron_lib . api import converters <EOL> from neutron_lib import exceptions as nexception <EOL> from oslo_config import cfg <EOL> from neutron . _i18n import _ <EOL> from neutron . api import extensions <EOL> from neutron . api . v2 import attributes as attr <EOL> from neutron . api . v2 import resource_helper <EOL> from neutron . pecan_wsgi import controllers <EOL> from neutron . plugins . common import constants <EOL> class RouterNotFound ( nexception . NotFound ) : <EOL> message = _ ( "<STR_LIT>" ) <EOL> class RouterInUse ( nexception . InUse ) : <EOL> message = _ ( "<STR_LIT>" ) <EOL> def __init__ ( self , ** kwargs ) : <EOL> if '<STR_LIT>' not in kwargs : <EOL> kwargs [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> super ( RouterInUse , self ) . __init__ ( ** kwargs ) <EOL> class RouterInterfaceNotFound ( nexception . NotFound ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class RouterInterfaceNotFoundForSubnet ( nexception . NotFound ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class RouterInterfaceInUseByFloatingIP ( nexception . InUse ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class FloatingIPNotFound ( nexception . NotFound ) : <EOL> message = _ ( "<STR_LIT>" ) <EOL> class ExternalGatewayForFloatingIPNotFound ( nexception . NotFound ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class FloatingIPPortAlreadyAssociated ( nexception . InUse ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class RouterExternalGatewayInUseByFloatingIp ( nexception . InUse ) : <EOL> message = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> ROUTERS = '<STR_LIT>' <EOL> FLOATINGIP = '<STR_LIT>' <EOL> FLOATINGIPS = '<STR_LIT>' % FLOATINGIP <EOL> EXTERNAL_GW_INFO = '<STR_LIT>' <EOL> RESOURCE_ATTRIBUTE_MAP = { <EOL> ROUTERS : { <EOL> '<STR_LIT:id>' : { '<STR_LIT>' : False , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT:primary_key>' : True } , <EOL> '<STR_LIT:name>' : { '<STR_LIT>' : True , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { '<STR_LIT>' : attr . NAME_MAX_LEN } , <EOL> '<STR_LIT>' : True , '<STR_LIT:default>' : '<STR_LIT>' } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : True , <EOL> '<STR_LIT:default>' : True , <EOL> '<STR_LIT>' : converters . convert_to_boolean , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT:status>' : { '<STR_LIT>' : False , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { '<STR_LIT>' : attr . TENANT_ID_MAX_LEN } , <EOL> '<STR_LIT>' : True } , <EOL> EXTERNAL_GW_INFO : { '<STR_LIT>' : True , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , '<STR_LIT:default>' : None , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : None , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : <EOL> converters . convert_kvp_list_to_dict , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT:default>' : None , <EOL> '<STR_LIT>' : False , <EOL> } <EOL> } <EOL> } } <EOL> } , <EOL> FLOATINGIPS : { <EOL> '<STR_LIT:id>' : { '<STR_LIT>' : False , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT:primary_key>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True , '<STR_LIT:default>' : None , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT:default>' : None } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : False , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True , '<STR_LIT:default>' : None } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True , '<STR_LIT:default>' : None , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { '<STR_LIT>' : None } , <EOL> '<STR_LIT>' : True , '<STR_LIT:default>' : None } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : True , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { '<STR_LIT>' : attr . TENANT_ID_MAX_LEN } , <EOL> '<STR_LIT>' : True } , <EOL> '<STR_LIT:status>' : { '<STR_LIT>' : False , '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True } , <EOL> } , <EOL> } <EOL> l3_quota_opts = [ <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT:10> , <EOL> help = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) , <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT:50> , <EOL> help = _ ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) , <EOL> ] <EOL> cfg . CONF . register_opts ( l3_quota_opts , '<STR_LIT>' ) <EOL> class L3 ( extensions . ExtensionDescriptor ) : <EOL> @ classmethod <EOL> def get_name ( cls ) : <EOL> return "<STR_LIT>" <EOL> @ classmethod <EOL> def get_alias ( cls ) : <EOL> return "<STR_LIT>" <EOL> @ classmethod <EOL> def get_description ( cls ) : <EOL> return ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> @ classmethod <EOL> def get_updated ( cls ) : <EOL> return "<STR_LIT>" <EOL> @ classmethod <EOL> def get_resources ( cls ) : <EOL> """<STR_LIT>""" <EOL> plural_mappings = resource_helper . build_plural_mappings ( <EOL> { } , RESOURCE_ATTRIBUTE_MAP ) <EOL> plural_mappings [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> attr . PLURALS . update ( plural_mappings ) <EOL> action_map = { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } } <EOL> return resource_helper . build_resource_info ( plural_mappings , <EOL> RESOURCE_ATTRIBUTE_MAP , <EOL> constants . L3_ROUTER_NAT , <EOL> action_map = action_map , <EOL> register_quota = True ) <EOL> def update_attributes_map ( self , attributes ) : <EOL> super ( L3 , self ) . update_attributes_map ( <EOL> attributes , extension_attrs_map = RESOURCE_ATTRIBUTE_MAP ) <EOL> @ classmethod <EOL> def get_pecan_controllers ( cls ) : <EOL> return ( ( ROUTERS , controllers . RoutersController ( ) ) , <EOL> ( FLOATINGIPS , controllers . CollectionsController ( FLOATINGIPS , <EOL> FLOATINGIP ) ) ) <EOL> def get_extended_resources ( self , version ) : <EOL> if version == "<STR_LIT>" : <EOL> return RESOURCE_ATTRIBUTE_MAP <EOL> else : <EOL> return { } <EOL> class RouterPluginBase ( object ) : <EOL> @ abc . abstractmethod <EOL> def create_router ( self , context , router ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def update_router ( self , context , id , router ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def get_router ( self , context , id , fields = None ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def delete_router ( self , context , id ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def get_routers ( self , context , filters = None , fields = None , <EOL> sorts = None , limit = None , marker = None , page_reverse = False ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def add_router_interface ( self , context , router_id , interface_info ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def remove_router_interface ( self , context , router_id , interface_info ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def create_floatingip ( self , context , floatingip ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def update_floatingip ( self , context , id , floatingip ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def get_floatingip ( self , context , id , fields = None ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def delete_floatingip ( self , context , id ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def get_floatingips ( self , context , filters = None , fields = None , <EOL> sorts = None , limit = None , marker = None , <EOL> page_reverse = False ) : <EOL> pass <EOL> def get_routers_count ( self , context , filters = None ) : <EOL> raise NotImplementedError ( ) <EOL> def get_floatingips_count ( self , context , filters = None ) : <EOL> raise NotImplementedError ( ) </s>
