Skip to content

Rest API Reference

Carlos Marques edited this page Jul 5, 2019 · 16 revisions

Rest API

The Infrastructure Abstraction is reachable on the Rest API on the follow options:

VIMs:

Action HTTP Method Endpoint
List existing VIMs GET curl http://localhost:8083/api/ia/v1/vims
List existing VIMs from specific type GET curl http://localhost:8083/api/ia/v1/vims?type={type}
Get specific VIM based on uuid GET curl http://localhost:8083/api/ia/v1/vims/{vim_uuid}
Add a new VIM POST curl -X POST -H "content-type:application/json" http://localhost:8083/api/ia/v1/vims/{type} -d '{json_data}'
Update specific VIM based on uuid PATCH curl -X POST -H "content-type:application/json" http://localhost:8083/api/ia/v1/vims/{type}/{vim_uuid} -d '{json_data}'
Delete specific VIM based on uuid DELETE curl -X DELETE http://localhost:8083/api/ia/v1/vims/{vim_uuid}

Input Parameters Examples

type:

  • mock
  • heat
  • k8s
  • endpoint
  • emu

json_data for type mock:

{
        "uuid": "1111-22222222-33333333-3333",    // optional
        "name": "Mock", 
        "country": "Greece",                      // optional
        "city": "Athens-North",                   // optional
        "endpoint": "10.100.32.200", 
        "username": "user",                       // optional
        "password": "pass",                       // optional
        "config": {...}                           // optional

}

json_data for type heat:

{
        "uuid": "1111-22222222-33333333-4444",                                   // optional
        "name": "MyOpenstackVIM", 
        "country": "Portugal",                                                   // optional
        "city": "Aveiro",                                                        // optional
        "endpoint": "172.31.2.1", 
        "username": "tango", 
        "password": "t4ng0", 
        "tenant": "5gtango",
        "domain": "Default",                                                     // optional
        "network_endpoint": "172.31.2.2",                                        // Use 'Mock' if empty
        "private_network_prefix": "192.168.0.0",
        "private_network_length": "16",
        "external_network_id": "3283ec5d-984e-46e7-8eac-312a79b878f1",
        "external_router_id": "eecdb2e2-bae8-443e-b96a-bc8871cf4ddc",
        "external_router_ip": "172.31.2.3",                                      // optional
        "management_flow_ip": "172.31.2.4",                                      // optional
        "floating_ip_ranging": "172.31.2.5-172.31.2.15, 172.31.2.25-172.31.2.30" // optional
}

json_data for type k8s:

{
        "uuid": "1111-22222222-33333333-5555",     // optional
        "name": "My K8s VIM", 
        "country": "Milky Way",                    // optional
        "city": "Random Galaxy",                   // optional
        "endpoint": "6.6.6.6", 
        "config": {...}

}

json_data for type endpoint:

{
        "uuid": "1111-22222222-33333333-6666",
        "name": "NeP_1, 
        "country": "Spain",                    // optional
        "city": "Barcelona",                   // optional
        "endpoint": "", 
        "config": {...}                        // optional

}

json_data for type emu:

{
        "uuid": "1111-22222222-33333333-7777",
        "name": "Emulator, 
        "country": "Spain",                    // optional
        "city": "Barcelona",                   // optional
        "endpoint": "", 
        "config": {...}                        // optional

}

Query VIMs details:

Action HTTP Method Endpoint
List external networks in a given openstack GET curl -X GET -H "content-type:application/json" http://localhost:8083/api/ia/v1/vims/heat/networks?query_params
List routers in a given openstack and a given external network GET curl -X GET -H "content-type:application/json" http://localhost:8083/api/ia/v1/vims/heat/routers/{network_uuid}?query_params

Input Parameters Examples

query_params required for list networks/routers:

   endpoint=172.31.2.1& 
   username=tango&
   password=t4ng0& 
   tenant=5gtango&
   domain=Default

Output Parameters Examples

for list networks:

[{
        "name": "external", 
        "id": "3283ec5d-984e-46e7-8eac-312a79b878f1"
},
{
        "name": "provider", 
        "id": "53d43a3e-8c86-48e6-b1cb-f1f2c48833de"
}]

for list routers:

[{
        "name": "tng-router", 
        "id": "eecdb2e2-bae8-443e-b96a-bc8871cf4ddc"
},
{
        "name": "sonata.dem-router", 
        "id": "e8cdd5c7-191f-4215-83f3-53ee1113db86"
}]

WIMs:

Action HTTP Method Endpoint
List existing WIMs GET curl http://localhost:8083/api/ia/v1/wims
List existing WIMs from specific type GET curl http://localhost:8083/api/ia/v1/wims?type={type}
Get specific WIM based on uuid GET curl http://localhost:8083/api/ia/v1/wims/{wim_uuid}
Add a new WIM POST curl -X POST -H "content-type:application/json" http://localhost:8083/api/ia/v1/wims/{type} -d '{json_data}'
Update specific WIM based on uuid PATCH curl -X POST -H "content-type:application/json" http://localhost:8083/api/ia/v1/wims/{type}/{wim_uuid} -d '{json_data}'
Delete specific WIM based on uuid DELETE curl -X DELETE http://localhost:8083/api/ia/v1/wims/{wim_uuid}

Input Parameters Examples

type:

  • tapi
  • emu

json_data for type tapi:

{
        "uuid": "1111-22222222-33333333-4444",     // optional
        "name": "MyTAPIWIM", 
        "endpoint": "172.31.2.1:8080", 
        "username": "tango",                       // optional
        "password": "t4ng0",                       // optional
        "authkey": "...",                          // optional
        "vim_list": [
             "vim_uuid1",
             "vim_uuid2",
             "vim_uuid3"
        ]
}

json_data for type emu:

{
        "uuid": "1111-22222222-33333333-7777",     // optional
        "name": "Emulator", 
        "endpoint": "", 
        "vim_list": [
             "vim_uuid1",
             "vim_uuid2",
             "vim_uuid3"
        ]
}

Returned codes

Expected returned data for all the mentioned endpoint is:

  • HTTP code 200 (Ok)
  • HTTP code 201 (Created)
  • HTTP code 400 (Bad Request)
  • HTTP code 404 (Not Found)
  • HTTP code 405 (Method Not Allowed)
  • HTTP code 415 (Unsupported Media Type)