def create_router(self, name, tenant_id, subnet_lst):
try:<EOL><INDENT>body = {'<STR_LIT>': {'<STR_LIT:name>': name, '<STR_LIT>': tenant_id,<EOL>'<STR_LIT>': True}}<EOL>router = self.neutronclient.create_router(body=body)<EOL>rout_dict = router.get('<STR_LIT>')<EOL>rout_id = rout_dict.get('<STR_LIT:id>')<EOL><DEDENT>except Exception as exc:<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>", {'<STR_LIT:name>': name, '<STR_LIT>': str(exc)})<EOL>return None<EOL><DEDENT>ret = self.add_intf_router(rout_id, tenant_id, subnet_lst)<EOL>if not ret:<EOL><INDENT>try:<EOL><INDENT>ret = self.neutronclient.delete_router(rout_id)<EOL><DEDENT>except Exception as exc:<EOL><INDENT>LOG.error("<STR_LIT>",<EOL>{'<STR_LIT:name>': name, '<STR_LIT>': str(exc)})<EOL><DEDENT>return None<EOL><DEDENT>return rout_id<EOL>
Create a openstack router and add the interfaces.