如何进行keystone rest api V3 版本测试
发表于:2024-11-22 作者:千家信息网编辑
千家信息网最后更新 2024年11月22日,如何进行keystone rest api V3 版本测试,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。用户认证,默认域的token
千家信息网最后更新 2024年11月22日如何进行keystone rest api V3 版本测试
如何进行keystone rest api V3 版本测试,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
用户认证,默认域的token
curl -i \ -H "Content-Type: application/json" \ -d '{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "domain": {"id":"default"}, "name": "admin", "password": "openstack" } } } }}' \ http://localhost:5000/v3/auth/tokens ; echo
HTTP/1.1 201 CreatedX-Subject-Token: ecfc51857b5747d2b6438f17e5e2fe0cVary: X-Auth-TokenContent-Type: application/jsonContent-Length: 297X-Openstack-Request-Id: req-86ba31ca-0d90-4130-b6cc-01ebfeb74b31Date: Fri, 15 Jan 2016 02:20:34 GMT{"token": {"methods": ["password"], "expires_at": "2016-01-15T03:20:34.170384Z", "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "ddce55e5af8241ec96e39e511a4928a1", "name": "admin"}, "audit_ids": ["lJW70I0bTcOl5tQ27kKP0Q"], "issued_at": "2016-01-15T02:20:34.170469Z"}}
保存返回的Header,
X-Subject-Token: ecfc51857b5747d2b6438f17e5e2fe0c
带上token和project,获取另一个token
curl -i \ -H "Content-Type: application/json" \ -d '{ "auth": { "identity": { "methods": [ "token" ], "token": { "id": "ecfc51857b5747d2b6438f17e5e2fe0c" } }, "scope": { "project": { "name": "admin", "domain": { "name": "default" } } } }}' \ http://localhost:5000/v3/auth/tokens ; echo
HTTP/1.1 201 CreatedX-Subject-Token: 76d45acefa7d4b928a5573db3a5ff39eVary: X-Auth-TokenContent-Type: application/jsonContent-Length: 4858X-Openstack-Request-Id: req-1b637a94-66bb-4a05-83b5-b1531c85a56dDate: Fri, 15 Jan 2016 02:32:02 GMT{"token": {"methods": ["token", "password"], "roles": [{"id": "a7db951cbc0040bfab9f1b9124b9e6a9", "name": "admin"}], "expires_at": "2016-01-15T03:20:34.170384Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "name": "admin"}, "catalog": [{"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:8776/v1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "internal", "id": "62c8ac942c8b4930936ebc15d02016ea"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8776/v1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "public", "id": "95fac1cf199345a6b30cf216ada6114a"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8776/v1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "admin", "id": "c8b4bd03de5b494b8dad82b811af883b"}], "type": "volume", "id": "58f08b76576c4d13b79c691fbc7cae11", "name": "cinder"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:35357/v2.0", "region": "RegionOne", "interface": "admin", "id": "04ae0815504e4b01bb69096de2655ed7"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:5000/v2.0", "region": "RegionOne", "interface": "public", "id": "a3e08f9bf91845cbb01ee17b4381fef8"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:5000/v2.0", "region": "RegionOne", "interface": "internal", "id": "c4d004f6ff9449ecb4beb3a3ade79a5b"}], "type": "identity", "id": "5a7e533e712b46dcbc1b520dadc1d17f", "name": "keystone"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:8774/v2/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "public", "id": "4e09a9f6eb8342feac18753b47f34014"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8774/v2/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "admin", "id": "96685c58c74c408fa2eb30555cd9e4e5"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8774/v2/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "internal", "id": "e8802a42ed664c25af8f60998c503240"}], "type": "compute_legacy", "id": "7ec54c4e744c44d48e3f9fa435daabbe", "name": "nova_legacy"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:8776/v2/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "internal", "id": "1ef7bbe882bf4a04a33332de35c70e84"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8776/v2/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "public", "id": "64b1b4be5a8548e5b1e7343feec38c3d"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8776/v2/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "admin", "id": "7f1635373c9b4651867bdccda1a0f8d1"}], "type": "volumev2", "id": "874e95350ad84f0998d4a809ad4925ea", "name": "cinderv2"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:9696/", "region": "RegionOne", "interface": "internal", "id": "4bb75d5dea254955ab0e237f44572ddf"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:9696/", "region": "RegionOne", "interface": "admin", "id": "6f8c2b0902a54ec39ecbeea8877ec9a7"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:9696/", "region": "RegionOne", "interface": "public", "id": "cf888a8965944479a5df1b8007eb84db"}], "type": "network", "id": "9d207ba3d5c248fd911cfcce51ef814a", "name": "neutron"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "internal", "id": "1b7f94fa75964ee7aa501d28573333a2"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "public", "id": "3217e1bb5f114c268c74e8d1550912d6"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d", "region": "RegionOne", "interface": "admin", "id": "d0796d4c2ddb4a67a339908158945d49"}], "type": "compute", "id": "df1c318a37ec432c82571c15ac6442c8", "name": "nova"}, {"endpoints": [{"region_id": "RegionOne", "url": "http://172.16.10.33:9292", "region": "RegionOne", "interface": "admin", "id": "15baf7fdf5e348e59294f1eda171dc67"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:9292", "region": "RegionOne", "interface": "public", "id": "1acb1f06c7d44885969e4facd2e478ae"}, {"region_id": "RegionOne", "url": "http://172.16.10.33:9292", "region": "RegionOne", "interface": "internal", "id": "8c775c8498684cb1847b79a640849427"}], "type": "image", "id": "e5a05e1e70894013a4533e748c9c5e87", "name": "glance"}], "extras": {}, "user": {"domain": {"id": "default", "name": "Default"}, "id": "ddce55e5af8241ec96e39e511a4928a1", "name": "admin"}, "audit_ids": ["qa8u-5naTXiolgh6vXM2Dg", "lJW70I0bTcOl5tQ27kKP0Q"], "issued_at": "2016-01-15T02:32:02.755979Z"}}
返回一个在project范围内的token:X-Subject-Token: 76d45acefa7d4b928a5573db3a5ff39e
body内包含许多endpoint这时就可以使用token向其他服务发起请求。例如:获取flavors
curl -i -H "X-Auth-Token: 76d45acefa7d4b928a5573db3a5ff39e" http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors; echo
HTTP/1.1 200 OKContent-Type: application/jsonContent-Length: 1692X-Openstack-Nova-Api-Version: 2.1Vary: X-OpenStack-Nova-API-VersionX-Compute-Request-Id: req-58676e13-4aea-4152-acca-00ea3f87e923Date: Fri, 15 Jan 2016 02:46:50 GMT{"flavors": [{"id": "1", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/1", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/1", "rel": "bookmark"}], "name": "m1.tiny"}, {"id": "2", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/2", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/2", "rel": "bookmark"}], "name": "m1.small"}, {"id": "3", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/3", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/3", "rel": "bookmark"}], "name": "m1.medium"}, {"id": "4", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/4", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/4", "rel": "bookmark"}], "name": "m1.large"}, {"id": "42", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/42", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/42", "rel": "bookmark"}], "name": "m1.nano"}, {"id": "5", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/5", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/5", "rel": "bookmark"}], "name": "m1.xlarge"}, {"id": "84", "links": [{"href": "http://localhost:8774/v2.1/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/84", "rel": "self"}, {"href": "http://localhost:8774/9c2b1ae7eb0d48e2b7ed3b4399ee4d3d/flavors/84", "rel": "bookmark"}], "name": "m1.micro"}]}
关于如何进行keystone rest api V3 版本测试问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注行业资讯频道了解更多相关知识。
问题
版本
测试
更多
帮助
解答
易行
简单易行
内容
小伙
小伙伴
方法
用户
知识
篇文章
范围
行业
资讯
资讯频道
频道
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
阿里云服务器安全警告
安卓软件开发就业前景怎样
电脑找不到ip服务器
软件开发合格 bug率
网络安全暴力攻击的原理
数据库系统os
和利时软件开发岗位
软件开发好的方向
数据库软件技术教程
碧蓝航线能跨服务器
redhat卫星服务器
网络安全有关句子
国际十大网络安全品牌
教务管理系统数据库开题报告
软件开发技术壁垒怎么写
郑州晨科软件开发有限公司
数据库怎么添加硬盘
劲舞团显示正在登陆服务器
微博国际版服务器
idea软件开发应用手册
施工生产调度管理软件开发
云存储挂载到宝塔云服务器
深圳停车系统软件开发多少钱
护苗网络安全课一腾讯
数据库下载官网下载
蔚来汽车面试软件开发
数据库最基本的集合运算
劲舞团服务器
深圳信息软件开发方案
局部网络安全