def allocate_hosting_port(self, context, router_id, port_db, network_type,<EOL>hosting_device_id):
l3admin_tenant_id = self._dev_mgr.l3_tenant_id()<EOL>hostingport_name = '<STR_LIT>' + port_db['<STR_LIT:id>'][:<NUM_LIT:8>]<EOL>p_spec = {'<STR_LIT:port>': {<EOL>'<STR_LIT>': l3admin_tenant_id,<EOL>'<STR_LIT>': True,<EOL>'<STR_LIT:name>': hostingport_name,<EOL>'<STR_LIT>': port_db['<STR_LIT>'],<EOL>'<STR_LIT>': bc.constants.ATTR_NOT_SPECIFIED,<EOL>'<STR_LIT>': [],<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': False}}<EOL>try:<EOL><INDENT>hosting_port = self._core_plugin.create_port(context, p_spec)<EOL><DEDENT>except n_exc.NeutronException as e:<EOL><INDENT>LOG.error('<STR_LIT>'<EOL>'<STR_LIT>', e)<EOL>self.delete_hosting_device_resources(<EOL>context, l3admin_tenant_id, hosting_port)<EOL>hosting_port = None<EOL><DEDENT>finally:<EOL><INDENT>if hosting_port:<EOL><INDENT>return {'<STR_LIT>': hosting_port['<STR_LIT:id>'],<EOL>'<STR_LIT>': None}<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>
Allocates a hosting port for a logical port.

        We create a hosting port for the router port