Skip to content

Commit

Permalink
Merge pull request #13 from mF2C/atos
Browse files Browse the repository at this point in the history
LM and UM documentation updated
  • Loading branch information
Cristovao Cordeiro committed Apr 5, 2019
2 parents b593b26 + 64cb774 commit 545eeea
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 111 deletions.
53 changes: 22 additions & 31 deletions documentation/developer_guide/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CIMI
----
*(these instructions have not been tested in Windows)*

CIMI will be running over HTTPS (through Traefik).
CIMI will be running over HTTPS (through Traefik).
Since this is a development and testing environment, we'll use a special CIMI HTTP header (:code:`slipstream-authn-info:internal ADMIN`)
to bypass user authentication and authorization, by impersonating *admin*.
Let's also assume that the TLS certificates in-use were self-signed, thus we'll need :code:`-k`.
Expand Down Expand Up @@ -76,7 +76,7 @@ If the SMTP configuration is enabled, you shall receive a user validation email
Login
~~~~~

You **must have** validated the user before you can login.
You **must have** validated the user before you can login.
To login, simply create a session.

.. code-block:: bash
Expand Down Expand Up @@ -151,35 +151,24 @@ Example with all optional fields:
"agent_type": "normal",
"num_agents": 2,
"cpu_arch": "x86-64",
"os": "linux",
"os": "linux",
"memory_min": 1000,
"storage_min": 100,
"disk": 100,
"storage_min": 100,
"disk": 100,
"req_resource": ["Location"],
"opt_resource": ["SenseHat"]
}'''
Create a service instance
Launch a service (create a service instance)
~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
mf2c-curl-post https://localhost/api/service-instance -d '''
{
"user": {"href": "user/asasdasd"},
"service": {"href": "service/asasdasd"},
"agreement": {"href": "sla/asdasdasd"},
"status": "running",
"agents": [
{
"agent": {"href": "device/testdevice"},
"port": 8081,
"container_id": "0938afd12323",
"status": "running",
"num_cpus": 3,
"allow": true
}
]
"service_id": "service/6d1ba52b-4ce7-4333-914f-e434ddeeb591",
"user_id": "user/testuser1",
"agreement_id": "agreement/a7a30e2b-2ba1-4370-a1d4-af85c30d8713"
}'''
Expand All @@ -190,14 +179,14 @@ Create a "sharing-model" record
mf2c-curl-post https://localhost/api/sharing-model -d '''
{
"description": "example of a sharing model resource instance",
"max_apps": 3,
"gps_allowed": false,
"max_cpu_usage": 1,
"max_memory_usage": 1024,
"max_storage_usage": 500,
"max_bandwidth_usage": 20,
"battery_limit": 10
"user_id": "user/testuser2",
"device_id": "device/c749fcbb-651d-4ae6-877a-125e372398a4",
"gps_allowed": false,
"max_cpu_usage": 3,
"max_memory_usage": 3,
"max_storage_usage": 3,
"max_bandwidth_usage": 3,
"battery_limit": 50
}'''
Expand All @@ -208,8 +197,11 @@ Create a user profile
mf2c-curl-post https://localhost/api/user-profile -d '''
{
"service_consumer": true,
"resource_contributor": false
"user_id": "user/testuser2",
"device_id": "device/c749fcbb-651d-4ae6-877a-125e372398a4",
"service_consumer": true,
"resource_contributor": true,
"max_apps": 1
}'''
Create an service level agreement
Expand Down Expand Up @@ -349,4 +341,3 @@ Add the service operation report
"operation": "newMethod",
"execution_time": 123.32
}'''
139 changes: 59 additions & 80 deletions documentation/user_guide/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,39 +157,40 @@ For any workflow to work, the first step is to submit a service to the service m
Lifecycle Management module
-----------------------------
The Lifecycle Management component is part of the Platform Manager's Service Orchestration module. It is an internal component responsible for managing the services running in the mF2C clusters. For IT-1 this component will be accessible through *http://lifecycle:46000/api/v1*.
The Lifecycle Management component is part of the Platform Manager's Service Orchestration module. It is an internal component responsible for managing the services running in the mF2C clusters. For IT-2 this component will be accessible through *http://lifecycle:46000/api/v2*.
Services are based on docker images. Thus, when a service is deployed in one or more agents, the lifecycle creates a docker container in each of them.
Deploy and start a service
~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. The lifecycle offers different ways for deploying and starting a service in a set of mF2C agents. If the lifecycle is working together with the other mF2C components, then the call should contain only three parameters: the service identifier, a user identifier (the on that generates the call), and the SLA agreement identifier.
The lifecycle offers different ways for deploying and starting a service in a set of mF2C agents.
1. If the lifecycle is working together with the other mF2C components, then the call should contain only three parameters: the service identifier, a user identifier (the on that generates the call), and the SLA agreement identifier.
.. code-block:: bash
cat >post_service1.json <<EOF
{
"service_id": "service/c6aeb25c-ab2f-4207-8304-1eaf8ebcda6e",
"user_id": "rsucasas",
"agreement_id": "agreement/19e4cf61-6a9b-4d88-9f78-2408d568ed0e"
}
"service_id": "service/6d1ba52b-4ce7-4333-914f-e434ddeeb591",
"user_id": "user/testuser1",
"agreement_id": "agreement/a7a30e2b-2ba1-4370-a1d4-af85c30d8713"
}
EOF
curl -H "Content-Type: application/json" -X POST https://lifecycle:46000/api/v1/lifecycle -d @post_service1.json --insecure
curl -H "Content-Type: application/json" -X POST https://lifecycle:46000/api/v2/lm/service -d @post_service1.json --insecure
2. If the user wants to specify the agents where the service will be deployed, then we need another parameter: a list of agents
.. code-block:: bash
cat >post_service2.json <<EOF
{
"service_id": "service/c6aeb25c-ab2f-4207-8304-1eaf8ebcda6e",
"user_id": "rsucasas",
"agreement_id": "agreement/19e4cf61-6a9b-4d88-9f78-2408d568ed0e",
"agents_list": [{"agent_ip": "192.168.252.41"}, {"agent_ip": "192.168.252.42"}]
}
"service_id": "service/6d1ba52b-4ce7-4333-914f-e434ddeeb591",
"user_id": "user/testuser1",
"agreement_id": "agreement/a7a30e2b-2ba1-4370-a1d4-af85c30d8713"
"agents_list": [{"agent_ip": "192.168.252.41"}, {"agent_ip": "192.168.252.42"}]
}
EOF
curl -H "Content-Type: application/json" -X POST https://lifecycle:46000/api/v1/lifecycle -d @post_service2.json --insecure
curl -H "Content-Type: application/json" -X POST https://lifecycle:46000/api/v2/lm/service -d @post_service2.json --insecure
3. Finally, if the user wants to specify the service to be deployed, then we need to include the service content in the call to the lifecycle:
Expand All @@ -198,41 +199,28 @@ Deploy and start a service
cat >post_service3.json <<EOF
{
"service": {
"id": "service/9fbfd7cd-4154-450e-aeab-7a6b84153206",
"name": "app_compss_test",
"description": "app-compss Service",
"exec": "mf2c/compss-test:latest",
"resourceURI": "/app-compss",
"category": {
"cpu": "low",
"memory": "low",
"storage": "low",
"inclinometer": false,
"temperature": false,
"jammer": false,
"location": false,
"accelerometer": false,
"humidity": false,
"battery_level": false,
"door_sensor": false,
"pump_sensor": false,
"air_pressure": false,
"ir_motion": false
},
"exec_type": "compss",
"exec_ports": [
46100,
46101,
46102,
46103
]
},
"user_id": "rsucasas",
"agreement_id": "agreement/19e4cf61-6a9b-4d88-9f78-2408d568ed0e",
"agents_list": [{"agent_ip": "192.168.252.41"}, {"agent_ip": "192.168.252.42"}]
}
"name": "nginx-server-mf2c",
"description": "nginx running on docker - mf2c version",
"exec": "nginx",
"os": "linux",
"disk": 100,
"category": 0,
"num_agents": 2,
"exec_type": "docker",
"exec_ports": [80],
"agent_type": "normal",
"cpu_arch": "x86-64",
"memory_min": 1000,
"storage_min": 100,
"req_resource": [],
"opt_resource": []
},
"user_id": "user/testuser1",
"agreement_id": "agreement/a7a30e2b-2ba1-4370-a1d4-af85c30d8713"
"agents_list": [{"agent_ip": "192.168.252.41"}, {"agent_ip": "192.168.252.42"}]
}
EOF
curl -H "Content-Type: application/json" -X POST https://lifecycle:46000/api/v1/lifecycle -d @post_service3.json --insecure
curl -H "Content-Type: application/json" -X POST https://lifecycle:46000/api/v2/lm/service -d @post_service3.json --insecure
If the service is successfully deployed, then the response should contain the resulting service instance object:
Expand Down Expand Up @@ -314,26 +302,24 @@ Stop and start a service instance
.. code-block:: bash
cat >put_stop_service_instance.json <<EOF
{
"service_instance_id":"9a22a9a7-6a9c-40e9-b2cf-983dde76293e",
"operation":"stop"
}
EOF
curl -H "Content-Type: application/json" -X PUT https://lifecycle:46000/api/v1/lifecycle -d @put_stop_service_instance.json --insecure
cat >put_stop_service_instance.json <<EOF
{
"operation":"stop"
}
EOF
curl -H "Content-Type: application/json" -X PUT https://lifecycle:46000/api/v2/lm/service-instance/2f6da0d0-e1e9-44fb-b03f-4259ce55a8f7 -d @put_stop_service_instance.json --insecure
2. And it can be restarted again with the following command:
.. code-block:: bash
cat >put_start_service_instance.json <<EOF
{
"service_instance_id":"9a22a9a7-6a9c-40e9-b2cf-983dde76293e",
"operation":"start"
}
EOF
curl -H "Content-Type: application/json" -X PUT https://lifecycle:46000/api/v1/lifecycle -d @put_start_service_instance.json --insecure
cat >put_start_service_instance.json <<EOF
{
"operation":"start"
}
EOF
curl -H "Content-Type: application/json" -X PUT https://lifecycle:46000/api/v2/lm/service-instance/2f6da0d0-e1e9-44fb-b03f-4259ce55a8f7 -d @put_start_service_instance.json --insecure
Sart a job (COMPSs services)
Expand All @@ -347,14 +333,12 @@ Services based on COMPSs can also run specific jobs in the mF2C agents. The life
cat >put_start_job.json <<EOF
{
"service_instance_id":"9a22a9a7-6a9c-40e9-b2cf-983dde76293e",
"operation":"start-job",
"parameters":"<ceiClass>es.bsc.compss.test.TestItf</ceiClass><className>es.bsc.compss.test.Test</className><methodName>main</methodName><parameters><params paramId='0'><direction>IN</direction><type>OBJECT_T</type><array paramId='0'><componentClassname>java.lang.String</componentClassname><values><element paramId='0'><className>java.lang.String</className><value xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xsi:type='xs:string'>3</value></element></values></array></params></parameters>"
"operation":"start-job",
"parameters":"<ceiClass>es.bsc.compss.test.TestItf</ceiClass><className>es.bsc.compss.test.Test</className><methodName>main</methodName><parameters><params paramId='0'><direction>IN</direction><type>OBJECT_T</type><array paramId='0'><componentClassname>java.lang.String</componentClassname><values><element paramId='0'><className>java.lang.String</className><value xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xsi:type='xs:string'>3</value></element></values></array></params></parameters>"
}
EOF
curl -H "Content-Type: application/json" -X PUT https://lifecycle:46000/api/v1/lifecycle -d @put_start_job.json --insecure
curl -H "Content-Type: application/json" -X PUT https://lifecycle:46000/api/v2/lm/service-instance/2f6da0d0-e1e9-44fb-b03f-4259ce55a8f7 -d @put_start_job.json --insecure
For IT-1 we need to pass the lifecycle part of the XML needed ('parameters') to call the COMPSs REST API.
Terminate a service instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -365,12 +349,7 @@ The call to terminate a service instance, stops and removes the service instance
.. code-block:: bash
cat >delete_service_instance.json <<EOF
{
"service_instance_id":"9a22a9a7-6a9c-40e9-b2cf-983dde76293e"
}
EOF
curl -H "Content-Type: application/json" -X DELETE https://lifecycle:46000/api/v1/lifecycle -d @delete_service_instance.json --insecure
curl -H "Content-Type: application/json" -X DELETE https://lifecycle:46000/api/v2/lm/service-instance/2f6da0d0-e1e9-44fb-b03f-4259ce55a8f7 --insecure
Get service instances
Expand All @@ -380,24 +359,24 @@ Get service instances
.. code-block:: bash
curl https://lifecycle:46000/api/v1/lifecycle/service-instance/all --insecure
curl https://lifecycle:46000/api/v2/lm/service-instance/all --insecure
2. To get a specific service instance:
.. code-block:: bash
curl https://lifecycle:46000/api/v1/lifecycle/service-instance/4e1ab919-7a02-4260-993a-e0f5382ea580 --insecure
curl https://lifecycle:46000/api/v2/lm/service-instance/4e1ab919-7a02-4260-993a-e0f5382ea580 --insecure
Landscaper module
-----------------------------
The Landscaper component is part of the Platform Manager's Service Orchestration module.
The Landscaper component is part of the Platform Manager's Service Orchestration module.
It constructs a graph model of the computing infrastructure. The graph details what service are running on what virtual infrastructure, and on which physical hosts that virtual infrastructure is running on.
For IT-1, the landscaper is accessible through *http://localhost:46020/
Get full graph of system
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This method returns the entire graph of all infrastructure, containers and services currently deployed. It can be used to get a dump from the database
This method returns the entire graph of all infrastructure, containers and services currently deployed. It can be used to get a dump from the database
.. code-block:: bash
Expand All @@ -406,7 +385,7 @@ This method returns the entire graph of all infrastructure, containers and servi
Get full graph of system
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This method returns the entire graph of all infrastructure, containers and services currently deployed. It can be used to get a dump from the database
This method returns the entire graph of all infrastructure, containers and services currently deployed. It can be used to get a dump from the database
.. code-block:: bash
Expand All @@ -429,9 +408,9 @@ Stores the geo-location as tags to selected nodes in the database. Useful to tra
.. code-block:: bash
cat >geo_location.json <<EOF
{ [
{ [
{
"id": "<node_id>",
"id": "<node_id>",
"geo": "<geo_location_info"
}
]
Expand Down

0 comments on commit 545eeea

Please sign in to comment.