Skip to content

cloud-and-smart-labs/climate-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Climate Control

Dynamic Deployment of the services on fog nodes (Raspberry Pi) on the fly with TOSCA Service Template and xOpera a lightweight orchestrator.

Tech Stack Links
Standard OASIS TOSCA
Orchestrator xOpera
Implementation Ansible

Table of Contents

Environment Setup

Install dependencies

sudo apt install python3-venv python3-wheel python-wheel-common

Create Virtual Environment

python3 -m venv .venv

Activate

Activate python virtual environment

source .venv/bin/activate

Install Orchestrator

The xOpera orchestrator tool is available on PyPI.

pip install opera==0.6.8

Generate SSH Key Pair

The system running orchestrator should be able to login into each fog device through SSH without a password. So, generate SSH key pair and copy the public key to all other nodes.

ssh-keygen

Copy the Public Key

ssh-copy-id [email protected]

Set Environment Variable

By default xOpera login as centos username. To change the login username set the OPERA_SSH_USER environment variable. All the fog node's usernames should be the same.

export OPERA_SSH_USER=root

Deactivate

Deactivate python virtual environment

deactivate

Orchestration

TOSCA Sevice Template validation, deployment, and undeployment with xOpera. Check out xOpera CLI documentation here.


Deploying template service.yaml

Validate

Validate TOSCA Service Templates
-e: executors (Ansible Playbooks) behind them
-i: Input file

opera validate -e -i inputs.yaml service.yaml

Validation should look like this if nothing is wrong.

(.venv) satish@snsrirama:~/suvam-basak/climate-control/tosca$ opera validate -e -i inputs.yaml service.yaml 
Validating service template...
[Worker_0]   Validating outdoor-node_0
[Worker_0]   Validation of outdoor-node_0 complete
[Worker_0]   Validating indoor-node_0
[Worker_0]   Validation of indoor-node_0 complete
[Worker_0]   Validating docker-swarm-leader_0
[Worker_0]     Executing create on docker-swarm-leader_0
[Worker_0]     Executing delete on docker-swarm-leader_0
[Worker_0]   Validation of docker-swarm-leader_0 complete
[Worker_0]   Validating docker-swarm-worker_0
[Worker_0]     Executing create on docker-swarm-worker_0
[Worker_0]     Executing pre_configure_source on docker-swarm-worker_0--docker-swarm-leader_0
[Worker_0]     Executing delete on docker-swarm-worker_0
[Worker_0]   Validation of docker-swarm-worker_0 complete
[Worker_0]   Validating broker-service_0
[Worker_0]     Executing create on broker-service_0
[Worker_0]     Executing delete on broker-service_0
[Worker_0]   Validation of broker-service_0 complete
[Worker_0]   Validating sensor-data-publisher_0
[Worker_0]     Executing create on sensor-data-publisher_0
[Worker_0]     Executing delete on sensor-data-publisher_0
[Worker_0]   Validation of sensor-data-publisher_0 complete
[Worker_0]   Validating actuator-data-subscriber_0
[Worker_0]     Executing create on actuator-data-subscriber_0
[Worker_0]     Executing delete on actuator-data-subscriber_0
[Worker_0]   Validation of actuator-data-subscriber_0 complete
Done.

Deploy

Deploy TOSCA Service Templates
-i: Input file
-w: Number of concurrent threads

opera deploy -i inputs.yaml service.yaml -w 2

If the deployment of the services is successful.

(.venv) satish@snsrirama:~/suvam-basak/climate-control/tosca$ opera deploy -i inputs.yaml service.yaml -w 2
[Worker_0]   Deploying outdoor-node_0
[Worker_1]   Deploying indoor-node_0
[Worker_0]   Deployment of outdoor-node_0 complete
[Worker_1]   Deployment of indoor-node_0 complete
[Worker_0]   Deploying docker-swarm-leader_0
[Worker_0]     Executing create on docker-swarm-leader_0
[Worker_0]   Deployment of docker-swarm-leader_0 complete
[Worker_1]   Deploying docker-swarm-worker_0
[Worker_1]     Executing create on docker-swarm-worker_0
[Worker_1]     Executing pre_configure_source on docker-swarm-worker_0--docker-swarm-leader_0
[Worker_1]   Deployment of docker-swarm-worker_0 complete
[Worker_0]   Deploying broker-service_0
[Worker_0]     Executing create on broker-service_0
[Worker_0]   Deployment of broker-service_0 complete
[Worker_1]   Deploying sensor-data-publisher_0
[Worker_0]   Deploying actuator-data-subscriber_0
[Worker_1]     Executing create on sensor-data-publisher_0
[Worker_0]     Executing create on actuator-data-subscriber_0
[Worker_1]   Deployment of sensor-data-publisher_0 complete
[Worker_0]   Deployment of actuator-data-subscriber_0 complete

Undeploy

Undeploy TOSCA Service Templates
-w: Number of concurrent threads

opera undeploy -w 2

If the undeployment of the services is successful.

(.venv) satish@snsrirama:~/suvam-basak/climate-control/tosca$ opera undeploy -w 2
[Worker_0]   Undeploying sensor-data-publisher_0
[Worker_1]   Undeploying actuator-data-subscriber_0
[Worker_0]     Executing delete on sensor-data-publisher_0
[Worker_1]     Executing delete on actuator-data-subscriber_0
[Worker_0]   Undeployment of sensor-data-publisher_0 complete
[Worker_1]   Undeployment of actuator-data-subscriber_0 complete
[Worker_0]   Undeploying broker-service_0
[Worker_0]     Executing delete on broker-service_0
[Worker_0]   Undeployment of broker-service_0 complete
[Worker_1]   Undeploying docker-swarm-worker_0
[Worker_1]     Executing delete on docker-swarm-worker_0
[Worker_1]   Undeployment of docker-swarm-worker_0 complete
[Worker_0]   Undeploying outdoor-node_0
[Worker_1]   Undeploying docker-swarm-leader_0
[Worker_1]     Executing delete on docker-swarm-leader_0
[Worker_0]   Undeployment of outdoor-node_0 complete
[Worker_1]   Undeployment of docker-swarm-leader_0 complete
[Worker_0]   Undeploying indoor-node_0
[Worker_0]   Undeployment of indoor-node_0 complete

License

This work is licensed under the Apache License 2.0.

Citation

  • Cite this case study
@INPROCEEDINGS{9861005,
  author={Srirama, Satish Narayana and Basak, Suvam},
  booktitle={2022 IEEE 15th International Conference on Cloud Computing (CLOUD)}, 
  title={Fog Computing out of the Box with FogDEFT Framework: A Case Study}, 
  year={2022},
  volume={},
  number={},
  pages={342-350},
  keywords={Performance evaluation;Cloud computing;Computational modeling;Prototypes;Real-time systems;Topology;Internet of Things;Fog computing;Internet of Things;Dynamic deployment;TOSCA;Docker},
  doi={10.1109/CLOUD55607.2022.00057}}
  • Cite the framework
@article{https://doi.org/10.1002/nem.2246,
author = {Basak, Suvam and Srirama, Satish Narayana},
title = {Fog computing out of the box: Dynamic deployment of fog service containers with TOSCA},
journal = {International Journal of Network Management},
volume = {n/a},
number = {n/a},
pages = {e2246},
keywords = {docker, dynamic deployment, fog computing, Internet of Things, TOSCA},
doi = {https://doi.org/10.1002/nem.2246},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/nem.2246},
eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1002/nem.2246}
}