Custom Search
Showing posts with label ipam. Show all posts
Showing posts with label ipam. Show all posts

Sunday, November 23, 2014

OpenStack OpenContrail Neutron IPAM API examples

1)
List all IPAMs

#neutron --debug ipam-list

a)

curl request generated by above CLI command
#curl -s http://127.0.0.1:9696/v2.0/ipams.json -X GET -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" | python -mjson.tool

#curl -s http://127.0.0.1:9696/v2.0/ipams -X GET -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" | python -mjson.tool


2)
Show IPAM

#neutron --debug ipam-show 58f9369b-d3ef-428a-bbc9-2b8c0e06b752

a)

curl request generated by above CLI command 
#curl -s http://127.0.0.1:9696/v2.0/ipams/58f9369b-d3ef-428a-bbc9-2b8c0e06b752.json -X GET -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" | python -mjson.tool

#curl -s http://127.0.0.1:9696/v2.0/ipams/58f9369b-d3ef-428a-bbc9-2b8c0e06b752 -X GET -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" | python -mjson.tool


3)
Delete IPAM

#neutron --debug ipam-delete d47aa080-cf94-46cc-9c07-da11819dc7ca


a)
curl request generated by above CLI command
#curl -s http://127.0.0.1:9696/v2.0/ipams/d47aa080-cf94-46cc-9c07-da11819dc7ca.json -X DELETE -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" | python -mjson.tool

#curl -s http://127.0.0.1:9696/v2.0/ipams/d47aa080-cf94-46cc-9c07-da11819dc7ca -X DELETE -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" | python -mjson.tool


4)
Create IPAM

#neutron --debug ipam-create ipam1

a) 
curl request generated by above CLI command
#curl -s http://127.0.0.1:9696/v2.0/ipams.json -X POST -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"ipam": {"name": "ipam1", "mgmt": {"method": "fixed"}}}'

#curl -s http://127.0.0.1:9696/v2.0/ipams -X POST -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"ipam": {"name": "ipam1", "mgmt": {"method": "fixed"}}}' | python -mjson.tool


b)

Create IPAM with "mgmt" databy making custom curl request
#curl -i http://127.0.0.1:9696/v2.0/ipams.json -X POST -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"ipam": {"name": "ipam28", "mgmt": {"ipam_method": null, "ipam_dns_method": "virtual-dns-server", "ipam_dns_server": {"tenant_dns_server_address": {"ip_address": []}, "virtual_dns_server_name": "default-domain:vdns"}, "dhcp_option_list": {"dhcp_option": [{"dhcp_option_value": "mydomain", "dhcp_option_name": "15"}, {"dhcp_option_value": "192.168.56.1", "dhcp_option_name": "4"}]}, "host_routes": null, "cidr_block": null}}}'

5)
Update IPAM


#neutron --debug ipam-update 07ae76d2-9fe4-466f-a98e-f82bc2b819d0 --name ipam5


a)

curl request generated by above CLI command
#curl -s http://127.0.0.1:9696/v2.0/ipams/07ae76d2-9fe4-466f-a98e-f82bc2b819d0.json -X PUT -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"ipam": {"name": "ipam5"}}' | python -mjson.tool

#curl -s http://127.0.0.1:9696/v2.0/ipams/07ae76d2-9fe4-466f-a98e-f82bc2b819d0 -X PUT -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"ipam": {"name": "ipam5"}}' | python -mjson.tool


b)
Update an IPAM's "mgmt" data by making custom curl request
#curl -i http://127.0.0.1:9696/v2.0/ipams/2e5810de-c681-4b0d-a346-99469f817b06.json -X PUT -H "X-Auth-Token:$TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-neutronclient" -d '{"ipam": {"mgmt": {"ipam_method": null, "ipam_dns_method": "virtual-dns-server", "ipam_dns_server": {"tenant_dns_server_address": {"ip_address": []}, "virtual_dns_server_name": "default-domain:vdns"}, "dhcp_option_list": {"dhcp_option": [{"dhcp_option_value": "mydomain", "dhcp_option_name": "15"}, {"dhcp_option_value": "192.168.56.1", "dhcp_option_name": "4"}]}, "host_routes": null, "cidr_block": null}}}'