xxh test openstack api operation

Case 1: Capture the packet to construct the url of the new cloud host (instance)
1. Wireshark opens the network card to capture vmware vmnet8, and the filter condition tcp.port == 8774 && http.request.method == POST starts!

2. Create a new instance named wireshark on the
xxh test openstack api operation
web 3. Filter condition tcp.port == 8774 && http.request.method == POST has data, open this http stream, the picture is as follows:
xxh test openstack api operation

POST /v2.1/c0e784c602af4b40933a78bc3dcda542/servers HTTP/1.1
Host: controller:8774
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: python-novaclient
X-Auth-Project-Id: c0e784c602af4b40933a78bc3dcda542
Content-Type: application/json
X-Auth-Token: gAAAAABfol5E8fphn3g-q4zoqt089FHoSefQL1OFeTIg6JqFPvB53mHZMX6-qPK0pNYYa0ce86z_3g_yNNEWh2HlkEVaZq16CIC6MmVcQeyTy69fpRlOYfZp90-FiEDiHFQlPMPoZlDb0yrhraaxKPW4jck9cbzAltnTCYkd8IEfu2R8JYFG0kBuZmQp-1-8Ksd_ZwQQS8O0
Content-Length: 349

{"server": {"name": "wireshark", "imageRef": "4dea33ea-a34f-4e07-845a-4c212deee901", "availability_zone": "nova", "key_name": "mykey", "flavorRef": "0", "OS-DCF:diskConfig": "AUTO", "max_count": 1, "min_count": 1, "networks": [{"uuid": "a730ba59-ca28-48e6-a7f6-11703e879b30"}], "security_groups": [{"name": "04a70b53-eea2-4b45-a11a-d66624b2c612"}]}}

Based on the above information, construct an api url and use this url to construct the second virtual machine wireshark2. The api url I constructed is as follows:
curl -X POST -H "Content-Type: application/json" -H "X- the Token-auth: gAAAAABfol5E8fphn3g-q4zoqt089FHoSefQL1OFeTIg6JqFPvB53mHZMX6-qPK0pNYYa0ce86z_3g_yNNEWh2HlkEVaZq16CIC6MmVcQeyTy69fpRlOYfZp90-FiEDiHFQlPMPoZlDb0yrhraaxKPW4jck9cbzAltnTCYkd8IEfu2R8JYFG0kBuZmQp-1-8Ksd_ZwQQS8O0 "-d '
{
" Server ": {
" name ":" wireshark2 ",
" imageRef ":" 4dea33ea-A34F-4e07-845a-4c212deee901 ",
" availability_zone": "nova",
"key_name": "mykey",
"flavorRef": "0",
"OS-DCF:diskConfig": "AUTO",
"max_count": 1,
"min_count": 1,
"networks": [{
"uuid": "a730ba59-ca28-48e6-a7f6-11703e879b30"
}],
"security_groups": [{
"name": "04a70b53-eea2-4b45-a11a-d66624b2c612"
}]
}
}' http://controller:8774/v2.1/c0e784c602af4b40933a78bc3dcda542/servers
After that, the virtual machine was successfully created! (Note that the formatted json string is replaced by a space with a text tool before the cli is executed!)
xxh test openstack api operation

Case 2: Capture the packet to construct the url to delete the cloud host (instance)

(2) Delete the host capture packet to get the api
capture filter condition is tcp.port == 8774 && http.request.method == DELETE to
obtain the packet capture information as follows:

DELETE /v2.1/c0e784c602af4b40933a78bc3dcda542/servers/e22e0fd1-44e2-487d-a37c-5d36c721ec1b HTTP/1.1
Host: controller:8774
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: python-novaclient
X-Auth-Project-Id: c0e784c602af4b40933a78bc3dcda542
X-Auth-Token: gAAAAABfol5E8fphn3g-q4zoqt089FHoSefQL1OFeTIg6JqFPvB53mHZMX6-qPK0pNYYa0ce86z_3g_yNNEWh2HlkEVaZq16CIC6MmVcQeyTy69fpRlOYfZp90-FiEDiHFQlPMPoZlDb0yrhraaxKPW4jck9cbzAltnTCYkd8IEfu2R8JYFG0kBuZmQp-1-8Ksd_ZwQQS8O0
Content-Length: 0

The following is what I built from the above package!
Preparing to delete wireshark4 his identity is 34d8-4373-a7b8-3b6f6de01aec-c7a8e5bc
curl -X DELETE -H "Content-Type: the Application / json" -H "the X-Auth-Token-: gAAAAABfol5E8fphn3g-q4zoqt089FHoSefQL1OFeTIg6JqFPvB53mHZMX6-qPK0pNYYa0ce86z_3g_yNNEWh2HlkEVaZq16CIC6MmVcQeyTy69fpRlOYfZp90-FiEDiHFQlPMPoZlDb0yrhraaxKPW4jck9cbzAltnTCYkd8IEfu2R8JYFG0kBuZmQp-1- 8Ksd_ZwQQS8O0" http://controller:8774/v2.1/c0e784c602af4b40933a78bc3dcda542/servers/c7a8e5bc-34d8-4373-a7b8-3b6f6de01aec

Note: http://controller:8774/v2.1/c0e784c602af4b40933a78bc3dcda542/servers/[id]
where c0e784c602af4b40933a78bc3dcda542 is the id of the admin project
xxh test openstack api operation
xxh test openstack api operation

Case 3: Capture packets to construct URLs for deleting volumes, deleting mirrors, etc. can be obtained in a similar way.
In addition, the token can also be captured first like the teacher and stored using the $token variable to directly reference, so there is no need to write so long.

I'll add it tomorrow

(3) Delete a volume to capture packets to get api
tcp.port == 8776 && http.request.method == DELETE

(4) New volume
tcp.port == 8776 && http.request.method == POST

Guess you like

Origin blog.51cto.com/8189171/2546795