diff --git a/.gitignore b/.gitignore index 49f0b2aed603e5ce17ed22f4f38c259754d6ae34..ad56d0c0724c4196574c72d34be8ffd479b2c6bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .idea *.tar.gz icgparser/doml/*domlx -# output_files_generated/* +input_file_generated/ir.json # Byte-compiled / optimized / DLL files __pycache__/ @@ -154,4 +154,5 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file +#.idea/ +/output_files_generated/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..6566d74877629483364948d9cb385ccfe5771bde --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,66 @@ +include: + - project: piacere/private/t23-ci-setup + ref: main + file: + - gitlab-ci-scripts/utils.gitlab-ci.yml + + # Image tag variables generation job ------------- + # Stage: variable-generation --------------------- + - gitlab-ci-scripts/generate-variables.gitlab-ci.yml + + # Downstream t23-ci-setup pipeline trigger job --- + # Stage: integration-tests-publish-deploy -------- + - gitlab-ci-scripts/trigger-downstream.gitlab-ci.yml + +variables: + # ------------------------ + # Component image tag data + # ------------------------ + COMPONENT_WP: wp3 + ICG_IMAGE_NAME: icg + + # ------------------------------------------ + # Space-separated component image abbreviation list + # used to generate image tags and related variables. + # It is also passed to the downstream integration tests, + # publication and deployment pipeline. + # ------------------------------------------ + IMAGE_NAMES: "$ICG_IMAGE_NAME" + +stages: + - variable-generation + - quality + - build + - security +# TODO: - unit-tests + - integration-tests-publish-deploy + +# Quality jobs ---------------------- + +# TODO: quality checks + +# Build jobs ---------------------- + +build-temp-icg: + stage: build + variables: + TMP_IMAGE: "$TMP_IMAGE_ICG" + DOCKERFILE_PATH: "." + GIT_SUBMODULE_STRATEGY: recursive + trigger: !reference [.trigger-build] + +# Security job ------------------------ + +security-trivy-icg: + stage: security + variables: + TMP_IMAGE: "$TMP_IMAGE_ICG" + trigger: !reference [.trigger-security-trivy] + needs: + - job: build-temp-icg + - job: generate-variables + artifacts: true + +# Unit tests jobs ------------------------ + +# TODO: unit tests \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..60f06fe47547531d00114170a517aa09e8bd0d0f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "templates/ansible/cross-platform/performance_monitoring"] + path = templates/ansible/cross-platform/performance_monitoring + url = ../../../../piacere/public/agents/pma-playbook.git +[submodule "templates/ansible/cross-platform/security_monitoring"] + path = templates/ansible/cross-platform/security_monitoring + url = ../../../../piacere/public/agents/sma-playbook.git diff --git a/Dockerfile b/Dockerfile index fad34482ac9eb96c277e16fa6ee847efcdf3cabd..162ba01107797bb0e965ef7ab89bb0ad532ca80f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,9 @@ FROM python:3.10.1-alpine WORKDIR /opt -COPY . /opt/ - +COPY requirements.txt /opt/requirements.txt RUN pip install -r requirements.txt +COPY . /opt/ +expose 5000 CMD ["uvicorn", "main:fast_api", "--host", "0.0.0.0", "--port", "5000"] \ No newline at end of file diff --git a/README.md b/README.md index 71f8c371835c7832bf07636aba0c8c09f496561f..52b466552a08531639c50f77ccac0c13bbfe49a7 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,15 @@ Requirements ------------- - Docker -Installation +Installation ------------- To have a functional ICG application the following steps can be used. -- Download the full content of this repository +- Download the full content of this repository, there are git submodules, so add them using this command: `git submodule update --init --recursive` - Build the docker image launching the following command: `docker build -t icg:1.0.0 .` - Run the container: `docker run --name icg -d -p 5000:5000 icg:1.0.0` - + Usage ------------ diff --git a/api/InfrastructureTemplateController.py b/api/InfrastructureTemplateController.py index ccab6e0e410728528616b556f6b9bc032a74384c..7fcddeed8d8c3719a8ca7012e50c20b121367abc 100644 --- a/api/InfrastructureTemplateController.py +++ b/api/InfrastructureTemplateController.py @@ -11,19 +11,32 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- import logging -from fastapi import APIRouter, Body +from typing import Optional + +import aiofiles +import shutil +from fastapi import APIRouter, Body, File, UploadFile, status from fastapi.responses import FileResponse +from fastapi.exceptions import HTTPException +import os from controller import Orchestrator +from pydantic import BaseModel api_router = APIRouter() base_compress_file_name = "iac_files_" -@api_router.post("/infrastructure/files") +class Doml(BaseModel): + ecore: str + model: Optional[str] = None + external_iac_folder: float + + +@api_router.post("/infrastructure/files", deprecated=True) def create_iac_from_intermediate_representation(intermediate_representation: dict = Body(...)): logging.info("Received intermediate representation create_iac_from_intermediate_representation request") compress_folder_info = Orchestrator.create_iac_from_intermediate_representation(intermediate_representation) @@ -34,7 +47,53 @@ def create_iac_from_intermediate_representation(intermediate_representation: dic @api_router.post("/iac/files") def create_iac_from_doml(data: str = Body(..., media_type="application/xml")): logging.info("Received create_iac_from_doml request") - compress_folder_info = Orchestrator.create_iac_from_doml(model=data, metamodel_directory="icgparser/doml/v1", + compress_folder_info = Orchestrator.create_iac_from_doml(model=data, metamodel_directory="icgparser/doml/v2", is_multiecore_metamodel=False) return FileResponse(path=compress_folder_info.file_path, media_type='application/octet-stream', filename=compress_folder_info.filename) + + +CHUNK_SIZE = 1024 * 1024 # adjust the chunk size as desired + + +@api_router.post("/iac/files/upload") +async def create_iac_from_doml_model(file: UploadFile = File(...)): + try: + filepath = os.path.join('./', os.path.basename(file.filename)) + async with aiofiles.open(filepath, 'wb') as f: + while chunk := await file.read(CHUNK_SIZE): + await f.write(chunk) + except Exception: + raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail='There was an error uploading the file') + finally: + await file.close() + #logging.info(f"Removing file {file.filename}") + data, outputpath = Orchestrator.extract_file_zip('./'+file.filename) + compress_folder_info = Orchestrator.create_iac_from_doml(model=data, metamodel_directory=outputpath, + is_multiecore_metamodel=False) + shutil.unpack_archive(compress_folder_info.filename, outputpath) + shutil.make_archive(outputpath, 'zip', outputpath ) + logging.info(f"Successfuly uploaded {file.filename}") + return FileResponse(path=outputpath+'.zip', media_type='application/octet-stream', + filename=file.filename) + + +@api_router.post("/iac/files/extension/intermediate_representation") +async def create_iac_intermediate_representation(file: UploadFile = File(...)): + try: + filepath = os.path.join('./', os.path.basename(file.filename)) + async with aiofiles.open(filepath, 'wb') as f: + while chunk := await file.read(CHUNK_SIZE): + await f.write(chunk) + except Exception: + raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, + detail='There was an error uploading the file') + finally: + await file.close() + #logging.info(f"Removing file {file.filename}") + + logging.info(f"Successfuly uploaded {file.filename}") + return FileResponse(path=filepath, media_type='application/octet-stream', + filename=file.filename) + diff --git a/controller/Orchestrator.py b/controller/Orchestrator.py index f80607303c22ffbe5306776c13db9c5bc643169a..6dcf09ba55ca85c4787e4252dd9535a3450c134d 100644 --- a/controller/Orchestrator.py +++ b/controller/Orchestrator.py @@ -11,19 +11,19 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- import json import logging import os +import shutil import tarfile -import time import uuid import yaml from icgparser import ModelParser, PiacereInternalToolsIntegrator, IntermediateRepresentationUtility -from icgparser.IntermediateRepresentationUtility import IntermediateRepresentationResources -from plugin import AnsiblePlugin, TerraformPlugin +from icgparser.ModelResourcesUtilities import ModelResources, get_ir_key_name +from plugin import AnsiblePlugin, TerraformPlugin, TemplateUtils, DockerComposePlugin from utility.FileParsingUtility import replace_none_with_empty_str @@ -40,6 +40,17 @@ def create_infrastructure_files(intermediate_representation: dict): return template_generated_folder +def create_gaiax_file(parameters): + template_for_gaiax_path = TemplateUtils.find_template_path(None, "common", "gaiax_self_description") + if template_for_gaiax_path: + template = TemplateUtils.read_template(template_for_gaiax_path) + template_filled = TemplateUtils.edit_template(template, parameters) + else: + logging.warning("No GaiaX template found") + return template_filled + + + def choose_plugin(parameters, template_generated_folder): # os.system('rm -f /opt/output_files_generated/*') logging.info("Choosing plugin") @@ -47,7 +58,7 @@ def choose_plugin(parameters, template_generated_folder): for step in parameters["steps"]: if step["programming_language"] == "ansible": logging.info("Ansible Plugin chosen") - step_name = step[IntermediateRepresentationResources.STEP_NAME.value] + step_name = step[get_ir_key_name(ModelResources.STEP_NAME)] metadata_root_folder["iac"].append(step_name) # input_data = step["data"] AnsiblePlugin.create_files(step, template_generated_folder) @@ -60,6 +71,13 @@ def choose_plugin(parameters, template_generated_folder): plugin_metadata = {"input": [], "output": [], "engine": "terraform"} save_file(plugin_metadata, iac_output_folder + "/config.yaml", output_extensions="YAML") TerraformPlugin.create_files(input_data, iac_output_folder) + elif step["programming_language"] == "docker-compose": + logging.info("Docker Compose Plugin chosen") + # input_data = step["data"] + metadata_root_folder["iac"].append("docker-compose") + DockerComposePlugin.create_files(step, template_generated_folder) + gaiax_file = create_gaiax_file(parameters) + save_file(gaiax_file, template_generated_folder + "/gaiax_self_description.yaml", output_extensions="YAML") save_file(metadata_root_folder, template_generated_folder + "/config.yaml", output_extensions="YAML") @@ -93,10 +111,10 @@ def reorganize_info(intermediate_repr): def random_file_name_generation(base_name): - return base_name + str(uuid.uuid4().hex) + ".tar.gz" + return base_name + str(uuid.uuid4().hex) ## + ".zip" -def compress_file(source_folder, dest_file_name): +def compress_file_targz(source_folder, dest_file_name): # prefix_path = "/opt/" prefix_path = "" folder_path = prefix_path + dest_file_name + "" @@ -105,6 +123,25 @@ def compress_file(source_folder, dest_file_name): tar.add(source_folder, arcname='.') return folder_path +def compress_file_zip(source_folder, dest_file_name): + # prefix_path = "/opt/" + prefix_path = "" + folder_path = prefix_path + dest_file_name + logging.info(f"Compressing folder {source_folder} into destination {folder_path}") + shutil.make_archive(folder_path, 'zip', source_folder) + return folder_path + ".zip" + +def extract_file_zip(source_file): + outputpath = "./" + os.path.basename(source_file).split(".")[0] + os.mkdir(outputpath) + shutil.unpack_archive(source_file, outputpath) + #newfilepath = outputpath + os.path.basename(source_file).split(".")[0] + "/" + domlx_files = [f for f in os.listdir(outputpath) if f.endswith('.domlx')] + domlx_file = open(outputpath+'/'+domlx_files[0], "r") + data = domlx_file.read() + domlx_file.close() + #outputfile = outputpath+os.path.basename(source_file).split(".")[0] + return data, outputpath #outputpath def create_temp_model_file(model_xml): logging.info("Saving model in temp file") @@ -115,18 +152,18 @@ def create_temp_model_file(model_xml): def create_intermediate_representation(model_path, is_multiecore_metamodel, metamodel_directory): + logging.info("Calling ICG Parser for creating intermediate representation") intermediate_representation = ModelParser.parse_model(model_path=model_path, is_multiecore_metamodel=is_multiecore_metamodel, metamodel_directory=metamodel_directory) - # intermediate_representation = reorganize_info(intermediate_representation) logging.info(f"Successfully created intermediate representation {intermediate_representation}") logging.info("Calling ICG PiacereInternalToolsIntegrator to add info for PIACERE internal tools") intermediate_representation = PiacereInternalToolsIntegrator.add_internal_tool_information(intermediate_representation) - logging.warning("Force adding sg information in network") ## TODO fix from doml + logging.warning("Force adding sg information in network") ## TODO fix from doml intermediate_representation = IntermediateRepresentationUtility.force_add_resources_name( - IntermediateRepresentationResources.NETWORKS, - IntermediateRepresentationResources.SECURITY_GROUPS, + ModelResources.NETWORKS, + ModelResources.SECURITY_GROUPS, intermediate_representation) intermediate_representation_path = "input_file_generated/ir.json" save_file(intermediate_representation, intermediate_representation_path) @@ -137,9 +174,9 @@ def create_intermediate_representation(model_path, is_multiecore_metamodel, meta def compress_iac_folder(template_generated_folder): base_compress_file_name = "iac_files_" compress_file_name = random_file_name_generation(base_compress_file_name) - compress_file_folder_path = compress_file(template_generated_folder, compress_file_name) - logging.info(f"Successfully created iac files, available at {compress_file_folder_path}") - compress_folder_info = CompressFolder(file_path=compress_file_folder_path, filename=compress_file_name) + compress_file_folder_name = compress_file_zip(template_generated_folder, compress_file_name) + logging.info(f"Successfully created iac files, available at {compress_file_folder_name}") + compress_folder_info = CompressFolder(file_path=compress_file_folder_name, filename=compress_file_folder_name) return compress_folder_info @@ -167,8 +204,9 @@ def create_iac_from_doml(model, is_multiecore_metamodel, metamodel_directory): ## TODO: same as def create_iac_from_doml_path a part from the model storage in xml intermediate_representation = create_intermediate_representation(model_path, is_multiecore_metamodel, metamodel_directory) - template_generated_folder = create_iac_from_intermediate_representation(intermediate_representation) + template_generated_folder = intermediate_representation["output_path"] PiacereInternalToolsIntegrator.add_files_for_piacere_internal_tools(template_generated_folder) + create_iac_from_intermediate_representation(intermediate_representation) compress_folder_info = compress_iac_folder(template_generated_folder) return compress_folder_info @@ -186,9 +224,11 @@ def create_iac_from_doml_path(model_path, is_multiecore_metamodel, metamodel_dir :returns: path to the zip folder containing the IaC files :type: str """ + logging.info("Creating iac files: parse and plugins will be called") intermediate_representation = create_intermediate_representation(model_path, is_multiecore_metamodel, metamodel_directory) - template_generated_folder = create_iac_from_intermediate_representation(intermediate_representation) + template_generated_folder = intermediate_representation["output_path"] PiacereInternalToolsIntegrator.add_files_for_piacere_internal_tools(template_generated_folder) + create_iac_from_intermediate_representation(intermediate_representation) compress_folder_info = compress_iac_folder(template_generated_folder) return compress_folder_info diff --git a/doc/KR-3.feature b/doc/KR-3.feature new file mode 100644 index 0000000000000000000000000000000000000000..d40979843921ee3f6da87ad9795d6b618583170a --- /dev/null +++ b/doc/KR-3.feature @@ -0,0 +1,39 @@ +Feature: PIACERE Design time + + As a PIACERE user I want to generate IaC code for the provisioning and configuration of my infrastructure. + + +### SCENARIO 1: Generation of infrastructure provisioning code +Given a verified DOML model containing the infrastructure definition +When a user navigates to the DOMLx document +And right-clicks on it +And selects "Piacere" +And selects "Generate IaC code" +Then a compressed folder containing the infrastructural IaC code is generated + +### SCENARIO 2: Generation of infrastructure provisioning code for multiple providers +Given a verified DOML model containing the infrastructure definition +And two different providers between the supported ones +And a user selects one of the two as active +When a user navigates to the DOML document +And right-clicks on it +And selects "Piacere" +And selects "Generate IaC code" +Then a compressed folder containing the infrastructural IaC code for the active provider is generated + +### SCENARIO 3: Generation of contingent provisioning and configuration code +Given a verified DOML model containing the infrastructure and coherent application definition +When a user navigates to the DOMLx document +And right-clicks on it +And selects "Piacere" +And selects "Generate IaC code" +Then a compressed folder containing the infrastructural and subsequent application configuration IaC code is generated + +### SCENARIO 4: Generation of PIACERE monitoring and security agents +Given a verified DOML model containing the infrastructure definition +And at least a virtual machine is defined +When a user navigates to the DOMLx document +And right-clicks on it +And selects "Piacere" +And selects "Generate IaC code" +Then a compressed folder is generated that contains also the monitoring and security agents configuration IaC code \ No newline at end of file diff --git a/doc/SIMPA_dolmv3.0/nio3.doml b/doc/SIMPA_dolmv3.0/nio3.doml new file mode 100644 index 0000000000000000000000000000000000000000..9272eac47c6f26466eac92d9e1f6ab0c9874d45e --- /dev/null +++ b/doc/SIMPA_dolmv3.0/nio3.doml @@ -0,0 +1,147 @@ +doml nio3_test_exec_env + +application app { + + software_component nio3 { + properties {} + } +} + +infrastructure infra { + + net net1 { + cidr "/24" + protocol "tcp/ip" + gateway g1 { + address "10.83.18.65" + } + } + + key_pair ssh_key { + algorithm "RSA" + bits 4096 + } + + vm_image img { + generates vm1, vm2 + } + + vm vm1 { + os "centos7_64Guest" + cpu_count 2 + mem_mb 1024.0 + iface i1 { + address "10.83.18.92" + belongs_to net1 + } + credentials ssh_key + } + + vm vm2 { + os "centos7_64Guest" + cpu_count 2 + mem_mb 1024.0 + iface i1 { + address "10.83.18.88" + belongs_to net1 + } + credentials ssh_key + } + + storage disk0 { + label "disk0" + size_gb 100 + } +} + +deployment conf { + nio3 => vm1, nio3 => vm2 +} + +active deployment conf + +concretizations { + concrete_infrastructure con_infra { + provider vsphere { + properties { + username = "vc_username" + password = "vc_password" + vsphere_server = "psvc10000002.cd.sigov.si" + allow_unverified_ssl = true + } + + generic_resource dc { + preexisting true + type 'vsphere_datacenter' + gname 'PIACDC' + } + + generic_resource cl { + preexisting true + refs_to dc + type 'vsphere_compute_cluster' + gname 'PIACC' + } + + generic_resource pool { + preexisting true + refs_to dc + type 'vsphere_resource_pool' + gname 'Piacere' + } + + vm_image template { + preexisting true + refs_to dc + properties { + vsphere_virtual_machine_name = "c7tmp" + } + maps img + } + + storage datastore { + preexisting true + refs_to dc + properties { + vsphere_datastore_name = 'NFSShare01' + } + maps disk0 + } + + net network { + preexisting true + refs_to dc + properties { + vsphere_network_name = "Nested-ESXi" + } + maps net1 + } + + vm con_vm1 { + refs_to pool, datastore, template + properties { + host_name = "simpa-test00-piacere" + domain = "tri.lan" + guest_id = "centos7_64Guest" + disk = "disk0" + disk_size = 100 + + } + maps vm1 + } + + vm con_vm2 { + refs_to pool, datastore, template + properties { + host_name = "simpa-test00-piacere" + domain = "tri.lan" + guest_id = "centos7_64Guest" + disk = "disk1" + disk_size = 100 + } + maps vm2 + } + } + } + active con_infra +} \ No newline at end of file diff --git a/doc/SIMPA_dolmv3.0/nio3.domlx b/doc/SIMPA_dolmv3.0/nio3.domlx new file mode 100644 index 0000000000000000000000000000000000000000..433f440a3b06b52f7a3a848c6b9e17cc69a09580 --- /dev/null +++ b/doc/SIMPA_dolmv3.0/nio3.domlx @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="nio3_test_exec_env" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nio3"/> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.83.18.92" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.83.18.88" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <generators xsi:type="infra:VMImage" name="img" generatedVMs="//@infrastructure/@nodes.0 //@infrastructure/@nodes.1"/> + <storages name="disk0" label="disk0" size_gb="100"/> + <credentials xsi:type="commons:KeyPair" name="ssh_key" algorithm="RSA" bits="4096"/> + <networks name="net1" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.0"> + <gateways name="g1" address="10.83.18.65"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="vsphere"> + <annotations xsi:type="commons:SProperty" key="username" value="vc_username"/> + <annotations xsi:type="commons:SProperty" key="password" value="vc_password"/> + <annotations xsi:type="commons:SProperty" key="vsphere_server" value="psvc10000002.cd.sigov.si"/> + <annotations xsi:type="commons:BProperty" key="allow_unverified_ssl" value="true"/> + <resources name="dc" preexisting="true" type="vsphere_datacenter" gname="PIACDC"/> + <resources name="cl" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_compute_cluster" gname="PIACC"/> + <resources name="pool" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_resource_pool" gname="Piacere"/> + <vms name="con_vm1" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0 //@concretizations.0/@providers.0/@vmImages.0" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="host_name" value="piac-0"/> + <annotations xsi:type="commons:SProperty" key="domain" value="ad.sigov.si"/> + <annotations xsi:type="commons:SProperty" key="guest_id" value="centos7_64Guest"/> + <annotations xsi:type="commons:SProperty" key="disk" value="disk0"/> + <annotations xsi:type="commons:IProperty" key="disk_size" value="100"/> + </vms> + <vms name="con_vm2" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0 //@concretizations.0/@providers.0/@vmImages.0" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="host_name" value="piac-1"/> + <annotations xsi:type="commons:SProperty" key="domain" value="ad.sigov.si"/> + <annotations xsi:type="commons:SProperty" key="guest_id" value="centos7_64Guest"/> + <annotations xsi:type="commons:SProperty" key="disk" value="disk1"/> + <annotations xsi:type="commons:IProperty" key="disk_size" value="100"/> + </vms> + <vmImages name="template" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@generators.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_virtual_machine_name" value="c7tmp"/> + </vmImages> + <networks name="network" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_network_name" value="Nested-ESXi"/> + </networks> + <storages name="datastore" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@storages.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_datastore_name" value="NFSShare01"/> + </storages> + </providers> + </concretizations> + <configurations name="conf"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.1"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/SIMPA_example_domlv2.2/simpa_v2.2.0-1.doml b/doc/SIMPA_example_domlv2.2/simpa_v2.2.0-1.doml new file mode 100644 index 0000000000000000000000000000000000000000..8fb078556f434f8702035557763dd59d89dd78bb --- /dev/null +++ b/doc/SIMPA_example_domlv2.2/simpa_v2.2.0-1.doml @@ -0,0 +1,150 @@ +doml nio3_test_exec_env + +application app { + + software_component nio3 { + properties {} + } +} + +infrastructure infra { + + net net1 { + cidr "/24" + protocol "tcp/ip" + gateway g1 { + address "10.83.18.65" + } + } + + user_pass ssh_pass { + user "root" + pass "pa$$w0rd" + } + + key_pair ssh_key { + keyfile "/home/rmandal/.ssh/id_rsa.pub" + } + + vm_image img { + generates vm1, vm2 + } + + vm vm1 { + os "centos7_64Guest" + cpu_count 2 + mem_mb 1024.0 + iface i1 { + address "10.83.18.92" + belongs_to net1 + } + credentials ssh_pass + } + + vm vm2 { + os "centos7_64Guest" + cpu_count 2 + mem_mb 1024.0 + iface i1 { + address "10.83.18.88" + belongs_to net1 + } + credentials ssh_pass + } + + sto disk0 { + label "disk0" + size_gb 100 + } +} + +deployment conf { + nio3 -> vm1, nio3 -> vm2 +} + +active deployment conf + +concretizations { + concrete_infrastructure con_infra { + provider vsphere { + properties { + username = "vc_username"; + password = "vc_password"; + vsphere_server = "psvc10000002.cd.sigov.si"; + allow_unverified_ssl = true; + } + + generic_resource dc { + preexisting true + type 'vsphere_datacenter' + gname 'MB' + } + + generic_resource cl { + preexisting true + refs_to dc + type 'vsphere_compute_cluster' + gname 'MB-PIAC-NIC-1' + } + + generic_resource pool { + preexisting true + refs_to dc + type 'vsphere_resource_pool' + gname 'PIAC' + } + + vm_image template { + preexisting true + refs_to dc + properties { + vsphere_virtual_machine_name = "Centos7_PIAC"; + } + maps img + } + + storage datastore { + preexisting true + refs_to dc + properties { + vsphere_datastore_name = 'VNX01-0200-NIC-TA-PIAC-DRO-VMW-P'; + } + maps disk0 + } + + net network { + preexisting true + refs_to dc + properties { + vsphere_network_name = "DRO-MB-P-BG001-2098"; + } + maps net1 + } + + vm con_vm1 { + refs_to pool, datastore, template + properties { + host_name = "piac-0"; + domain = "ad.sigov.si"; + disk = "disk0"; + disk_size = "100"; + guest_id = "centos7_64Guest"; + } + maps vm1 + } + + vm con_vm2 { + refs_to pool, datastore, template + properties { + host_name = "piac-1"; + domain = "ad.sigov.si"; + disk = "disk1"; + disk_size = "100"; + guest_id = "centos7_64Guest"; + } + maps vm2 + } + } + } + active con_infra +} \ No newline at end of file diff --git a/doc/SIMPA_example_domlv2.2/simpa_v2.2.domlx b/doc/SIMPA_example_domlv2.2/simpa_v2.2.domlx new file mode 100644 index 0000000000000000000000000000000000000000..99050ef905dfb1bb4bfe4d7daa55ca1c6e66e910 --- /dev/null +++ b/doc/SIMPA_example_domlv2.2/simpa_v2.2.domlx @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="nio3_test_exec_env" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nio3"/> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.83.18.92" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.83.18.88" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <generators xsi:type="infra:VMImage" name="img" generatedVMs="//@infrastructure/@nodes.0 //@infrastructure/@nodes.1"/> + <storages name="disk0" label="disk0" size_gb="100"/> + <credentials xsi:type="commons:UserPass" name="ssh_pass" username="root" password="pa$$w0rd"/> + <credentials xsi:type="commons:KeyPair" name="ssh_key" keyfile="/home/rmandal/.ssh/id_rsa.pub"/> + <networks name="net1" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.0"> + <gateways name="g1" address="10.83.18.65"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="vsphere"> + <annotations xsi:type="commons:SProperty" key="username" value="vc_username"/> + <annotations xsi:type="commons:SProperty" key="password" value="vc_password"/> + <annotations xsi:type="commons:SProperty" key="vsphere_server" value="psvc10000002.cd.sigov.si"/> + <annotations xsi:type="commons:BProperty" key="allow_unverified_ssl" value="true"/> + <resources name="dc" preexisting="true" type="vsphere_datacenter" gname="MB"/> + <resources name="cl" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_compute_cluster" gname="MB-PIAC-NIC-1"/> + <resources name="pool" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_resource_pool" gname="PIAC"/> + <vms name="con_vm1" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="host_name" value="piac-0"/> + <annotations xsi:type="commons:SProperty" key="domain" value="ad.sigov.si"/> + </vms> + <vms name="con_vm2" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="host_name" value="piac-1"/> + <annotations xsi:type="commons:SProperty" key="domain" value="ad.sigov.si"/> + </vms> + <vmImages name="template" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@generators.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_virtual_machine_name" value="Centos7_PIAC"/> + </vmImages> + <networks name="network" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_network_name" value="DRO-MB-P-BG001-2098"/> + </networks> + <storages name="datastore" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@storages.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_datastore_name" value="VNX01-0200-NIC-TA-PIAC-DRO-VMW-P"/> + </storages> + </providers> + </concretizations> + <configurations name="conf"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.1"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/ericsson/uc3.doml b/doc/ericsson/uc3.doml new file mode 100644 index 0000000000000000000000000000000000000000..b6e1f7f030976bdecf02d4e7a045324323a4c361 --- /dev/null +++ b/doc/ericsson/uc3.doml @@ -0,0 +1,370 @@ +doml uc3_openstack + +application app { + + // need to define all sw components of the project this is a placeholder + // need to understand what is really needed in this spec + // need to specify all provides/consumes + + software_component iwg { + provides { net_info } + } + software_component osint { + provides { osint_info } + consumes { net_info, get_twitter, ewcf_rest_interface } + } + software_component ewcf { + provides { ewcf_rest_interface } + consumes { get_firebase } + } + saas external_twitter { + provides { get_twitter @ "https://twitter_api/get" } + } + saas external_firebase { + provides { get_firebase @ "https://firebase_api/get" } + } + +} + +infrastructure infra { + // oam is common to all VMs + // igw should have: oam, net1 to osint and net2 to external 5g + + // VMs region + vm igw_vm { + os "CentOS-7-2111" + size "small-centos" + + iface igw_vm_oam { + belongs_to subnet_oam_igw + } + + iface igw_vm_net1 { + belongs_to subnet_net1_igw + } + + iface igw_vm_net2 { + belongs_to subnet_net2_igw + } + + credentials ssh_key + } + + // sint should have: oam, net1 to igw, net3 to internet + vm osint_vm { + os "CentOS-7-2111" + size "small-centos" + + iface osint_vm_oam { + belongs_to subnet_oam_osint + } + + iface osint_vm_net1 { + belongs_to subnet_net1_osint + } + + iface osint_vm_net3 { + belongs_to subnet_net3_osint + } + + credentials ssh_key + } + + // ewcf should have: oam, net1 to osint, and net3 to internet + vm ewcf_vm { + os "CentOS-7-2111" + size "small-centos" + + iface ewcf_vm_oam { + belongs_to subnet_oam_ewcf + } + + iface ewcf_vm_net1 { + belongs_to subnet_net1_ewcf + } + + iface ewcf_vm_net3 { + belongs_to subnet_net3_ewcf + } + + credentials ssh_key + } + + // Containers region + container c1 { + host igw_vm { + container_port 82 + vm_port 8082 + iface igw_vm_oam + } + + host osint_vm { + + // Exposed port + container_port 80 + // Port on the VM where the container will map to + vm_port 8080 + + // Most of the interfaces should be on the internal network, but some of them need access through Internet + // Containers should have two interfaces: an exposed interface to be accessed through Internet and an interface for internal access + // TODO: However, we can specify only one network interface connected to the container + iface osint_vm_oam + + } + + } + + container c2 { + host igw_vm { + container_port 83 + vm_port 8083 + iface igw_vm_net1 + } + } + + + container cont_mongodb { + host ewcf_vm { + container_port 85 + vm_port 8085 + iface ewcf_vm_oam + } + } + + cont_image c_img { + generates c1, c2 + image "docker.hub.io/ericsson/c:1.0" // Esempio + // Sergio: Si potrebbe anche usare "script" al posto di "image", ma avevamo deciso di usare "image" per questo caso perché ci sembrava più appropriato + } + + cont_image mongodb_img { + generates cont_mongodb + image "..." + } + + // Network region + + // Internal Network + net oam { + protocol "TCP/IP" + cidr "16.0.0.0/24" + + subnet subnet_oam_igw { + protocol "TCP/IP" + cidr "16.0.1.0/26" + } + + subnet subnet_oam_osint { + protocol "TCP/IP" + cidr "16.0.1.64/26" + } + + subnet subnet_oam_ewcf { + protocol "TCP/IP" + cidr "16.0.1.128/26" + } + } + + // Internal network + net net1 { + protocol "TCP/IP" + cidr "16.0.1.0/24" + + // Subnets definition + subnet subnet_net1_igw { + connections { + subnet_net1_osint + } + protocol "TCP/IP" + cidr "16.0.1.0/25" + } + + subnet subnet_net1_osint { + connections { + subnet_net1_igw + subnet_net1_ewcf + } + protocol "TCP/IP" + cidr "16.0.1.64/26" + } + + subnet subnet_net1_ewcf { + connections { + subnet_net1_osint + } + protocol "TCP/IP" + cidr "16.0.1.128/26" + } + } + + // Network connecting igw to 5G + net net2 { + protocol "TCP/IP" + cidr "16.0.2.0/24" + + subnet subnet_net2_igw { + protocol "TCP/IP" + cidr "16.0.2.0/25" + } + + } + + // Network connecting osint and ewcf to Internet + net net3 { + protocol "TCP/IP" + cidr "16.0.3.0/24" + + subnet subnet_net3_osint { + protocol "TCP/IP" + cidr "16.0.3.0/25" + } + + subnet subnet_net3_ewcf { + protocol "TCP/IP" + cidr "16.0.3.128/25" + } + + } + + // credentials region + key_pair ssh_key { + user "ubuntu" + keyfile "/home/ubuntu/.ssh/openstack.key" + algorithm "RSA" + bits 4096 + } + + // Computing groups region + + // Currently not used since it is not implemented + // Autoscale groups should currently be removed (leave them commented in order to be eventually reused, + // even though the name could probably be different since there are not autoscale groups on Openstack) + + + // Security region + + // security group is left as originally defined needs to be updated + security_group sg { + egress icmp { + protocol "ICMP" + from_port -1 + to_port -1 + cidr ["0.0.0.0/0"] + } + ingress http { + protocol "TCP" + from_port 80 + to_port 80 + cidr ["0.0.0.0/0"] + } + ingress https { + protocol "TCP" + from_port 443 + to_port 443 + cidr ["0.0.0.0/0"] + } + ingress ssh { + protocol "TCP" + from_port 22 + to_port 22 + cidr ["0.0.0.0/0"] + } + + ifaces igw_vm_oam, igw_vm_net1, igw_vm_net2, osint_vm_oam, osint_vm_net1, osint_vm_net3, ewcf_vm_oam, ewcf_vm_net1, ewcf_vm_net3 + } +} + +deployment config1 { + osint -> osint_vm, + iwg -> igw_vm, + ewcf -> ewcf_vm +} + +active deployment config1 + +concretizations { + concrete_infrastructure con_infra { + + provider openstack { + + // Concrete computing nodes region + + vm concrete_osint_vm { + properties { + // Actually, this is not recognized by ICG, so it's useless + vm_name = "osint"; + // vm_flavor property moved to "size" attribute + vm_key_name = "ubuntu"; + } + maps osint_vm + } + + vm concrete_igw_vm { + properties { + vm_name = "igw"; + vm_key_name = "ubuntu"; + } + maps igw_vm + } + + vm concrete_ewcf_vm { + properties { + vm_name = "ewcf"; + vm_key_name = "ubuntu"; + } + maps ewcf_vm + } + + cont_image concrete_c_img { + maps c_img + } + + cont_image concrete_mongodb_img { + maps mongodb_img + } + + // Concrete Network region + net concrete_oam { + properties { + name = "uc3_oam"; + } + maps oam + } + + net concrete_net1 { + properties { + name = "uc3_net1"; + } + maps net1 + } + + net concrete_net2 { + properties { + name = "uc3_net2"; + } + maps net2 + } + + net concrete_net3 { + properties { + name = "uc3_net3"; + } + maps net3 + } + + } + } + active con_infra +} +optimization opt { + objectives { + "cost" => min + "performance" => max + "availability" => max + } + nonfunctional_requirements { + req1 "cost <= 300" max 300.0 => "cost"; + req2 "performance >= 7%" min 7.0 => "performance"; + req3 "elements" => "VM, Storage"; + } +} \ No newline at end of file diff --git a/doc/ericsson/uc3.domlx b/doc/ericsson/uc3.domlx new file mode 100644 index 0000000000000000000000000000000000000000..26e41e8ed6551dbf04915a00bc8a1d0fdea9589c --- /dev/null +++ b/doc/ericsson/uc3.domlx @@ -0,0 +1,248 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="uc3_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="iwg"> + <exposedInterfaces name="net_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="osint" consumedInterfaces="//@application/@components.0/@exposedInterfaces.0 //@application/@components.3/@exposedInterfaces.0 //@application/@components.2/@exposedInterfaces.0"> + <exposedInterfaces name="osint_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="ewcf" consumedInterfaces="//@application/@components.4/@exposedInterfaces.0"> + <exposedInterfaces name="ewcf_rest_interface"/> + </components> + <components xsi:type="app:SaaS" name="external_twitter"> + <exposedInterfaces name="get_twitter" endPoint="https://twitter_api/get"/> + </components> + <components xsi:type="app:SaaS" name="external_firebase"> + <exposedInterfaces name="get_firebase" endPoint="https://firebase_api/get"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="igw_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos"> + <ifaces name="igw_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="igw_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="igw_vm_net2" belongsTo="//@infrastructure/@networks.2/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="osint_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos"> + <ifaces name="osint_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="osint_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="osint_vm_net3" belongsTo="//@infrastructure/@networks.3/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="ewcf_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos"> + <ifaces name="ewcf_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.2" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="ewcf_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.2" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="ewcf_vm_net3" belongsTo="//@infrastructure/@networks.3/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:Container" name="c1" generatedFrom="//@infrastructure/@generators.0"> + <configs container_port="82" vm_port="8082" host="//@infrastructure/@nodes.0" iface="//@infrastructure/@nodes.0/@ifaces.0"/> + <configs container_port="80" vm_port="8080" host="//@infrastructure/@nodes.1" iface="//@infrastructure/@nodes.1/@ifaces.0"/> + </nodes> + <nodes xsi:type="infra:Container" name="c2" generatedFrom="//@infrastructure/@generators.0"> + <configs container_port="83" vm_port="8083" host="//@infrastructure/@nodes.0" iface="//@infrastructure/@nodes.0/@ifaces.1"/> + </nodes> + <nodes xsi:type="infra:Container" name="cont_mongodb" generatedFrom="//@infrastructure/@generators.1"> + <configs container_port="85" vm_port="8085" host="//@infrastructure/@nodes.2" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </nodes> + <generators xsi:type="infra:ContainerImage" name="c_img" uri="docker.hub.io/ericsson/c:1.0" kind="IMAGE" generatedContainers="//@infrastructure/@nodes.3 //@infrastructure/@nodes.4"/> + <generators xsi:type="infra:ContainerImage" name="mongodb_img" uri="..." kind="IMAGE" generatedContainers="//@infrastructure/@nodes.5"/> + <credentials xsi:type="commons:KeyPair" name="ssh_key" user="ubuntu" keyfile="/home/ubuntu/.ssh/openstack.key" algorithm="RSA" bits="4096"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.0/@ifaces.1 //@infrastructure/@nodes.0/@ifaces.2 //@infrastructure/@nodes.1/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.1 //@infrastructure/@nodes.1/@ifaces.2 //@infrastructure/@nodes.2/@ifaces.0 //@infrastructure/@nodes.2/@ifaces.1 //@infrastructure/@nodes.2/@ifaces.2"> + <rules name="icmp" protocol="ICMP" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="TCP" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="TCP" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="TCP" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="oam" protocol="TCP/IP" addressRange="16.0.0.0/24"> + <subnets name="subnet_oam_igw" protocol="TCP/IP" addressRange="16.0.1.0/26" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet_oam_osint" protocol="TCP/IP" addressRange="16.0.1.64/26" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.0"/> + <subnets name="subnet_oam_ewcf" protocol="TCP/IP" addressRange="16.0.1.128/26" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.0"/> + </networks> + <networks name="net1" protocol="TCP/IP" addressRange="16.0.1.0/24"> + <subnets name="subnet_net1_igw" protocol="TCP/IP" addressRange="16.0.1.0/25" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.1"/> + <subnets name="subnet_net1_osint" protocol="TCP/IP" addressRange="16.0.1.64/26" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.0 //@infrastructure/@networks.1/@subnets.2"/> + <subnets name="subnet_net1_ewcf" protocol="TCP/IP" addressRange="16.0.1.128/26" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.1"/> + </networks> + <networks name="net2" protocol="TCP/IP" addressRange="16.0.2.0/24"> + <subnets name="subnet_net2_igw" protocol="TCP/IP" addressRange="16.0.2.0/25" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.2"/> + </networks> + <networks name="net3" protocol="TCP/IP" addressRange="16.0.3.0/24"> + <subnets name="subnet_net3_osint" protocol="TCP/IP" addressRange="16.0.3.0/25" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.2"/> + <subnets name="subnet_net3_ewcf" protocol="TCP/IP" addressRange="16.0.3.128/25" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.2"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="concrete_osint_vm" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="osint"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="ubuntu"/> + </vms> + <vms name="concrete_igw_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="igw"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="ubuntu"/> + </vms> + <vms name="concrete_ewcf_vm" maps="//@infrastructure/@nodes.2"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="ewcf"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="ubuntu"/> + </vms> + <containerImages name="concrete_c_img" maps="//@infrastructure/@generators.0"/> + <containerImages name="concrete_mongodb_img" maps="//@infrastructure/@generators.1"/> + <networks name="concrete_oam" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_oam"/> + </networks> + <networks name="concrete_net1" maps="//@infrastructure/@networks.1"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net1"/> + </networks> + <networks name="concrete_net2" maps="//@infrastructure/@networks.2"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net2"/> + </networks> + <networks name="concrete_net3" maps="//@infrastructure/@networks.3"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net3"/> + </networks> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="performance"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="availability"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="cost <= 300" property="cost" max="300.0"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="performance >= 7%" property="performance" min="7.0"/> + <nonfunctionalRequirements name="req3" description="elements" property="VM, Storage"/> + </optimization> + <configurations name="config1"> + <deployments component="//@application/@components.1" node="//@infrastructure/@nodes.1"/> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.2" node="//@infrastructure/@nodes.2"/> + </configurations> +</commons:DOMLModel> +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="uc3_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="iwg"> + <exposedInterfaces name="net_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="osint" consumedInterfaces="//@application/@components.0/@exposedInterfaces.0 //@application/@components.3/@exposedInterfaces.0 //@application/@components.2/@exposedInterfaces.0"> + <exposedInterfaces name="osint_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="ewcf" consumedInterfaces="//@application/@components.4/@exposedInterfaces.0"> + <exposedInterfaces name="ewcf_rest_interface"/> + </components> + <components xsi:type="app:SaaS" name="external_twitter"> + <exposedInterfaces name="get_twitter" endPoint="https://twitter_api/get"/> + </components> + <components xsi:type="app:SaaS" name="external_firebase"> + <exposedInterfaces name="get_firebase" endPoint="https://firebase_api/get"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="igw_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos"> + <ifaces name="igw_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="igw_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="igw_vm_net2" belongsTo="//@infrastructure/@networks.2/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="osint_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos"> + <ifaces name="osint_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="osint_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="osint_vm_net3" belongsTo="//@infrastructure/@networks.3/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="ewcf_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos"> + <ifaces name="ewcf_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.2" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="ewcf_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.2" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="ewcf_vm_net3" belongsTo="//@infrastructure/@networks.3/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:Container" name="c1" generatedFrom="//@infrastructure/@generators.0"> + <configs container_port="82" vm_port="8082" host="//@infrastructure/@nodes.0" iface="//@infrastructure/@nodes.0/@ifaces.0"/> + <configs container_port="80" vm_port="8080" host="//@infrastructure/@nodes.1" iface="//@infrastructure/@nodes.1/@ifaces.0"/> + </nodes> + <nodes xsi:type="infra:Container" name="c2" generatedFrom="//@infrastructure/@generators.0"> + <configs container_port="83" vm_port="8083" host="//@infrastructure/@nodes.0" iface="//@infrastructure/@nodes.0/@ifaces.1"/> + </nodes> + <nodes xsi:type="infra:Container" name="cont_mongodb" generatedFrom="//@infrastructure/@generators.1"> + <configs container_port="85" vm_port="8085" host="//@infrastructure/@nodes.2" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </nodes> + <generators xsi:type="infra:ContainerImage" name="c_img" uri="docker.hub.io/ericsson/c:1.0" kind="IMAGE" generatedContainers="//@infrastructure/@nodes.3 //@infrastructure/@nodes.4"/> + <generators xsi:type="infra:ContainerImage" name="mongodb_img" uri="..." kind="IMAGE" generatedContainers="//@infrastructure/@nodes.5"/> + <credentials xsi:type="commons:KeyPair" name="ssh_key" user="ubuntu" keyfile="/home/ubuntu/.ssh/openstack.key" algorithm="RSA" bits="4096"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.0/@ifaces.1 //@infrastructure/@nodes.0/@ifaces.2 //@infrastructure/@nodes.1/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.1 //@infrastructure/@nodes.1/@ifaces.2 //@infrastructure/@nodes.2/@ifaces.0 //@infrastructure/@nodes.2/@ifaces.1 //@infrastructure/@nodes.2/@ifaces.2"> + <rules name="icmp" protocol="ICMP" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="TCP" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="TCP" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="TCP" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="oam" protocol="TCP/IP" addressRange="16.0.0.0/24"> + <subnets name="subnet_oam_igw" protocol="TCP/IP" addressRange="16.0.1.0/26" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet_oam_osint" protocol="TCP/IP" addressRange="16.0.1.64/26" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.0"/> + <subnets name="subnet_oam_ewcf" protocol="TCP/IP" addressRange="16.0.1.128/26" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.0"/> + </networks> + <networks name="net1" protocol="TCP/IP" addressRange="16.0.1.0/24"> + <subnets name="subnet_net1_igw" protocol="TCP/IP" addressRange="16.0.1.0/25" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.1"/> + <subnets name="subnet_net1_osint" protocol="TCP/IP" addressRange="16.0.1.64/26" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.0 //@infrastructure/@networks.1/@subnets.2"/> + <subnets name="subnet_net1_ewcf" protocol="TCP/IP" addressRange="16.0.1.128/26" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.1"/> + </networks> + <networks name="net2" protocol="TCP/IP" addressRange="16.0.2.0/24"> + <subnets name="subnet_net2_igw" protocol="TCP/IP" addressRange="16.0.2.0/25" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.2"/> + </networks> + <networks name="net3" protocol="TCP/IP" addressRange="16.0.3.0/24"> + <subnets name="subnet_net3_osint" protocol="TCP/IP" addressRange="16.0.3.0/25" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.2"/> + <subnets name="subnet_net3_ewcf" protocol="TCP/IP" addressRange="16.0.3.128/25" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.2"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="concrete_osint_vm" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="osint"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="ubuntu"/> + </vms> + <vms name="concrete_igw_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="igw"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="ubuntu"/> + </vms> + <vms name="concrete_ewcf_vm" maps="//@infrastructure/@nodes.2"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="ewcf"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="ubuntu"/> + </vms> + <containerImages name="concrete_c_img" maps="//@infrastructure/@generators.0"/> + <containerImages name="concrete_mongodb_img" maps="//@infrastructure/@generators.1"/> + <networks name="concrete_oam" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_oam"/> + </networks> + <networks name="concrete_net1" maps="//@infrastructure/@networks.1"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net1"/> + </networks> + <networks name="concrete_net2" maps="//@infrastructure/@networks.2"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net2"/> + </networks> + <networks name="concrete_net3" maps="//@infrastructure/@networks.3"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net3"/> + </networks> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="performance"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="availability"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="cost <= 300" property="cost" max="300.0"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="performance >= 7%" property="performance" min="7.0"/> + <nonfunctionalRequirements name="req3" description="elements" property="VM, Storage"/> + </optimization> + <configurations name="config1"> + <deployments component="//@application/@components.1" node="//@infrastructure/@nodes.1"/> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.2" node="//@infrastructure/@nodes.2"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/nginx_example/nginx_example_v2.0/nginx_example_v2.0.doml b/doc/nginx_example/nginx_example_v2.0/nginx_example_v2.0.doml new file mode 100644 index 0000000000000000000000000000000000000000..da36cde7181a82bf1ecd7253bfc14ab8241426a6 --- /dev/null +++ b/doc/nginx_example/nginx_example_v2.0/nginx_example_v2.0.doml @@ -0,0 +1,98 @@ +doml nginx_openstack + +application app { + + software_component nginx { + properties { + // site + source_code="/usr/share/nginx/html/index.html"; + } + } +} + +infrastructure infra { + vm nginx_vm { + os "CentOS-7-2111" + iface i1 { + belongs_to subnet1 + } + credentials nginx_vm_credentials + } + + key_pair nginx_vm_credentials { + user "vm2user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + + net net1 { + address "16.0.0.0/16" + protocol "tcp/ip" + subnet subnet1 { + address "10.100.1.0/24" + protocol "tcp/ip" + } + } + + security_group sg { + egress icmp { + from_port -1 + to_port -1 + protocol "icmp" + cidr ["0.0.0.0/0"] + } + ingress http { + from_port 80 + to_port 80 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress https { + from_port 443 + to_port 443 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress ssh { + from_port 22 + to_port 22 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ifaces i1 + } +} + +deployment config { + nginx -> nginx_vm +} + +active deployment config + +concretizations { + concrete_infrastructure con_infra { + provider openstack { + vm nginx_host { + properties { + vm_flavor = "small-centos"; + } + maps nginx_vm + } + + net nginx_net { + properties {} + maps net1 + } + } + } + active con_infra +} + +optimization opt { + objectives { + "cost" => min + } + nonfunctional_requirements { + req1 "Cost <= 200" max 200.0 => "cost"; + req2 "Provider" values "OPEN" => "provider"; + } +} diff --git a/doc/nginx_example/nginx_example_v2.0/nginx_example_v2.0.domlx b/doc/nginx_example/nginx_example_v2.0/nginx_example_v2.0.domlx new file mode 100644 index 0000000000000000000000000000000000000000..a6fa917e41a2033a4fe3ad50c304f8411497f8f6 --- /dev/null +++ b/doc/nginx_example/nginx_example_v2.0/nginx_example_v2.0.domlx @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="nginx_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nginx"> + <annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="nginx_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="nginx_vm_credentials" user="vm2user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0"> + <rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="16.0.0.0/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="nginx_host" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="nginx_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 200" property="cost" max="200.0"/> + <nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req2" description="Provider" property="provider"> + <values>OPEN</values> + </nonfunctionalRequirements> + </optimization> + <configurations name="config"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/nginx_example/nginx_example_v2.1/nginx_aws.doml b/doc/nginx_example/nginx_example_v2.1/nginx_aws.doml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/nginx_example/nginx_example_v2.1/nginx_openstack.doml b/doc/nginx_example/nginx_example_v2.1/nginx_openstack.doml new file mode 100644 index 0000000000000000000000000000000000000000..81c734b03c77710657bac0c1c65a3224bbeae545 --- /dev/null +++ b/doc/nginx_example/nginx_example_v2.1/nginx_openstack.doml @@ -0,0 +1,98 @@ +doml nginx_openstack + +application app { + + software_component nginx { + properties { + // site + source_code="/usr/share/nginx/html/index.html"; + } + } +} + +infrastructure infra { + vm nginx_vm { + os "CentOS-7-2111" + iface i1 { + belongs_to subnet1 + } + credentials user1 + } + + key_pair user1 { + user "ubuntu" + name "ubuntu" + } + + net net1 { + address "16.0.0.0/16" + protocol "tcp/ip" + subnet subnet1 { + address "10.100.1.0/24" + protocol "tcp/ip" + } + } + + security_group sg { + egress icmp { + from_port -1 + to_port -1 + protocol "icmp" + cidr ["0.0.0.0/0"] + } + ingress http { + from_port 80 + to_port 80 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress https { + from_port 443 + to_port 443 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress ssh { + from_port 22 + to_port 22 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ifaces i1 + } +} + +deployment config { + nginx -> nginx_vm +} + +active deployment config + +concretizations { + concrete_infrastructure con_infra { + provider openstack { + vm nginx_host { + properties { + vm_flavor = "small-centos"; + } + maps nginx_vm + } + + net nginx_net { + properties {} + maps net1 + } + } + } + active con_infra +} + +optimization opt { + objectives { + "cost" => min + } + nonfunctional_requirements { + req1 "Cost <= 200" max 200.0 => "cost"; + req2 "Provider" values "OPEN" => "provider"; + } +} diff --git a/doc/nginx_example/nginx_example_v2.1/nginx_openstack.domlx b/doc/nginx_example/nginx_example_v2.1/nginx_openstack.domlx new file mode 100644 index 0000000000000000000000000000000000000000..0e77e5ad0bcc38d5265bfb644d686fa84769bd57 --- /dev/null +++ b/doc/nginx_example/nginx_example_v2.1/nginx_openstack.domlx @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="nginx_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nginx"> + <annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="nginx_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="user1" user="user-test"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0"> + <rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="16.0.0.0/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="nginx_host" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="nginx_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 200" property="cost" max="200.0"/> + <nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req2" description="Provider" property="provider"> + <values>OPEN</values> + </nonfunctionalRequirements> + </optimization> + <configurations name="config"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/nginx_example/nginx_example_v2.2/nginx_openstack.doml b/doc/nginx_example/nginx_example_v2.2/nginx_openstack.doml new file mode 100644 index 0000000000000000000000000000000000000000..3cfdcc7ed23cbd246219efdedaecc8a51c612bdf --- /dev/null +++ b/doc/nginx_example/nginx_example_v2.2/nginx_openstack.doml @@ -0,0 +1,98 @@ +doml nginx_openstack +version "2.2.2" + +application app { + + software_component nginx { + properties { + // site + source_code="/usr/share/nginx/html/index.html"; + } + } +} + +infrastructure infra { + vm nginx_vm { + os "Ubuntu-Focal-20.04-Daily-2022-04-19" + iface i1 { + belongs_to subnet1 + } + credentials ubuntu + } + + key_pair ubuntu { + user "ubuntu" + } + + net net1 { + cidr "16.0.0.0/16" + protocol "tcp/ip" + subnet subnet1 { + cidr "16.0.0.1/24" + protocol "tcp/ip" + } + } + + security_group sg { + egress icmp { + from_port -1 + to_port -1 + protocol "icmp" + cidr ["0.0.0.0/0"] + } + ingress http { + from_port 80 + to_port 80 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress https { + from_port 443 + to_port 443 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress ssh { + from_port 22 + to_port 22 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ifaces i1 + } +} + +deployment conf { + nginx -> nginx_vm +} + +active deployment conf + +concretizations { + concrete_infrastructure con_infra { + provider openstack { + vm nginx_host { + properties { + vm_flavor = "small-centos"; + } + maps nginx_vm + } + + net nginx_net { + properties {} + maps net1 + } + } + } + active con_infra +} + +optimization opt { + objectives { + "cost" => min + } + nonfunctional_requirements { + req1 "Cost <= 200" max 200.0 => "cost"; + req2 "Provider" values "OPEN" => "provider"; + } +} diff --git a/doc/nginx_example/nginx_example_v2.2/nginx_openstack.domlx b/doc/nginx_example/nginx_example_v2.2/nginx_openstack.domlx new file mode 100644 index 0000000000000000000000000000000000000000..a3038f1a016bf00ead28215cb5064997c5f69d0e --- /dev/null +++ b/doc/nginx_example/nginx_example_v2.2/nginx_openstack.domlx @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="nginx_openstack" version="2.2.2" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nginx"> + <annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="nginx_vm" os="Ubuntu-Focal-20.04-Daily-2022-04-19" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <credentials xsi:type="commons:KeyPair" name="ubuntu" user="ubuntu"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0"> + <rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="16.0.0.0/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="16.0.0.1/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="nginx_host" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="nginx_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 200" property="cost" max="200.0"/> + <nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req2" description="Provider" property="provider"> + <values>OPEN</values> + </nonfunctionalRequirements> + </optimization> + <configurations name="conf"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + </configurations> +</commons:DOMLModel> \ No newline at end of file diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/config.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..082e5e5f4463eaa91ce35a61957caf2dd029c03d --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/config.yaml @@ -0,0 +1,6 @@ +--- +iac: +- terraform +- piacere_monitoring +- nginx +... \ No newline at end of file diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/config.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dff8ba5cf049d5f986d11fcaad55b49d2bf9e65a --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/config.yaml @@ -0,0 +1,8 @@ + +--- +input: + - instance_ip_vm1 + - instance_server_private_key_ssh_key +output: [] +engine: ansible +... diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/inventory.j2 b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..c869825264308b4b47ca862b8b9e22d3bc733f11 --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/inventory.j2 @@ -0,0 +1,9 @@ + + +[servers_for_nginx] +{{ instance_ip_vm1 }} + +[servers_for_nginx:vars] +ansible_connection=ssh +ansible_user=ubuntu +ansible_ssh_private_key_file=ssh_key diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/main.yml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..7cd932f2da62f32f3cc506661acd5cb079605858 --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/main.yml @@ -0,0 +1,44 @@ + + +--- +- hosts: servers_for_nginx + gather_facts: no + become: yes + tasks: + - name: Update repositories + apt: + update_cache: yes + + - name: Install nginx + package: + name: nginx + + - name: Start nginx + service: + name: nginx + enabled: yes + state: started + + - name: Set attributes + set_stats: + data: + site_config_dir: /etc/nginx/conf.d + + - name: Install sample site + copy: + dest: "{{ item }}" + content: | + <!doctype html> + <html lang="en"> + <head> + <title>Hello World!</title> + </head> + <body> + <h1>Sample web page</h1> + <p>With little content ;)</p> + </body> + </html> + with_items: + - /var/www/html/index.html + - /usr/share/nginx/html/index.html + diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/ssh_key.j2 b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..4d512f8d655d1284d5940d5f8f9c3bee1c36f52d --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/nginx/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_private_key_ssh_key }} diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/ansible.cfg b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ansible.cfg similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/ansible.cfg rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ansible.cfg diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/ansible_requirements.yml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ansible_requirements.yml similarity index 81% rename from output_files_generated/nginx_openstack/piacere_monitoring/ansible_requirements.yml rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ansible_requirements.yml index 58c0cb368b76e9a0313aee87b2296e727877b2d9..47808cf1de00ffc1a13ff9c7ee26043954cfb6d1 100644 --- a/output_files_generated/nginx_openstack/piacere_monitoring/ansible_requirements.yml +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ansible_requirements.yml @@ -1,8 +1,8 @@ roles: # - name: dj-wasabi.telegraf -# version: 0.13.2 +# version: 0.13.3 # source: https://galaxy.ansible.com - name: dj-wasabi.telegraf src: https://github.com/dj-wasabi/ansible-telegraf.git scm: git - version: 0.13.2 + version: 0.13.3 diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/config.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dff8ba5cf049d5f986d11fcaad55b49d2bf9e65a --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/config.yaml @@ -0,0 +1,8 @@ + +--- +input: + - instance_ip_vm1 + - instance_server_private_key_ssh_key +output: [] +engine: ansible +... diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/hosts.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/hosts.yaml similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/hosts.yaml rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/hosts.yaml diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/install_playbook_requirements.sh b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/install_playbook_requirements.sh similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/install_playbook_requirements.sh rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/install_playbook_requirements.sh diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/inventory.j2 b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/inventory.j2 similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/inventory.j2 rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/inventory.j2 diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/main.yml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/main.yml similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/main.yml rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/main.yml diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/run-playbook.sh b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/run-playbook.sh similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/run-playbook.sh rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/run-playbook.sh diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/site.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/site.yaml similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/site.yaml rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/site.yaml diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/site_requirements.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/site_requirements.yaml similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/site_requirements.yaml rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/site_requirements.yaml diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ssh_key.j2 b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..4d512f8d655d1284d5940d5f8f9c3bee1c36f52d --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_private_key_ssh_key }} diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/vars/main.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/vars/main.yaml similarity index 100% rename from output_files_generated/nginx_openstack/piacere_monitoring/vars/main.yaml rename to doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/piacere_monitoring/vars/main.yaml diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/config.yaml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..21942c2d2bd4b40c31cf45e4625db768af274e58 --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/config.yaml @@ -0,0 +1,16 @@ + + +--- +engine: terraform +input: + - OS_USERNAME + - OS_PASSWORD + - OS_AUTH_URL + - OS_PROJECT_NAME +output: + + - instance_server_public_key_ssh_key + - instance_server_private_key_ssh_key + - instance_ip_vm1 + +... diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/main.tf b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..0760aa2ee10bc7561fec90de764faf413ca8fafb --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/main.tf @@ -0,0 +1,148 @@ + + +terraform { +required_version = ">= 0.14.0" + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "~> 1.35.0" + } + } +} + +# Configure the OpenStack Provider +provider "openstack" { + insecure = true +} + +# Retrieve data +data "openstack_networking_network_v2" "external" { + name = "external" +} + + +# Create virtual machine +resource "openstack_compute_instance_v2" "vm1" { + name = "nginx-host" + image_name = "ubuntu-20.04.3" + flavor_name = "small" + key_pair = openstack_compute_keypair_v2.ssh_key.name + network { + port = openstack_networking_port_v2.net1.id + } +} + +# Create floating ip +resource "openstack_networking_floatingip_v2" "vm1_floating_ip" { + pool = "external" + # fixed_ip = "" +} + +# Attach floating ip to instance +resource "openstack_compute_floatingip_associate_v2" "vm1_floating_ip_association" { + floating_ip = openstack_networking_floatingip_v2.vm1_floating_ip.address + instance_id = openstack_compute_instance_v2.vm1.id +} + + + +## Network + +# Create Network +resource "openstack_networking_network_v2" "net1" { + name = "concrete_net" +} + +# Create Subnet +resource "openstack_networking_subnet_v2" "net1_subnet" { + name = "concrete_net_subnet" + network_id = openstack_networking_network_v2.net1.id + cidr = "10.0.0.0/24" + dns_nameservers = ["8.8.8.8", "8.8.8.4"] +} + +# Attach networking port +resource "openstack_networking_port_v2" "net1" { + name = "concrete_net" + network_id = openstack_networking_network_v2.net1.id + admin_state_up = true + security_group_ids = [ + openstack_compute_secgroup_v2.icmp.id, + openstack_compute_secgroup_v2.http.id, + openstack_compute_secgroup_v2.https.id, + openstack_compute_secgroup_v2.ssh.id, + + ] + fixed_ip { + subnet_id = openstack_networking_subnet_v2.net1_subnet.id + } +} + +# Create router +resource "openstack_networking_router_v2" "net1_router" { + name = "net1_router" + external_network_id = data.openstack_networking_network_v2.external.id #External network id +} +# Router interface configuration +resource "openstack_networking_router_interface_v2" "net1_router_interface" { + router_id = openstack_networking_router_v2.net1_router.id + subnet_id = openstack_networking_subnet_v2.net1_subnet.id +} + + + +# CREATING SECURITY_GROUP + +resource "openstack_compute_secgroup_v2" "icmp" { + name = "icmp" + description = "Security group rule for port -1" + rule { + from_port = -1 + to_port = -1 + ip_protocol = "icmp" + cidr = "0.0.0.0/0" + } +} + +resource "openstack_compute_secgroup_v2" "http" { + name = "http" + description = "Security group rule for port 80" + rule { + from_port = 80 + to_port = 80 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } +} + +resource "openstack_compute_secgroup_v2" "https" { + name = "https" + description = "Security group rule for port 443" + rule { + from_port = 443 + to_port = 443 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } +} + +resource "openstack_compute_secgroup_v2" "ssh" { + name = "ssh" + description = "Security group rule for port 22" + rule { + from_port = 22 + to_port = 22 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } +} + + + + +# Create ssh keys +resource "openstack_compute_keypair_v2" "ssh_key" { + name = "ubuntu" + # public_key = "ubuntu" +} + diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/output.tf b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/output.tf new file mode 100644 index 0000000000000000000000000000000000000000..5c4fe2796f1f4e5be75509c6bb9f3cb90bd85576 --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_openstack/terraform/output.tf @@ -0,0 +1,14 @@ + + +output "instance_server_public_key_ssh_key" { + value = openstack_compute_keypair_v2.ssh_key.public_key +} + +output "instance_server_private_key_ssh_key" { + value = openstack_compute_keypair_v2.ssh_key.private_key +} + +output "instance_ip_vm1" { + value = openstack_compute_floatingip_associate_v2.vm1_floating_ip_association.floating_ip +} + diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_paper.doml b/doc/nginx_example/nginx_paper_domlv1.0/nginx_paper.doml new file mode 100644 index 0000000000000000000000000000000000000000..8b99d3a4257cb1140a48f1c227c36ef2beaa9d0c --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_paper.doml @@ -0,0 +1,108 @@ +doml nginx_openstack + +application app { + + software_component nginx { + properties { + // site + source_code="/usr/share/nginx/html/index.html"; + } + } +} + +infrastructure infra { + + vm_image vm_img { + generates vm1 + } + + net net1 { + address "10.0.0.0/24" + protocol "tcp/ip" + } + + security_group sg { + egress icmp { + from_port -1 + to_port -1 + protocol "icmp" + cidr ["0.0.0.0/0"] + } + ingress http { + from_port 80 + to_port 80 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress https { + from_port 443 + to_port 443 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ingress ssh { + from_port 22 + to_port 22 + protocol "tcp" + cidr ["0.0.0.0/0"] + } + ifaces i1 + nodes vm1 + } + + key_pair ssh_key { + user "ubuntu" + keyfile "/home/user1/.ssh/openstack.key" + algorithm "RSA" + bits 4096 + } + + autoscale_group ag { + vm vm1 { + os "ubuntu-20.04.3" + iface i1 { + address "10.0.0.1" + belongs_to net1 + security sg + } + credentials ssh_key + } + network net1 + } +} + +deployment config { + nginx -> vm1 +} + +active deployment config + +concretizations { + concrete_infrastructure con_infra { + provider openstack { + vm concrete_vm { + properties { + vm_name = "nginx-host"; + vm_flavor = "small"; + vm_key_name = "user1"; + } + maps vm1 + } + + vm_image concrete_vm_image { + properties { + name = "ubuntu-20.04.3"; + } + maps vm_img + } + + net concrete_net { + properties { + name = "ostack2"; + } + maps net1 + } + } + } + active con_infra +} \ No newline at end of file diff --git a/doc/nginx_example/nginx_paper_domlv1.0/nginx_paper.domlx b/doc/nginx_example/nginx_paper_domlv1.0/nginx_paper.domlx new file mode 100644 index 0000000000000000000000000000000000000000..1ca3bc2dc8938b61ea579d1f8763f18ea20bc047 --- /dev/null +++ b/doc/nginx_example/nginx_paper_domlv1.0/nginx_paper.domlx @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="nginx_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nginx"> + <annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:AutoScalingGroup" name="ag" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="vm1" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0" group="//@infrastructure/@groups.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.0.0.1" belongsTo="//@infrastructure/@networks.0" associated="//@infrastructure/@groups.0"/> + </machineDefinition> + </nodes> + <networks name="net1" protocol="tcp/ip" addressRange="10.0.0.0/24" connectedIfaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0"/> + <generators xsi:type="infra:VMImage" name="vm_img" generatedVMs="//@infrastructure/@nodes.0/@machineDefinition"/> + <credentials xsi:type="infra:KeyPair" name="ssh_key" user="ubuntu" keyfile="/home/user1/.ssh/openstack.key" algorithm="RSA" bits="4096"/> + <groups xsi:type="infra:SecurityGroup" name="sg" groupedNodes="//@infrastructure/@nodes.0/@machineDefinition" ifaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0"> + <rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </groups> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="nginx-host"/> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="user1"/> + </vms> + <vmImages name="concrete_vm_image" maps="//@infrastructure/@generators.0"> + <annotations xsi:type="commons:SProperty" key="name" value="ubuntu-20.04.3"/> + </vmImages> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="name" value="ostack2"/> + </networks> + </providers> + </concretizations> + <configurations name="config"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0/@machineDefinition"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/posidonia/posidonia.doml b/doc/posidonia/posidonia.doml new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/doc/posidonia/posidoniav2.2.2.doml b/doc/posidonia/posidoniav2.2.2.doml new file mode 100644 index 0000000000000000000000000000000000000000..97c6eb300a9e7ff09b5394b018468950b13485d5 --- /dev/null +++ b/doc/posidonia/posidoniav2.2.2.doml @@ -0,0 +1,268 @@ +doml posidonia +properties { + entorno="pre"; + proyecto="baleares"; +} + +/* Application Definition +application posidonia { + software_component Gestaut { + provides { http https } + consumes { dbAccess, search } + } + software_component ElasticSearch { + provides { search } + consumes { dbAccess } + } + software_component Edi { + provides { edi } + consumes { dbAccess } + } + dbms Database { + provides { + dbAccess + } + } +}*/ + +infrastructure abstractInfra { + // Networks + net vpc { + cidr "/16" + protocol "tcp/ip" + subnet subnet1 { + cidr "/24" + protocol "tcp/ip" + } + subnet subnet2 { + cidr "/24" + protocol "tcp/ip" + } + subnet subnet3 { + cidr "/24" + protocol "tcp/ip" + } + } + // Credentials + // TODO: key file? + key_pair GestautKeyName { + algorithm "RSA" + bits 4096 + } + key_pair ESKeyName { + algorithm "RSA" + bits 4096 + } + key_pair EdiKeyName { + algorithm "RSA" + bits 4096 + } + user_pass dbCredentials { + user "***" + pass "***" + } + + // Nodes + vm OracleDB { + os "Ubuntu" + size "t2.small" + iface db1 { + belongs_to subnet1 + } + iface db2 { + belongs_to subnet2 + } + iface db3 { + belongs_to subnet3 + } + sto "20" + credentials dbCredentials + } + + vm_image posidonia_image { + generates gestaut_vm, elasticsearch_vm, edi_vm + image "ami-02a6bfdcf8224bd77" + } + + autoscale_group gestaut_asg { + // TODO: Shouldn't vm live outside the group leaving a reference here? vm might also be referenced by other components. + // It also applies to the following vms in other groups. + vm gestaut_vm { + os "Ubuntu" + size "t2.small" + credentials GestautKeyName + } + min 1 + max 1 // Using AutoScaleGroup as a way to automatically reboot a machine in case of error + } + + autoscale_group elasticsearch_asg { + // TODO + vm elasticsearch_vm { + os "Ubuntu" + size "t2.small" + credentials ESKeyName + } + min 1 + max 1 // Using AutoScaleGroup as a way to automatically reboot a machine in case of error + } + + autoscale_group edi_asg { + // TODO + vm edi_vm { + os "Ubuntu" + size "t2.small" + credentials EdiKeyName + } + min 1 + max 1 // Using AutoScaleGroup as a way to automatically reboot a machine in case of error + } + + security_group sg { + // TODO: the following vms should have the associated interfaces (ifaces) in the security group? + //nodes gestaut_vm, elasticsearch_vm, edi_vm + egress salida { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + ingress lb { + protocol "tcp" + from_port 80 + to_port 80 + cidr ["10.100.1.0/24", "10.100.2.0/24", "10.100.3.0/24"] + } + ingress es { + protocol "tcp" + from_port 9200 + to_port 9200 + cidr ["10.100.1.0/24", "10.100.2.0/24", "10.100.3.0/24"] + } + ingress monitor { + protocol "tcp" + from_port 6556 + to_port 6556 + cidr ["54.217.119.81/32"] + } + + // TODO: ftp (20/21) or ssh (22)? + ingress ftp { + protocol "tcp" + from_port 22 + to_port 22 + cidr ["213.96.27.139/32", "37.187.173.88/32", "51.89.40.59/32", "195.53.242.200/32"] + } + } + + security_group dbsg { + // TODO: the associated vms and ifaces? + egress salida { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + ingress ora { + protocol "tcp" + from_port 1521 + to_port 1521 + cidr ["10.100.1.0/24", "10.100.2.0/24", "10.100.3.0/24", "84.124.78.66/32"] + } + } + + security_group elbsg { + // TODO: the associated vms and ifaces? + egress salida { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + ingress http { + protocol "tcp" + from_port 80 + to_port 80 + cidr ["0.0.0.0/0", "::/0"] + } + ingress https { + protocol "tcp" + from_port 443 + to_port 443 + cidr ["0.0.0.0/0", "::/0"] + } + ingress es { + protocol "tcp" + from_port 9200 + to_port 9200 + cidr ["10.100.1.0/24", "10.100.2.0/24", "10.100.3.0/24"] + } + } + + security_group checkmk { + // TODO: the associated vms and ifaces? + egress salida { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + ingress http { + protocol "tcp" + from_port 80 + to_port 80 + cidr ["84.124.78.66/32"] + } + ingress https { + protocol "tcp" + from_port 443 + to_port 443 + cidr ["84.124.78.66/32"] + } + + // TODO: ftp (20/21) or ssh (22)? + ingress ftp { + protocol "tcp" + from_port 22 + to_port 22 + cidr ["84.124.78.66/32"] + } + } + +} +deployment dep { +// Gestaut -> gestaut_vm, +// ElasticSearch -> elasticsearch_vm, +// Edi -> edi_vm, +// Database -> OracleDB + +} +active deployment dep + +// Concretization to AWS +concretizations { + concrete_infrastructure dev { + provider aws { + autoscale_group asg1 { + maps elasticsearch_asg + } + autoscale_group asg2 { + maps edi_asg + } + autoscale_group asg3 { + maps gestaut_asg + } + vm concrete_OracleDB { + maps OracleDB + } + } + } + +// concrete_infrastructure pro { +// provider aws { +// +// } +// } + + active dev +} \ No newline at end of file diff --git a/doc/posidonia/posidoniav2.2.2.domlx b/doc/posidonia/posidoniav2.2.2.domlx new file mode 100644 index 0000000000000000000000000000000000000000..1602c527dbb306bdffe6b300ea6e801192d68d89 --- /dev/null +++ b/doc/posidonia/posidoniav2.2.2.domlx @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="posidonia" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <annotations xsi:type="commons:SProperty" key="entorno" value="pre"/> + <annotations xsi:type="commons:SProperty" key="proyecto" value="baleares"/> + <infrastructure name="abstractInfra"> + <nodes xsi:type="infra:VirtualMachine" name="OracleDB" os="Ubuntu" storage="20" credentials="//@infrastructure/@credentials.3" sizeDescription="t2.small"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </nodes> + <generators xsi:type="infra:VMImage" name="posidonia_image" uri="ami-02a6bfdcf8224bd77" kind="IMAGE" generatedVMs="//@infrastructure/@groups.0/@machineDefinition //@infrastructure/@groups.1/@machineDefinition //@infrastructure/@groups.2/@machineDefinition"/> + <credentials xsi:type="commons:KeyPair" name="GestautKeyName" algorithm="RSA" bits="4096"/> + <credentials xsi:type="commons:KeyPair" name="ESKeyName" algorithm="RSA" bits="4096"/> + <credentials xsi:type="commons:KeyPair" name="EdiKeyName" algorithm="RSA" bits="4096"/> + <credentials xsi:type="commons:UserPass" name="dbCredentials" username="***" password="***"/> + <groups xsi:type="infra:AutoScalingGroup" name="gestaut_asg"> + <machineDefinition name="gestaut_vm" os="Ubuntu" credentials="//@infrastructure/@credentials.0" sizeDescription="t2.small" generatedFrom="//@infrastructure/@generators.0"/> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="elasticsearch_asg"> + <machineDefinition name="elasticsearch_vm" os="Ubuntu" credentials="//@infrastructure/@credentials.1" sizeDescription="t2.small" generatedFrom="//@infrastructure/@generators.0"/> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="edi_asg"> + <machineDefinition name="edi_vm" os="Ubuntu" credentials="//@infrastructure/@credentials.2" sizeDescription="t2.small" generatedFrom="//@infrastructure/@generators.0"/> + </groups> + <securityGroups name="sg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="lb" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="monitor" kind="INGRESS" protocol="tcp" fromPort="6556" toPort="6556"> + <cidr>54.217.119.81/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>213.96.27.139/32</cidr> + <cidr>37.187.173.88/32</cidr> + <cidr>51.89.40.59/32</cidr> + <cidr>195.53.242.200/32</cidr> + </rules> + </securityGroups> + <securityGroups name="dbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ora" kind="INGRESS" protocol="tcp" fromPort="1521" toPort="1521"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + <cidr>84.124.78.66/32</cidr> + </rules> + </securityGroups> + <securityGroups name="elbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + </securityGroups> + <securityGroups name="checkmk"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>84.124.78.66/32</cidr> + </rules> + </securityGroups> + <networks name="vpc" protocol="tcp/ip" addressRange="/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.1"/> + <subnets name="subnet3" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.2"/> + </networks> + </infrastructure> + <concretizations name="dev"> + <providers name="aws"> + <vms name="concrete_OracleDB" maps="//@infrastructure/@nodes.0"/> + <group name="asg1" maps="//@infrastructure/@groups.1"/> + <group name="asg2" maps="//@infrastructure/@groups.2"/> + <group name="asg3" maps="//@infrastructure/@groups.0"/> + </providers> + </concretizations> + <configurations name="dep"/> +</commons:DOMLModel> diff --git a/doc/scenario1/scenario1.doml b/doc/scenario1/scenario1.doml new file mode 100644 index 0000000000000000000000000000000000000000..185563ae33da7161128b27dd06e0b357eb92ec48 --- /dev/null +++ b/doc/scenario1/scenario1.doml @@ -0,0 +1,88 @@ +doml scenario1 + +infrastructure infra { + + vm vm1 { + os "CentOS-7-2111" + iface i1 { + belongs_to subnet1 + } + credentials VM1SshKey + } + + vm vm2 { + os "CentOS-7-2111" + iface i1 { + belongs_to subnet2 + } + credentials VM2SshKey + } + + key_pair VM1SshKey { + user "vm1user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + key_pair VM2SshKey { + user "vm2user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + + net net1 { + address "10.100.0.0/16" + protocol "tcp/ip" + subnet subnet1 { + address "10.100.1.0/24" + protocol "tcp/ip" + } + subnet subnet2 { + address "10.100.2.0/24" + protocol "tcp/ip" + } + } + + security_group sg { + egress out { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + + ingress ssh { + protocol "tcp" + from_port 22 + to_port 22 + cidr ["10.100.1.0/24"] + } + ifaces i1 + + } +} + +concretizations { + concrete_infrastructure con_infra { + provider openstack { + properties {} + + vm concrete_vm { + properties { + vm_flavor = "small-centos"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + vm_flavor = "small-centos"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + active con_infra +} diff --git a/doc/scenario1/scenario1.domlx b/doc/scenario1/scenario1.domlx new file mode 100644 index 0000000000000000000000000000000000000000..bd897ca652d8b6b751723557f60076071568ec64 --- /dev/null +++ b/doc/scenario1/scenario1.domlx @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="scenario1" activeInfrastructure="//@concretizations.0"> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="CentOS-7-2111" memory_mb="8192.0" cpu_count="2" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="CentOS-7-2111" cpu_count="2" credentials="//@infrastructure/@credentials.1"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="VM1SshKey" user="vm1user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <credentials xsi:type="infra:KeyPair" name="VM2SshKey" user="vm2user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0"> + <rules name="out" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>10.100.1.0/24</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="10.100.0.0/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="10.100.2.0/24" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> +</commons:DOMLModel> diff --git a/doc/scenario1/scenario1.png b/doc/scenario1/scenario1.png new file mode 100644 index 0000000000000000000000000000000000000000..7dabc63c9104bc1e210830947aed79188dd9101f Binary files /dev/null and b/doc/scenario1/scenario1.png differ diff --git a/doc/scenario1/scenario1_openstack.png b/doc/scenario1/scenario1_openstack.png new file mode 100644 index 0000000000000000000000000000000000000000..cf015c5d7edb8256708cf16f17197fe9e15ca272 Binary files /dev/null and b/doc/scenario1/scenario1_openstack.png differ diff --git a/doc/scenario2/scenario2.doml b/doc/scenario2/scenario2.doml new file mode 100644 index 0000000000000000000000000000000000000000..acc6525e0626954c43880eeb1cf7471ab9a6acd6 --- /dev/null +++ b/doc/scenario2/scenario2.doml @@ -0,0 +1,112 @@ +doml scenario2 + +infrastructure infra { + + vm vm1 { + os "ami-02a6bfdcf8224bd77" + iface i1 { + belongs_to subnet1 + } + credentials VM1SshKey + } + + vm vm2 { + os "ami-02a6bfdcf8224bd77" + iface i1 { + belongs_to subnet2 + } + credentials VM2SshKey + } + + key_pair VM1SshKey { + user "vm1user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + key_pair VM2SshKey { + user "vm2user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + + net net1 { + address "10.100.0.0/16" + protocol "tcp/ip" + subnet subnet1 { + address "10.100.1.0/24" + protocol "tcp/ip" + } + subnet subnet2 { + address "10.100.2.0/24" + protocol "tcp/ip" + } + } + + security_group sg { + egress out { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + + ingress ssh { + protocol "tcp" + from_port 22 + to_port 22 + cidr ["10.100.1.0/24"] + } + ifaces i1 + + } +} + +concretizations { + concrete_infrastructure con_infra_openstack { + provider openstack { + properties {} + + vm concrete_vm { + properties { + vm_flavor = "small-centos"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + vm_flavor = "small-centos"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + concrete_infrastructure con_infra_aws { + provider aws { + properties {} + + vm concrete_vm { + properties { + instance_type = "t2.micro"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + instance_type = "t2.micro"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + active con_infra_aws +} diff --git a/doc/scenario2/scenario2.domlx b/doc/scenario2/scenario2.domlx new file mode 100644 index 0000000000000000000000000000000000000000..2b0310a746d7ffba5864cabf0b2f7bfdd5390f65 --- /dev/null +++ b/doc/scenario2/scenario2.domlx @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="scenario2" activeInfrastructure="//@concretizations.1"> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.1"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="VM1SshKey" user="vm1user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <credentials xsi:type="infra:KeyPair" name="VM2SshKey" user="vm2user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0"> + <rules name="out" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>10.100.1.0/24</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="10.100.0.0/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="10.100.2.0/24" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_infra_openstack"> + <providers name="openstack"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <concretizations name="con_infra_aws"> + <providers name="aws"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> +</commons:DOMLModel> diff --git a/doc/scenario3/scenario3.doml b/doc/scenario3/scenario3.doml new file mode 100644 index 0000000000000000000000000000000000000000..bdf52d6d9b7fd9d171fe0c926dd590225bde0d1a --- /dev/null +++ b/doc/scenario3/scenario3.doml @@ -0,0 +1,128 @@ +doml scenario3 + +application app { + + software_component nginx { + properties { + // site + source_code="/usr/share/nginx/html/index.html"; + } + } +} + + +infrastructure infra { + + vm vm1 { + os "ami-02a6bfdcf8224bd77" + iface i1 { + belongs_to subnet1 + } + credentials VM1SshKey + } + + vm vm2 { + os "ami-02a6bfdcf8224bd77" + iface i1 { + belongs_to subnet2 + } + credentials VM2SshKey + } + + key_pair VM1SshKey { + user "vm1user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + key_pair VM2SshKey { + user "vm2user" + keyfile "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" + } + + net net1 { + address "10.100.0.0/16" + protocol "tcp/ip" + subnet subnet1 { + address "10.100.1.0/24" + protocol "tcp/ip" + } + subnet subnet2 { + address "10.100.2.0/24" + protocol "tcp/ip" + } + } + + security_group sg { + egress out { + protocol "-1" + from_port 0 + to_port 0 + cidr ["0.0.0.0/0"] + } + + ingress ssh { + protocol "tcp" + from_port 22 + to_port 22 + cidr ["10.100.1.0/24"] + } + ifaces i1 + + } +} + +deployment config { + nginx -> vm1 +} + + +concretizations { + concrete_infrastructure con_infra_openstack { + provider openstack { + properties {} + + vm concrete_vm { + properties { + vm_flavor = "small-centos"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + vm_flavor = "small-centos"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + concrete_infrastructure con_infra_aws { + provider aws { + properties {} + + vm concrete_vm { + properties { + instance_type = "t2.micro"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + instance_type = "t2.micro"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + active con_infra_aws +} diff --git a/doc/scenario3/scenario3.domlx b/doc/scenario3/scenario3.domlx new file mode 100644 index 0000000000000000000000000000000000000000..2361ddab22e0440316d51f128a388cc85fac4266 --- /dev/null +++ b/doc/scenario3/scenario3.domlx @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="scenario3" activeInfrastructure="//@concretizations.1"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="nginx"> + <annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.1"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="VM1SshKey" user="vm1user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <credentials xsi:type="infra:KeyPair" name="VM2SshKey" user="vm2user" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com"/> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0"> + <rules name="out" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>10.100.1.0/24</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="10.100.0.0/16"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="10.100.2.0/24" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_infra_openstack"> + <providers name="openstack"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <concretizations name="con_infra_aws"> + <providers name="aws"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <configurations name="config"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/wordpress_example/wordpress.doml b/doc/wordpress_example/wordpress.doml new file mode 100644 index 0000000000000000000000000000000000000000..642d3d3b6f9ae041ff58167ba50a3cd49bec7cb3 --- /dev/null +++ b/doc/wordpress_example/wordpress.doml @@ -0,0 +1,121 @@ +doml wordpress + +application app { + software_component mysql { + properties { + db_user = "app1user"; + db_password = "app1user"; + db_name = "app1"; + } + provides { + DB_interface + } + } + + software_component wordpress { + properties { + wordpress_db_host = "db_host"; + wordpress_db_user = "app1user"; + wordpress_db_password = "app1user"; + wordpress_db_name = "app1"; + wordpress_table_prefix = "wp"; + } + consumes { + DB_interface + } + } + +} + +infrastructure infra { + key_pair ssh_key { + keyfile "local path to ssh key" + user "myuser" + } + + vm vm1 { + os "ubuntu-20.04.3" + credentials ssh_key + iface i1 { + belongs_to subnet1 + } + } + + vm vm2 { + os "ubuntu-20.04.3" + credentials ssh_key + iface i2 { + belongs_to subnet1 + } + } + + net net1 { + address "10.10.10.0/24" + protocol "tcp/ip" + subnet subnet1 { + address "10.100.1.0/24" + protocol "tcp/ip" + } + } +} + +deployment config { + mysql -> vm1, + wordpress -> vm2 +} + + +active deployment config + + +concretizations { + concrete_infrastructure con_os_infra { + provider openstack { + properties {} + + vm concrete_vm1 { + properties { + vm_flavor = "small-centos"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + vm_flavor = "small-centos"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + concrete_infrastructure con_aws_infra { + provider aws { + properties {} + + vm concrete_vm1 { + properties { + vm_flavor = "t2.micro"; + } + maps vm1 + } + + vm concrete_vm2 { + properties { + vm_flavor = "t2.micro"; + } + maps vm2 + } + + net concrete_net { + properties {} + maps net1 + } + } + } + active con_os_infra +} \ No newline at end of file diff --git a/doc/wordpress_example/wordpress.domlx b/doc/wordpress_example/wordpress.domlx new file mode 100644 index 0000000000000000000000000000000000000000..6a8861b6ae32aac34d34da071905186d4077082f --- /dev/null +++ b/doc/wordpress_example/wordpress.domlx @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="wordpress" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="mysql"> + <annotations xsi:type="commons:SProperty" key="db_user" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="db_password" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="db_name" value="app1"/> + <exposedInterfaces name="DB_interface"/> + </components> + <components xsi:type="app:SoftwareComponent" name="wordpress" consumedInterfaces="//@application/@components.0/@exposedInterfaces.0"> + <annotations xsi:type="commons:SProperty" key="wordpress_db_host" value="db_host"/> + <annotations xsi:type="commons:SProperty" key="wordpress_db_user" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="wordpress_db_password" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="wordpress_db_name" value="app1"/> + <annotations xsi:type="commons:SProperty" key="wordpress_table_prefix" value="wp"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i2" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="ssh_key" user="myuser" keyfile="local path to ssh key"/> + <networks name="net1" protocol="tcp/ip" addressRange="10.10.10.0/24"> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.0"/> + </networks> + </infrastructure> + <concretizations name="con_os_infra"> + <providers name="openstack"> + <vms name="concrete_vm1" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <concretizations name="con_aws_infra"> + <providers name="aws"> + <vms name="concrete_vm1" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="t2.micro"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="t2.micro"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <configurations name="config"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.1" node="//@infrastructure/@nodes.1"/> + </configurations> +</commons:DOMLModel> diff --git a/doc/wordpress_example/wordpress/config.yaml b/doc/wordpress_example/wordpress/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1933bb2fc8c9c9f9a650a121e139916a2d1394c4 --- /dev/null +++ b/doc/wordpress_example/wordpress/config.yaml @@ -0,0 +1,7 @@ +--- +iac: +- terraform +- piacere_monitoring +- mysql +- wordpress +... \ No newline at end of file diff --git a/doc/wordpress_example/wordpress/mysql/config.yaml b/doc/wordpress_example/wordpress/mysql/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dff8ba5cf049d5f986d11fcaad55b49d2bf9e65a --- /dev/null +++ b/doc/wordpress_example/wordpress/mysql/config.yaml @@ -0,0 +1,8 @@ + +--- +input: + - instance_ip_vm1 + - instance_server_private_key_ssh_key +output: [] +engine: ansible +... diff --git a/doc/wordpress_example/wordpress/mysql/inventory.j2 b/doc/wordpress_example/wordpress/mysql/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..f08ec2c202a25fbeec18186393f71d95491b326d --- /dev/null +++ b/doc/wordpress_example/wordpress/mysql/inventory.j2 @@ -0,0 +1,9 @@ + + +[servers_for_mysql] +{{ instance_ip_vm1 }} + +[servers_for_mysql:vars] +ansible_connection=ssh +ansible_user=ubuntu +ansible_ssh_private_key_file=ssh_key diff --git a/output_files_generated/wordpress_azure/ansible/mysql.play b/doc/wordpress_example/wordpress/mysql/main.yml similarity index 99% rename from output_files_generated/wordpress_azure/ansible/mysql.play rename to doc/wordpress_example/wordpress/mysql/main.yml index d273e15412006bc7c31625323df0ef9283850747..73257f63776bceb59b4b2ce79793747d846b456c 100644 --- a/output_files_generated/wordpress_azure/ansible/mysql.play +++ b/doc/wordpress_example/wordpress/mysql/main.yml @@ -1,3 +1,5 @@ + + --- - hosts: DB become: yes diff --git a/doc/wordpress_example/wordpress/mysql/ssh_key.j2 b/doc/wordpress_example/wordpress/mysql/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..4d512f8d655d1284d5940d5f8f9c3bee1c36f52d --- /dev/null +++ b/doc/wordpress_example/wordpress/mysql/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_private_key_ssh_key }} diff --git a/templates/ansible/ubuntu/monitoring/ansible.cfg b/doc/wordpress_example/wordpress/piacere_monitoring/ansible.cfg similarity index 100% rename from templates/ansible/ubuntu/monitoring/ansible.cfg rename to doc/wordpress_example/wordpress/piacere_monitoring/ansible.cfg diff --git a/doc/wordpress_example/wordpress/piacere_monitoring/ansible_requirements.yml b/doc/wordpress_example/wordpress/piacere_monitoring/ansible_requirements.yml new file mode 100644 index 0000000000000000000000000000000000000000..47808cf1de00ffc1a13ff9c7ee26043954cfb6d1 --- /dev/null +++ b/doc/wordpress_example/wordpress/piacere_monitoring/ansible_requirements.yml @@ -0,0 +1,8 @@ +roles: +# - name: dj-wasabi.telegraf +# version: 0.13.3 +# source: https://galaxy.ansible.com + - name: dj-wasabi.telegraf + src: https://github.com/dj-wasabi/ansible-telegraf.git + scm: git + version: 0.13.3 diff --git a/doc/wordpress_example/wordpress/piacere_monitoring/config.yaml b/doc/wordpress_example/wordpress/piacere_monitoring/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dff8ba5cf049d5f986d11fcaad55b49d2bf9e65a --- /dev/null +++ b/doc/wordpress_example/wordpress/piacere_monitoring/config.yaml @@ -0,0 +1,8 @@ + +--- +input: + - instance_ip_vm1 + - instance_server_private_key_ssh_key +output: [] +engine: ansible +... diff --git a/templates/ansible/ubuntu/monitoring/hosts.yaml b/doc/wordpress_example/wordpress/piacere_monitoring/hosts.yaml similarity index 100% rename from templates/ansible/ubuntu/monitoring/hosts.yaml rename to doc/wordpress_example/wordpress/piacere_monitoring/hosts.yaml diff --git a/templates/ansible/ubuntu/monitoring/install_playbook_requirements.sh b/doc/wordpress_example/wordpress/piacere_monitoring/install_playbook_requirements.sh similarity index 100% rename from templates/ansible/ubuntu/monitoring/install_playbook_requirements.sh rename to doc/wordpress_example/wordpress/piacere_monitoring/install_playbook_requirements.sh diff --git a/doc/wordpress_example/wordpress/piacere_monitoring/inventory.j2 b/doc/wordpress_example/wordpress/piacere_monitoring/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..fda17b36f330a491a1fd872a13c5eed702e1b122 --- /dev/null +++ b/doc/wordpress_example/wordpress/piacere_monitoring/inventory.j2 @@ -0,0 +1,9 @@ + + +[servers_for_piacere_monitoring] +{{ instance_ip_vm1 }} + +[servers_for_piacere_monitoring:vars] +ansible_connection=ssh +ansible_user=ubuntu +ansible_ssh_private_key_file=ssh_key diff --git a/doc/wordpress_example/wordpress/piacere_monitoring/main.yml b/doc/wordpress_example/wordpress/piacere_monitoring/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..a0edc4f654d2f8dc8fbe03d7b0f58ea1fa46a1c1 --- /dev/null +++ b/doc/wordpress_example/wordpress/piacere_monitoring/main.yml @@ -0,0 +1,22 @@ +--- +- hosts: localhost + tasks: + - name: print disclamer + debug: + msg: this can also be done with "ansible-galaxy install -r requirements" + - name: install telegraf from galaxy + community.general.ansible_galaxy_install: + type: role + requirements_file: ansible_requirements.yml + +- hosts: all + pre_tasks: + - name: Ensure gnupg package + package: + name: gnupg + state: present + become: true + vars_files: + - vars/main.yaml + roles: + - dj-wasabi.telegraf diff --git a/templates/ansible/ubuntu/monitoring/run-playbook.sh b/doc/wordpress_example/wordpress/piacere_monitoring/run-playbook.sh similarity index 100% rename from templates/ansible/ubuntu/monitoring/run-playbook.sh rename to doc/wordpress_example/wordpress/piacere_monitoring/run-playbook.sh diff --git a/templates/ansible/ubuntu/monitoring/site.yaml b/doc/wordpress_example/wordpress/piacere_monitoring/site.yaml similarity index 100% rename from templates/ansible/ubuntu/monitoring/site.yaml rename to doc/wordpress_example/wordpress/piacere_monitoring/site.yaml diff --git a/templates/ansible/ubuntu/monitoring/site_requirements.yaml b/doc/wordpress_example/wordpress/piacere_monitoring/site_requirements.yaml similarity index 100% rename from templates/ansible/ubuntu/monitoring/site_requirements.yaml rename to doc/wordpress_example/wordpress/piacere_monitoring/site_requirements.yaml diff --git a/doc/wordpress_example/wordpress/piacere_monitoring/ssh_key.j2 b/doc/wordpress_example/wordpress/piacere_monitoring/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..4d512f8d655d1284d5940d5f8f9c3bee1c36f52d --- /dev/null +++ b/doc/wordpress_example/wordpress/piacere_monitoring/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_private_key_ssh_key }} diff --git a/templates/ansible/ubuntu/monitoring/vars/main.yaml b/doc/wordpress_example/wordpress/piacere_monitoring/vars/main.yaml similarity index 100% rename from templates/ansible/ubuntu/monitoring/vars/main.yaml rename to doc/wordpress_example/wordpress/piacere_monitoring/vars/main.yaml diff --git a/doc/wordpress_example/wordpress/terraform/config.yaml b/doc/wordpress_example/wordpress/terraform/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8a803153fea7b96a0b44da1f0137f5b0566697aa --- /dev/null +++ b/doc/wordpress_example/wordpress/terraform/config.yaml @@ -0,0 +1,20 @@ + + +--- +engine: terraform +input: + - OS_USERNAME + - OS_PASSWORD + - OS_AUTH_URL + - OS_PROJECT_NAME +output: + + - instance_server_public_key_ssh_key + - instance_server_private_key_ssh_key + - instance_ip_vm1 + + - instance_server_public_key_ssh_key + - instance_server_private_key_ssh_key + - instance_ip_vm2 + +... diff --git a/doc/wordpress_example/wordpress/terraform/main.tf b/doc/wordpress_example/wordpress/terraform/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..1f0ce8d46d319f401417349fcdb21292dff7ec6c --- /dev/null +++ b/doc/wordpress_example/wordpress/terraform/main.tf @@ -0,0 +1,131 @@ + + +terraform { +required_version = ">= 0.14.0" + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "~> 1.35.0" + } + } +} + +# Configure the OpenStack Provider +provider "openstack" { + insecure = true +} + +# Retrieve data +data "openstack_networking_network_v2" "external" { + name = "external" +} + + +# Create virtual machine +resource "openstack_compute_instance_v2" "vm1" { + name = "concrete_vm1" + image_name = "ubuntu-20.04.3" + flavor_name = "small-centos" + key_pair = openstack_compute_keypair_v2.ssh_key.name + network { + port = openstack_networking_port_v2.subnet1_networking_port.id + + } +} + +# Create floating ip +resource "openstack_networking_floatingip_v2" "vm1_floating_ip" { + pool = "external" + # fixed_ip = "" +} + +# Attach floating ip to instance +resource "openstack_compute_floatingip_associate_v2" "vm1_floating_ip_association" { + floating_ip = openstack_networking_floatingip_v2.vm1_floating_ip.address + instance_id = openstack_compute_instance_v2.vm1.id +} + +# Router interface configuration + +resource "openstack_networking_router_interface_v2" "subnet1_router_interface" { + router_id = openstack_networking_router_v2.router.id + subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id +} + + + +# Create virtual machine +resource "openstack_compute_instance_v2" "vm2" { + name = "concrete_vm2" + image_name = "ubuntu-20.04.3" + flavor_name = "small-centos" + key_pair = openstack_compute_keypair_v2.ssh_key.name + network { + port = openstack_networking_port_v2.subnet1_networking_port.id + + } +} + +# Create floating ip +resource "openstack_networking_floatingip_v2" "vm2_floating_ip" { + pool = "external" + # fixed_ip = "" +} + +# Attach floating ip to instance +resource "openstack_compute_floatingip_associate_v2" "vm2_floating_ip_association" { + floating_ip = openstack_networking_floatingip_v2.vm2_floating_ip.address + instance_id = openstack_compute_instance_v2.vm2.id +} + +# Router interface configuration + +resource "openstack_networking_router_interface_v2" "subnet1_router_interface" { + router_id = openstack_networking_router_v2.router.id + subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id +} + + +## Network + +# Create Network +resource "openstack_networking_network_v2" "net1" { + name = "concrete_net" +} + +# Subnet +resource "openstack_networking_subnet_v2" "subnet1_subnet" { + name = "subnet1_subnet" + network_id = openstack_networking_network_v2.net1.id + cidr = "10.100.1.0/24" + dns_nameservers = ["8.8.8.8", "8.8.8.4"] +} +# Attach networking port +resource "openstack_networking_port_v2" "subnet1_networking_port" { + name = "concrete_net" + network_id = openstack_networking_network_v2.net1.id + admin_state_up = true + security_group_ids = [ + + ] + fixed_ip { + subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id + } +} + + + +# Create router +resource "openstack_networking_router_v2" "router" { ## 1router, not parametric + name = "router" + external_network_id = data.openstack_networking_network_v2.external.id #External network id +} + + + +# Create ssh keys +resource "openstack_compute_keypair_v2" "ssh_key" { + name = "myuser" + public_key = "local path to ssh key" +} + diff --git a/doc/wordpress_example/wordpress/terraform/output.tf b/doc/wordpress_example/wordpress/terraform/output.tf new file mode 100644 index 0000000000000000000000000000000000000000..9bfb60c0d96b4c331bd8ebbee2e49257c56ddd34 --- /dev/null +++ b/doc/wordpress_example/wordpress/terraform/output.tf @@ -0,0 +1,28 @@ + + +output "instance_server_public_key_ssh_key" { + value = openstack_compute_keypair_v2.ssh_key.public_key +} + +output "instance_server_private_key_ssh_key" { + value = openstack_compute_keypair_v2.ssh_key.private_key +} + +output "instance_ip_vm1" { + value = openstack_compute_floatingip_associate_v2.vm1_floating_ip_association.floating_ip +} + + + +output "instance_server_public_key_ssh_key" { + value = openstack_compute_keypair_v2.ssh_key.public_key +} + +output "instance_server_private_key_ssh_key" { + value = openstack_compute_keypair_v2.ssh_key.private_key +} + +output "instance_ip_vm2" { + value = openstack_compute_floatingip_associate_v2.vm2_floating_ip_association.floating_ip +} + diff --git a/doc/wordpress_example/wordpress/wordpress/config.yaml b/doc/wordpress_example/wordpress/wordpress/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bc56b5de7fb59dbbe98adbcf5af7f704cf4271eb --- /dev/null +++ b/doc/wordpress_example/wordpress/wordpress/config.yaml @@ -0,0 +1,8 @@ + +--- +input: + - instance_ip_vm2 + - instance_server_private_key_ssh_key +output: [] +engine: ansible +... diff --git a/doc/wordpress_example/wordpress/wordpress/inventory.j2 b/doc/wordpress_example/wordpress/wordpress/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..270ad8c588a36007423cc4569947789e6658dc34 --- /dev/null +++ b/doc/wordpress_example/wordpress/wordpress/inventory.j2 @@ -0,0 +1,9 @@ + + +[servers_for_wordpress] +{{ instance_ip_vm2 }} + +[servers_for_wordpress:vars] +ansible_connection=ssh +ansible_user=ubuntu +ansible_ssh_private_key_file=ssh_key diff --git a/output_files_generated/wordpress_azure/ansible/wordpress.play b/doc/wordpress_example/wordpress/wordpress/main.yml similarity index 97% rename from output_files_generated/wordpress_azure/ansible/wordpress.play rename to doc/wordpress_example/wordpress/wordpress/main.yml index f8e98e07b07851348ed95af3fe2c10180279e724..f3ff91010b1d634829f6f744662e5ec496634bf6 100644 --- a/output_files_generated/wordpress_azure/ansible/wordpress.play +++ b/doc/wordpress_example/wordpress/wordpress/main.yml @@ -1,3 +1,5 @@ + + --- - hosts: APP1 become: yes @@ -58,7 +60,7 @@ image: wordpress:5.8.0 state: started env: - WORDPRESS_DB_HOST: "10.10.10.10" + WORDPRESS_DB_HOST: "db_host" WORDPRESS_DB_USER: "app1user" WORDPRESS_DB_PASSWORD: "app1user" WORDPRESS_DB_NAME: "app1" diff --git a/doc/wordpress_example/wordpress/wordpress/ssh_key.j2 b/doc/wordpress_example/wordpress/wordpress/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..4d512f8d655d1284d5940d5f8f9c3bee1c36f52d --- /dev/null +++ b/doc/wordpress_example/wordpress/wordpress/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_private_key_ssh_key }} diff --git a/external-plugins.properties b/external-plugins.properties new file mode 100644 index 0000000000000000000000000000000000000000..788b9ff31807bc8cfad621497342bc21f9074ec7 --- /dev/null +++ b/external-plugins.properties @@ -0,0 +1,2 @@ +[plugins] +docker-compose = containerImages \ No newline at end of file diff --git a/icgparser/DomlParserUtilities.py b/icgparser/DomlParserUtilities.py index 8a93a95630f45f367ca65ef7c6d76af7205cd957..e78b2fd5f9b0220149d73c45dfb7d2db18f9d434 100644 --- a/icgparser/DomlParserUtilities.py +++ b/icgparser/DomlParserUtilities.py @@ -23,6 +23,10 @@ TO_BE_PARSED_RESOURCES = {} METAMODEL_SECTIONS = ["doml", "commons", "application", "infrastructure", "concrete", "optimization"] METAMODEL_DIRECTORY = "icgparser/doml" +doml_layers = { + "active_infrastructure_layer": "activeInfrastructure", +} + def extract_value_from(ecore_object_value): if isinstance(ecore_object_value, EOrderedSet): @@ -33,6 +37,13 @@ def extract_value_from(ecore_object_value): value = ecore_object_value return value +def get_infrastructure_element_from(concrete_element): + try: + return concrete_element.maps + except Exception: + logging.warning(f"No infrastructure link found for element {concrete_element.name}") + return None + def get_reference_list_if_exists(from_object, reference): reference_from_object = from_object.eGet(reference.name) @@ -41,6 +52,36 @@ def get_reference_list_if_exists(from_object, reference): else: return None +def get_references(from_object): + refs = from_object.eClass.eAllReferences() + return list(refs) + +def get_external_references(from_object): + try: + return list(from_object.eClass.eReferences) + except Exception: + logging.warning(f"Error searching for references for object {from_object.name}") + return None + + +def get_resources_from_concrete_layer(doml_model, resource_name): + concretization_layer = get_concrete_layer(doml_model) + providers = concretization_layer.providers + for provider in providers: + logging.info(f'Searching object {resource_name} in concrete layer "{concretization_layer.name}"') + try: + resources = provider.eGet(resource_name+"") + logging.info(f"Found {len(list(resources))} {resource_name}") + return resources + except Exception: + logging.warning(f"No resources found for {resource_name}") + return [] + + +def get_concrete_layer(doml_model): + concretization_layer = doml_model.eGet(doml_layers["active_infrastructure_layer"]) + return concretization_layer + def save_annotations(from_object, to_object): print(f'Saving annotation from {from_object.name}') @@ -56,7 +97,7 @@ def save_attributes(from_object, to_object, skip_component_name=False): if not to_object: to_object = {} for attribute in from_object.eClass.eAllAttributes(): - if from_object.eGet(attribute.name): + if from_object.eGet(attribute.name) is not None: key = attribute.name if skip_component_name and attribute.name == "name": key = "infra_element_name" @@ -87,7 +128,36 @@ def update_missing_parsed_resources(resource, reference, is_to_be_parsed): print(f'update_missing_parsed_resources: skipping {resource_name}') -def save_references_info(from_object, to_object): ## TODO refactoring +def save_references_info(from_object, to_object): + logging.info(f"Searching references from {from_object}") + refs = from_object.eClass.eReferences + for ref in refs: + if get_reference_list_if_exists(from_object, ref): + logging.info(f'{ref.name} is a list') + object_representation_list = [] + for reference_object in get_reference_list_if_exists(from_object, ref): + logging.info(f'Adding info for ref_link "{reference_object.name}"') + object_representation = {} + object_representation = save_annotations(reference_object, object_representation) + object_representation = save_attributes(reference_object, object_representation) + object_representation = save_references_link(reference_object, object_representation) + save_references_info(reference_object, object_representation) + object_representation_list.append(object_representation) + to_object[ref.name] = object_representation_list + logging.info(f"References added: {to_object}") + # save_references_info(reference_object, to_object) + elif from_object.eGet(ref.name): + logging.info(f'Adding object info "{ref.name}"') + reference_object = from_object.eGet(ref.name) + object_representation = {} + object_representation = save_annotations(reference_object, object_representation) + object_representation = save_attributes(reference_object, object_representation) + object_representation = save_references_link(reference_object, object_representation) + to_object[ref.name] = object_representation + return to_object + + +def save_references_link(from_object, to_object): ## TODO refactoring refs = from_object.eClass.eAllReferences() for ref in refs: if get_reference_list_if_exists(from_object, ref): @@ -100,23 +170,37 @@ def save_references_info(from_object, to_object): ## TODO refactoring update_missing_parsed_resources(reference_object, reference=ref, is_to_be_parsed=True) return to_object -def get_references(from_object): - refs = from_object.eClass.eAllReferences() - return list(refs) +def save_concrete_references_info(from_object, to_object): + if "refs" in dir(from_object): + logging.info(f"Adding concrete references for object {from_object.name}") + refs = from_object.refs + for ref_elem in refs: + logging.info(f"Found reference {ref_elem} for object {from_object.name}") + inner_component = save_attributes(ref_elem, {}) + save_references_link(ref_elem, inner_component) + to_object[ref_elem.name] = inner_component + else: + logging.info(f"No concrete references found for object {from_object.name}") + return to_object def save_inner_components(from_object, to_object): inner_components = from_object.eAllContents() for obj in inner_components: - if not isinstance(obj, EOrderedSet): # TODO espandere info - if obj.name is not None: - object_name = obj.name - else: - logging.warning(f'Object name not available, changing it using class name: {obj.eClass.name}') - object_name = obj.eClass.name - print(f'Saving information from object {object_name}') - inner_component = save_attributes(obj, {}) - save_references_info(obj, inner_component) - to_object[object_name] = inner_component + to_object = save_inner_component(obj, to_object) + return to_object + +def save_inner_component(component, to_object): + if not isinstance(component, EOrderedSet): # TODO espandere info + logging.info("Saving inner component") + if component.name is not None: + object_name = component.eClass.name + "_" + component.name + else: + logging.warning(f'Object name not available, changing it using class name: {component.eClass.name}') + object_name = component.eClass.name + print(f'Saving information from object {object_name}') + inner_component = save_attributes(component, {}) + save_references_link(component, inner_component) + to_object[object_name] = inner_component return to_object @@ -124,7 +208,7 @@ def add_infrastructure_information(infrastructure_element, to_object): print(f'Saving infrastructure information from {infrastructure_element.name}') update_missing_parsed_resources(infrastructure_element, is_to_be_parsed=False, reference=None) save_attributes(infrastructure_element, to_object, skip_component_name=True) - save_references_info(infrastructure_element, to_object) + save_references_link(infrastructure_element, to_object) save_inner_components(infrastructure_element, to_object) return to_object @@ -154,4 +238,16 @@ def load_metamodel(metamodel_directory=METAMODEL_DIRECTORY, is_multiecore=False) def load_model(model_path, rset): doml_model_resource = rset.get_resource(URI(model_path)) - return doml_model_resource.contents[0] + DOML_MODEL = doml_model_resource.contents[0] + return DOML_MODEL + + +def hasMaps(object): + try: + object.maps + return True + except: + logging.info("No maps found") + return False + + diff --git a/icgparser/IntermediateRepresentationUtility.py b/icgparser/IntermediateRepresentationUtility.py index 3d021bc06765ba58432c2c1a477ad960d565b084..1a74e0cb40a06a12f4eba5b38e3b248ff4772b08 100644 --- a/icgparser/IntermediateRepresentationUtility.py +++ b/icgparser/IntermediateRepresentationUtility.py @@ -1,35 +1,24 @@ import logging -from enum import Enum +from icgparser.ModelResourcesUtilities import ModelResources, ModelResourcesUtilities, get_ir_key_name -class NoValue(Enum): - def __repr__(self): - return '<%s.%s>' % (self.__class__.__name__, self.name) - -class IntermediateRepresentationResources(NoValue): - STEP_NAME = 'step_name' - STEPS = 'steps' - DATA = 'data' - LANGUAGE = "programming_language" - VIRTUAL_MACHINES = 'vms' - NETWORKS = "networks" - SECURITY_GROUPS = "computingGroup" - - -def find_objects(object_name, intermediate_representation): - logging.info(f"Searching for {object_name.value} in intermediate representation") - steps = intermediate_representation[IntermediateRepresentationResources.STEPS.value] +def find_objects(object_name: ModelResources, intermediate_representation): + logging.info(f"Searching for {object_name.name} in intermediate representation") + ir_step_name = get_ir_key_name(ModelResources.STEPS) + steps = intermediate_representation[ir_step_name] + object_ir_name = get_ir_key_name(object_name) for step in steps: - data = step[IntermediateRepresentationResources.DATA.value] - if object_name.value in data.keys(): - return data[object_name.value] + data = step[get_ir_key_name(ModelResources.DATA)] + if object_ir_name in data.keys(): + return data[object_ir_name] return [] def add_step(step, intermediate_representation, step_number): logging.info("Adding step into intermediate representation") - steps = intermediate_representation[IntermediateRepresentationResources.STEPS.value] + model_resource_class = ModelResourcesUtilities() + steps = intermediate_representation[model_resource_class.get_ir_key_name_from_model_resource(ModelResources.STEPS)] if step_number: steps.insert(step_number, step) else: @@ -38,11 +27,14 @@ def add_step(step, intermediate_representation, step_number): def force_add_resources_name(to_resource, from_resource, intermediate_representation): + logging.info(f"force_add_resources_name of resource {from_resource} into {to_resource} ") sec_groups = find_objects(from_resource, intermediate_representation) sec_groups_names = [] - for key, sg in sec_groups[0].items(): - if isinstance(sg, dict) and sg["name"]: - sec_groups_names.append(sg["name"]) - for resource in find_objects(to_resource, intermediate_representation): - resource["infra_sgs"] = sec_groups_names + logging.info(f"Found sec_groups {sec_groups} to be added into {from_resource}") + if sec_groups and len(sec_groups): + for key, sg in sec_groups[0].items(): + if isinstance(sg, dict) and sg["name"]: + sec_groups_names.append(sg["name"]) + for resource in find_objects(to_resource, intermediate_representation): + resource["infra_sgs"] = sec_groups_names return intermediate_representation diff --git a/icgparser/ModelParser.py b/icgparser/ModelParser.py index 88c5aaf6c01a6a0a4c5915c5707acc79e5cb7589..b970499b9b16ff4d0ca92bdb71afabc104e85c9b 100644 --- a/icgparser/ModelParser.py +++ b/icgparser/ModelParser.py @@ -26,8 +26,12 @@ # model the input model to be translated into the ICG intermediate representation # ------------------------------------------------------------------------- import logging +import re from icgparser import DomlParserUtilities -from icgparser.DomlParserUtilities import get_reference_list_if_exists +from icgparser.DomlParserUtilities import get_reference_list_if_exists, get_resources_from_concrete_layer, \ + get_infrastructure_element_from, get_external_references, save_references_info +from icgparser.ModelResourcesUtilities import ModelResourcesUtilities +from plugin.PluginUtility import find_external_plugins_name, find_resources_names_for_plugin OUTPUT_BASE_DIR_PATH = "output_files_generated/" doml_layers = { @@ -51,9 +55,12 @@ def include_missing_objects_from_infrastructure_layer(to_step): infra_object_representation) infra_object_representation = DomlParserUtilities.add_infrastructure_information(obj["resource"], infra_object_representation) - ## TODO fix attenzione che sovrascrive + ir_key_name = to_camel_case(obj["reference"].eType.name) - to_step["data"][ir_key_name] = [infra_object_representation] + if ir_key_name in to_step["data"].keys(): + to_step["data"][ir_key_name].append(infra_object_representation) + else: + to_step["data"][ir_key_name] = [infra_object_representation] return to_step @@ -66,15 +73,31 @@ def include_infra_object_from_concrete_layer(provider, infra_object_step): f'Found list of object {len(provider_object_list)} "{provider_object_list}" in "{provider.name}"') object_list_representation = [] for object in provider_object_list: - object_representation = {} - object_representation = DomlParserUtilities.save_annotations(object, object_representation) - object_representation = DomlParserUtilities.save_attributes(object, object_representation) - object_representation = DomlParserUtilities.add_infrastructure_information(object.maps, - object_representation) + object_representation = save_object_from_concrete_layer(object) object_list_representation.append(object_representation) infra_object_step["data"][ref.name] = object_list_representation return infra_object_step +def save_object_from_concrete_layer(object): + logging.info(f"Parsing object {object.name}") + object_representation = {} + object_representation = DomlParserUtilities.save_annotations(object, object_representation) + object_representation = DomlParserUtilities.save_attributes(object, object_representation) + object_representation = DomlParserUtilities.save_references_link(object, object_representation) + object_representation = DomlParserUtilities.save_concrete_references_info(object, object_representation) + if DomlParserUtilities.hasMaps(object): + object_representation = DomlParserUtilities.add_infrastructure_information(object.maps, + object_representation) + return object_representation + + +def include_provide_info_from_concrete_layer(provider, infra_object_step): + logging.info(f'Adding provider info from concrete layer for provider {provider.name}') + provider_info = DomlParserUtilities.save_annotations(provider, {}) + provider_info["provider_name"] = provider.name + infra_object_step["data"]["provider_info"] = [provider_info] + return infra_object_step + def parse_infrastructural_objects(doml_model): infra_object_step = {"programming_language": "terraform"} ## TODO refactoring: generalize @@ -83,58 +106,110 @@ def parse_infrastructural_objects(doml_model): for provider in providers: logging.info(f'Searching objects to be generates for provider "{provider.name}"') infra_object_step["data"] = {} ## TODO refactoring, fix (maybe list?): generalize - infra_object_step["data"]["provider"] = provider.name ## TODO refactoring: generalize + ## infra_object_step["data"]["provider"] = provider.name + + infra_object_step = include_provide_info_from_concrete_layer(provider, infra_object_step) infra_object_step = include_infra_object_from_concrete_layer(provider, infra_object_step) infra_object_step = include_missing_objects_from_infrastructure_layer(infra_object_step) return infra_object_step -def parse_application_layer(doml_model, infra_object_step): - logging.info("DOML parsing: getting active configuration") +def parse_application_layer(deployment, infra_object_step): + ## TODO moved to create_intermediate_representation; to be checked + # logging.info("DOML parsing: getting active configuration") + # active_configuration = doml_model.activeConfiguration + # if not active_configuration: + # logging.info("No application layer found") + # else: + # application_object_step = {"programming_language": "ansible", "data": {}} + application_object_step = {"programming_language": "ansible", "data": {}} - active_configuration = doml_model.activeConfiguration - logging.info(f"Found active configuration '{active_configuration.name}'") - for deployment in list(active_configuration.deployments): - deployment_component_name = deployment.component.name - logging.info(f'Parsing deployment for component {deployment_component_name}') - object_representation = {} - - application_resource = deployment.eGet("component") - ## TODO refactoring -> far diventare lista nodi? nel monitoring sono più nodi - vm = deployment.eGet("node") - try: - for infra_vm in infra_object_step.get("data").get("vms"): - if infra_vm.get("infra_element_name") == vm.name: - object_representation["node"] = infra_vm - except Exception: - logging.error(f"parsing error: no vm {vm.name} found for deployment {deployment_component_name}") - - object_representation = DomlParserUtilities.save_annotations(application_resource, object_representation) - object_representation = DomlParserUtilities.save_attributes(application_resource, object_representation) - - application_object_step["data"][deployment_component_name] = object_representation - application_object_step["step_name"] = deployment_component_name + deployment_component_name = deployment.component.name + logging.info(f'Parsing deployment for component {deployment_component_name}') + object_representation = {} + + application_resource = deployment.eGet("component") + vm = deployment.eGet("node") + try: + for infra_vm in infra_object_step.get("data").get("vms"): + if infra_vm.get("infra_element_name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [infra_vm] + except Exception: + logging.error(f"parsing error: no vm {vm.name} found for deployment {deployment_component_name}") + + object_representation = DomlParserUtilities.save_annotations(application_resource, object_representation) + object_representation = DomlParserUtilities.save_attributes(application_resource, object_representation) + + application_object_step["data"][deployment_component_name] = object_representation + application_object_step["step_name"] = deployment_component_name return application_object_step +def add_external_plugin_steps(model_loaded): + logging.info("Adding external plugin resource in intermediate representation") + plugins_name = find_external_plugins_name() + plugin_steps = [] + for plugin_name in plugins_name: + object_list_representation = [] + resources_names = find_resources_names_for_plugin(plugin_name) + for res_name in resources_names: + resources = get_resources_from_concrete_layer(model_loaded, res_name) + if len(list(resources)) > 0: + plugin_object_step = {"programming_language": plugin_name, "data": {}} + for res in resources: + object_representation = save_object_from_concrete_layer(res) + logging.info(f"Searching link to infra element for concrete resource {res_name}") + infra_elem = get_infrastructure_element_from(res) + logging.info(f"Infra element found: {infra_elem}") + logging.info(f"Searching references from infra {infra_elem.name}") + object_representation = save_references_info(infra_elem, object_representation) + object_list_representation.append(object_representation) + plugin_object_step["data"][res_name] = object_list_representation + plugin_steps.append(plugin_object_step) + return plugin_steps + + def create_intermediate_representation(model_loaded): model_name = model_loaded.name output_path = OUTPUT_BASE_DIR_PATH + model_name + "/" intermediate_representation_steps = [] infra_object_step = parse_infrastructural_objects(model_loaded) - application_step = parse_application_layer(model_loaded, infra_object_step) - intermediate_representation_steps.append(infra_object_step) - intermediate_representation_steps.append(application_step) + (intermediate_representation_steps.append(infra_object_step) if infra_object_step is not None else None) + new_plugin_steps = add_external_plugin_steps(model_loaded) + intermediate_representation_steps.extend(new_plugin_steps) + active_configuration = model_loaded.activeConfiguration + # TODO Refactoring + if not active_configuration: + logging.info("No application layer found") + else: + for deployment in list(active_configuration.deployments): + application_step = parse_application_layer(deployment, infra_object_step) + (intermediate_representation_steps.append(application_step) if application_step is not None else None) intermediate_representation = { "output_path": output_path, "steps": intermediate_representation_steps } return intermediate_representation +def get_doml_version(doml_model): + logging.info("Searching for DOML version") + doml_version = doml_model.version + if not doml_version.isnumeric(): + logging.info(f"Cleaning doml version {doml_version} from letters") + doml_version = re.sub("[^0-9.]", "", doml_version) + logging.info(f"Found DOML version {doml_version}") + return doml_version def parse_model(model_path, is_multiecore_metamodel, metamodel_directory): + rset = DomlParserUtilities.load_metamodel(metamodel_directory=metamodel_directory, is_multiecore=is_multiecore_metamodel) doml_model = DomlParserUtilities.load_model(model_path, rset) + doml_version = get_doml_version(doml_model) + logging.info(f"Setup Singleton ModelResourcesUtilities with doml version {doml_version}") + ModelResourcesUtilities(doml_version) intermediate_representation = create_intermediate_representation(doml_model) return intermediate_representation + + diff --git a/icgparser/ModelResourcesUtilities.py b/icgparser/ModelResourcesUtilities.py new file mode 100644 index 0000000000000000000000000000000000000000..d07cea912f77c2bcbcfdd26e8ed6eae88ce5f506 --- /dev/null +++ b/icgparser/ModelResourcesUtilities.py @@ -0,0 +1,84 @@ +import logging +from enum import Enum + +class ModelResources(Enum): + STEP_NAME = 1, + STEPS = 2, + DATA = 3, + LANGUAGE = 4, + VIRTUAL_MACHINES = 5, + NETWORKS = 6, + SECURITY_GROUPS = 7, + AUTOSCALING_GROUPS = 8, + +def from_model_resources_to_ir_names_version1(model_resource: ModelResources): + switcher = { + 1: "step_name", + 2: "steps", + 3: "data", + 4: "programming_language", + 5: "vms", + 6: "networks", + 7: "computingGroup", + 8: "group", + } + if model_resource.value[0]: + resource_number = model_resource.value[0] + else: + resource_number = model_resource.value + return switcher.get(resource_number, None) + + +def from_model_resources_to_ir_names_version2(model_resource: ModelResources): + switcher = { + 1: "step_name", + 2: "steps", + 3: "data", + 4: "programming_language", + 5: "vms", + 6: "networks", + 7: "securityGroup", + 8: "group", + } + if model_resource.value[0]: + resource_number = model_resource.value[0] + else: + resource_number = model_resource.value + return switcher.get(resource_number, None) + +def singleton(class_): + instances = {} + def getinstance(*args, **kwargs): + if class_ not in instances: + instances[class_] = class_(*args, **kwargs) + return instances[class_] + return getinstance + +@singleton +class ModelResourcesUtilities: + doml_version = "2" + + def __init__(self, doml_version): + logging.info(f"ModelResourcesUtilities setting doml version to {doml_version}") + self.doml_version = doml_version + + def convert_doml_version_into_integer(self): + return float(self.doml_version) + + def get_ir_key_name_from_model_resource(self, model_resource: ModelResources): + #doml_version_converted = self.convert_doml_version_into_integer() + logging.info(f"Found doml version {self.doml_version}") + switcher = { + "1": from_model_resources_to_ir_names_version1(model_resource), + "2": from_model_resources_to_ir_names_version2(model_resource), + "2.2": from_model_resources_to_ir_names_version2(model_resource), + "2.2.2": from_model_resources_to_ir_names_version2(model_resource), + } + return switcher.get(self.doml_version, from_model_resources_to_ir_names_version1(model_resource)) + + def set_doml_version(self, doml_version): + self.doml_version = doml_version + +def get_ir_key_name(model_resource: ModelResources): + model_resource_utilities = ModelResourcesUtilities() + return model_resource_utilities.get_ir_key_name_from_model_resource(model_resource) diff --git a/icgparser/PiacereInternalToolsIntegrator.py b/icgparser/PiacereInternalToolsIntegrator.py index ab65804e5b97b646d995f171390f9263312d2723..3064ea2232bc2bbd03200e06939abf379c296f8e 100644 --- a/icgparser/PiacereInternalToolsIntegrator.py +++ b/icgparser/PiacereInternalToolsIntegrator.py @@ -1,40 +1,83 @@ import logging +import os from distutils.dir_util import copy_tree - from icgparser import IntermediateRepresentationUtility -from icgparser.IntermediateRepresentationUtility import IntermediateRepresentationResources +from icgparser.ModelResourcesUtilities import ModelResources -def extract_info_for_monitoring_agents(intermediate_representation): - logging.info("Adding info for monitoring step") - monitoring_object_step = {"programming_language": "ansible", - "step_name": "piacere_monitoring", - "data": {"piacere_monitoring": {"name": "piacere_monitoring"}}} - vms = IntermediateRepresentationUtility.find_objects(IntermediateRepresentationResources.VIRTUAL_MACHINES, +def create_piacere_agents_ansible_step(piacere_component_name, intermediate_representation): + logging.info(f"Adding info for {piacere_component_name} step") + step_name = piacere_component_name + "_monitoring" + vms = IntermediateRepresentationUtility.find_objects(ModelResources.VIRTUAL_MACHINES, intermediate_representation) - # TODO restore these 2 commented lines: monitoring could be installed on multiple nodes! - # monitoring_object_step["data"]["monitoring"]["nodes"] = [] - # monitoring_object_step["data"]["monitoring"]["nodes"] += vms - # TODO remove this line: monitoring could be installed on multiple nodes! - if vms: - monitoring_object_step["data"]["piacere_monitoring"]["node"] = vms[0] - logging.info(f"Monitoring step: {monitoring_object_step}") + autoscaling_group_vms = IntermediateRepresentationUtility.find_objects(ModelResources.AUTOSCALING_GROUPS, + intermediate_representation) + intermediate_repr_step = None + if vms or autoscaling_group_vms: + intermediate_repr_step = {"programming_language": "ansible", + "step_name": step_name, + "data": {step_name: {"name": step_name}}} + intermediate_repr_step["data"][step_name]["nodes"] = [] + if vms: + intermediate_repr_step["data"][step_name]["nodes"] += vms + if autoscaling_group_vms: + for ag in autoscaling_group_vms: + vms = [] + vm = next(v for k, v in ag.items() if k.lower().startswith('virtualmachine')) + vms.append(vm) + intermediate_repr_step["data"][step_name]["nodes"] += vms + + logging.info(f"{step_name} step: {intermediate_repr_step}") + return intermediate_repr_step + + +def extract_info_for_monitoring_agents(intermediate_representation): + logging.info("Adding info for performance step") + monitoring_object_step = create_piacere_agents_ansible_step("performance", intermediate_representation) return monitoring_object_step +def extract_infor_for_security_agents(intermediate_representation): + logging.info("Adding info for security step") + security_object_step = create_piacere_agents_ansible_step("security", intermediate_representation) + return security_object_step + + def add_internal_tool_information(intermediate_representation): + performance_monitoring_directory_path = "templates/ansible/cross-platform/performance_monitoring" + security_monitoring_directory_path = "templates/ansible/cross-platform/security_monitoring" + if not os.listdir(performance_monitoring_directory_path) or not os.listdir(security_monitoring_directory_path): + logging.warning(f"add_internal_tool_information: {performance_monitoring_directory_path} " + f"or {security_monitoring_directory_path} is empty.") + return intermediate_representation monitoring_step = extract_info_for_monitoring_agents(intermediate_representation) - intermediate_representation = IntermediateRepresentationUtility.add_step(monitoring_step, - intermediate_representation, - 1) - return intermediate_representation + security_step = extract_infor_for_security_agents(intermediate_representation) + intermediate_representation_with_monitoring = IntermediateRepresentationUtility.add_step(monitoring_step, + intermediate_representation, + 1) + intermediate_representation_with_security_monitoring = IntermediateRepresentationUtility \ + .add_step(security_step, intermediate_representation_with_monitoring, 2) + return intermediate_representation_with_security_monitoring def add_files_for_monitoring_agents(template_generated_folder_path): - monitoring_folder_path = template_generated_folder_path + "/piacere_monitoring" + monitoring_folder_path = template_generated_folder_path + "performance_monitoring" logging.info(f"Adding monitoring agents folder in {monitoring_folder_path}") - copy_tree("templates/ansible/ubuntu/monitoring", monitoring_folder_path) + monitoring_folder = "templates/ansible/cross-platform/performance_monitoring" + if not monitoring_folder: + os.makedirs(monitoring_folder) + copy_tree("templates/ansible/cross-platform/performance_monitoring", monitoring_folder_path) + + +def add_files_for_security_agents(template_generated_folder_path): + security_folder_path = template_generated_folder_path + "security_monitoring" + logging.info(f"Adding monitoring agents folder in {security_folder_path}") + security_folder = "templates/ansible/cross-platform/security_monitoring" + if not security_folder: + os.makedirs(security_folder) + copy_tree("templates/ansible/cross-platform/security_monitoring", security_folder_path) def add_files_for_piacere_internal_tools(template_generated_folder_path): add_files_for_monitoring_agents(template_generated_folder_path) + add_files_for_security_agents(template_generated_folder_path) diff --git a/icgparser/doml/v1/nginx-openstack_v1.domlx b/icgparser/doml/v1/nginx-openstack_v1.domlx index 4195ffce0b97b2126dcc3db1f8fa6333e49601e4..e760e7892d183491e6e517c223f82356fc428aee 100644 --- a/icgparser/doml/v1/nginx-openstack_v1.domlx +++ b/icgparser/doml/v1/nginx-openstack_v1.domlx @@ -1,52 +1,51 @@ <?xml version="1.0" encoding="ASCII"?> -<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="nginx_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> - <application name="app"> - <components xsi:type="app:SoftwareComponent" name="nginx"> - <annotations xsi:type="commons:SProperty" key="source_code" value="/usr/share/nginx/html/index.html"/> - </components> - </application> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="nio3_test_exec_env" activeInfrastructure="//@concretizations.0"> <infrastructure name="infra"> - <nodes xsi:type="infra:AutoScalingGroup" name="ag" deploymentNetwork="//@infrastructure/@networks.0"> - <machineDefinition name="vm1" os="Ubuntu-Focal-20.04-Daily-2022-04-19" credentials="//@infrastructure/@credentials.0" group="//@infrastructure/@groups.0"> - <ifaces name="i1" endPoint="16.0.0.1" belongsTo="//@infrastructure/@networks.0" associated="//@infrastructure/@groups.0"/> - </machineDefinition> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.83.18.92" belongsTo="//@infrastructure/@networks.0"/> </nodes> - <networks name="net1" protocol="tcp/ip" addressRange="16.0.0.0/24" connectedIfaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0"/> - <credentials xsi:type="infra:KeyPair" name="user1" user="user1"/> - <groups xsi:type="infra:SecurityGroup" name="sg" groupedNodes="//@infrastructure/@nodes.0/@machineDefinition" ifaces="//@infrastructure/@nodes.0/@machineDefinition/@ifaces.0"> - <rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1"> - <cidr>0.0.0.0/0</cidr> - </rules> - <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> - <cidr>0.0.0.0/0</cidr> - </rules> - <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> - <cidr>0.0.0.0/0</cidr> - </rules> - <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> - <cidr>0.0.0.0/0</cidr> - </rules> - </groups> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="i1" endPoint="10.83.18.88" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <generators xsi:type="infra:VMImage" name="img" generatedVMs="//@infrastructure/@nodes.0 //@infrastructure/@nodes.1"/> + <storages name="disk0" label="disk0" size_gb="100"/> + <credentials xsi:type="commons:KeyPair" name="ssh_key" algorithm="RSA" bits="4096"/> + <networks name="net1" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.0"> + <gateways name="g1" address="10.83.18.65"/> + </networks> </infrastructure> <concretizations name="con_infra"> - <providers name="openstack"> - <vms name="concrete_vm" maps="//@infrastructure/@nodes.0/@machineDefinition"> - <annotations xsi:type="commons:SProperty" key="vm_name" value="nginx-host"/> - <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + <providers name="vsphere"> + <annotations xsi:type="commons:SProperty" key="username" value="vc_username"/> + <annotations xsi:type="commons:SProperty" key="password" value="vc_password"/> + <annotations xsi:type="commons:SProperty" key="vsphere_server" value="psvc10000002.cd.sigov.si"/> + <annotations xsi:type="commons:BProperty" key="allow_unverified_ssl" value="true"/> + <resources name="dc" preexisting="true" type="vsphere_datacenter" gname="PIACDC"/> + <resources name="cl" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_compute_cluster" gname="PIACC"/> + <resources name="pool" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_resource_pool" gname="Piacere"/> + <vms name="con_vm1" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0 //@concretizations.0/@providers.0/@vmImages.0" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="host_name" value="simpa-test00-piacere"/> + <annotations xsi:type="commons:SProperty" key="domain" value="tri.lan"/> + <annotations xsi:type="commons:SProperty" key="guest_id" value="centos7_64Guest"/> + <annotations xsi:type="commons:SProperty" key="disk" value="disk0"/> + <annotations xsi:type="commons:IProperty" key="disk_size" value="100"/> + </vms> + <vms name="con_vm2" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0 //@concretizations.0/@providers.0/@vmImages.0" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="host_name" value="simpa-test00-piacere"/> + <annotations xsi:type="commons:SProperty" key="domain" value="tri.lan"/> + <annotations xsi:type="commons:SProperty" key="guest_id" value="centos7_64Guest"/> + <annotations xsi:type="commons:SProperty" key="disk" value="disk1"/> + <annotations xsi:type="commons:IProperty" key="disk_size" value="100"/> </vms> - <networks name="concrete_net" maps="//@infrastructure/@networks.0"> - <annotations xsi:type="commons:SProperty" key="name" value="ostack2"/> + <vmImages name="template" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@generators.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_virtual_machine_name" value="c7tmp"/> + </vmImages> + <networks name="network" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_network_name" value="Nested-ESXi"/> </networks> + <storages name="datastore" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@storages.0"> + <annotations xsi:type="commons:SProperty" key="vsphere_datastore_name" value="NFSShare01"/> + </storages> </providers> </concretizations> - <optimization name="opt"> - <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> - <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 200" property="cost" max="200.0"/> - <nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req2" description="Provider" property="provider"> - <values>OPEN</values> - </nonfunctionalRequirements> - </optimization> - <configurations name="config"> - <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0/@machineDefinition"/> - </configurations> </commons:DOMLModel> diff --git a/icgparser/doml/v1/posidonia_example.domlx b/icgparser/doml/v1/posidonia_example.domlx new file mode 100644 index 0000000000000000000000000000000000000000..17587d4690e717015e8285cd5e734671c62f29d3 --- /dev/null +++ b/icgparser/doml/v1/posidonia_example.domlx @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="posidonia" activeInfrastructure="//@concretizations.0"> + <annotations xsi:type="commons:SProperty" key="entorno" value="pre"/> + <annotations xsi:type="commons:SProperty" key="proyecto" value="baleares"/> + <infrastructure name="abstractInfra"> + <nodes xsi:type="infra:VirtualMachine" name="OracleDB" os="ami-02a6bfdcf8224bd77" storage="20" credentials="//@infrastructure/@credentials.3"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </nodes> + <nodes xsi:type="infra:AutoScalingGroup" name="gestaut_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="gestaut_vm" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.0" group="//@infrastructure/@groups.0"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </machineDefinition> + </nodes> + <nodes xsi:type="infra:AutoScalingGroup" name="elasticsearch_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="elasticsearch_vm" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.1" group="//@infrastructure/@groups.0"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </machineDefinition> + </nodes> + <nodes xsi:type="infra:AutoScalingGroup" name="edi_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="edi_vm" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.2" group="//@infrastructure/@groups.0"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </machineDefinition> + </nodes> + <networks name="vpc" protocol="tcp/ip" addressRange="10.100.0.0/16"> + <igws name="internet"/> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@machineDefinition/@ifaces.0 //@infrastructure/@nodes.2/@machineDefinition/@ifaces.0 //@infrastructure/@nodes.3/@machineDefinition/@ifaces.0"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="10.100.2.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.1 //@infrastructure/@nodes.1/@machineDefinition/@ifaces.1 //@infrastructure/@nodes.2/@machineDefinition/@ifaces.1 //@infrastructure/@nodes.3/@machineDefinition/@ifaces.1"/> + <subnets name="subnet3" protocol="tcp/ip" addressRange="10.100.3.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.2 //@infrastructure/@nodes.1/@machineDefinition/@ifaces.2 //@infrastructure/@nodes.2/@machineDefinition/@ifaces.2 //@infrastructure/@nodes.3/@machineDefinition/@ifaces.2"/> + </networks> + <credentials xsi:type="infra:KeyPair" name="GestautKeyName" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="ESKeyName" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="EdiKeyName" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:UserPass" name="dbCredentials" username="balearesadm" password="balearesadm"/> + <groups xsi:type="infra:SecurityGroup" name="sg" groupedNodes="//@infrastructure/@nodes.1/@machineDefinition //@infrastructure/@nodes.2/@machineDefinition //@infrastructure/@nodes.3/@machineDefinition"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="lb" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="monitor" kind="INGRESS" protocol="tcp" fromPort="6556" toPort="6556"> + <cidr>54.217.119.81/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>213.96.27.139/32</cidr> + <cidr>37.187.173.88/32</cidr> + <cidr>51.89.40.59/32</cidr> + <cidr>195.53.242.200/32</cidr> + </rules> + </groups> + <groups xsi:type="infra:SecurityGroup" name="dbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ora" kind="INGRESS" protocol="tcp" fromPort="1521" toPort="1521"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + <cidr>84.124.78.66/32</cidr> + </rules> + </groups> + <groups xsi:type="infra:SecurityGroup" name="elbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + </groups> + <groups xsi:type="infra:SecurityGroup" name="checkmk"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>84.124.78.66/32</cidr> + </rules> + </groups> + </infrastructure> + <concretizations name="dev"> + <providers name="aws"> + <vms name="concrete_oracle_db" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="concrete_gestaut_vm" maps="//@infrastructure/@nodes.1/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="elasticsearch_vm" maps="//@infrastructure/@nodes.2/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="edi_vm" maps="//@infrastructure/@nodes.3/@machineDefinition"/> + <networks name="concrete_vpc" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </networks> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="availability"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 70.0" property="cost" max="70.0"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="Availability >= 66.5%" property="availability" min="66.5"/> + </optimization> +</commons:DOMLModel> diff --git a/icgparser/doml/v2/doml.ecore b/icgparser/doml/v2/doml.ecore new file mode 100644 index 0000000000000000000000000000000000000000..cbff3c686bae8d319a1d8c6a272d16b18cc65034 --- /dev/null +++ b/icgparser/doml/v2/doml.ecore @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml"> + <eAnnotations source="emf.gen"> + <details key="basePackage" value="eu.piacere.doml"/> + <details key="fileExtensions" value="domlx"/> + <details key="complianceLevel" value="JDK80"/> + </eAnnotations> + <eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons" + nsPrefix="commons"> + <eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="2.2"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1" + eType="#//concrete/ConcreteInfrastructure" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1" + eType="#//commons/Configuration" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration" + eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure" + eType="#//concrete/ConcreteInfrastructure"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1" + eType="#//commons/Property" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1" + eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1" + eType="#//commons/Deployment" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeployableElement" abstract="true"/> + <eClassifiers xsi:type="ecore:EClass" name="Deployment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1" + eType="#//commons/DeployableElement"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1" + eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true" + eSuperTypes="#//commons/Requirement"/> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="user" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyfile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Source" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="entry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="backend" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + </eSubpackages> + <eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application" + nsPrefix="app"> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1" + eType="#//application/ApplicationComponent" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="src" eType="#//commons/Source" + containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/> + <eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure" + nsPrefix="infra"> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1" + eType="#//infrastructure/ComputingNodeGenerator" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//infrastructure/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//infrastructure/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1" + eType="#//commons/Credentials" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" + eType="#//infrastructure/ComputingGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroups" upperBound="-1" + eType="#//infrastructure/SecurityGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//infrastructure/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/MonitoringRule" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="MonitoringRule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="condition" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategyConfigurationString" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1" + eType="#//infrastructure/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind" + defaultValueLiteral="DEFAULT"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind"> + <eLiterals name="DEFAULT"/> + <eLiterals name="INTERNAL" value="1"/> + <eLiterals name="EXTERNAL" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cidr" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RuleKind"> + <eLiterals name="EGRESS"/> + <eLiterals name="INGRESS" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/Rule" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="memory_mb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu_count" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//commons/Credentials"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup" + eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="disabledMonitorings" + upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind"> + <eLiterals name="SCRIPT"/> + <eLiterals name="IMAGE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1" + eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers" + upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage" + eOpposite="#//infrastructure/VMImage/generatedVMs"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerConfig" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="container_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vm_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="host" eType="#//infrastructure/ComputingNode"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="iface" eType="#//infrastructure/NetworkInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage" + eOpposite="#//infrastructure/ContainerImage/generatedContainers"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configs" upperBound="-1" + eType="#//infrastructure/ContainerConfig" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="gateways" upperBound="-1" + eType="#//infrastructure/InternetGateway" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1" + eType="#//infrastructure/Subnet" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network"> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1" + eType="#//infrastructure/Subnet"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network" + eOpposite="#//infrastructure/Network/connectedIfaces"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup" + eOpposite="#//infrastructure/SecurityGroup/ifaces"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="address" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="size_gb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RoleKind"> + <eLiterals name="NONE"/> + <eLiterals name="MANAGER" value="1"/> + <eLiterals name="WORKER" value="2"/> + <eLiterals name="MASTER" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SwarmRole" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RoleKind"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Swarm" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="roles" upperBound="-1" + eType="#//infrastructure/SwarmRole" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete" + nsPrefix="concrete"> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1" + eType="#//concrete/RuntimeProvider" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="resources" upperBound="-1" + eType="#//concrete/GenericResource" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1" + eType="#//concrete/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1" + eType="#//concrete/VMImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1" + eType="#//concrete/ContainerImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//concrete/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//concrete/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//concrete/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1" + eType="#//concrete/ComputingGroup" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="preexisting" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="refs" upperBound="-1" + eType="#//concrete/ConcreteElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="GenericResource" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="gname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization" + nsPrefix="optimization"> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1" + eType="#//optimization/OptimizationSolution" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1" + eType="#//optimization/OptimizationObjective" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ObjectiveValue"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="availability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="performance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" eType="#//optimization/ObjectiveValue" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="decisions" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="Max"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/> + </eSubpackages> +</ecore:EPackage> diff --git a/icgparser/doml/v2/doml_v2.0.ecore b/icgparser/doml/v2/doml_v2.0.ecore new file mode 100644 index 0000000000000000000000000000000000000000..9c23605fed74133837525dfab8b471013077d262 --- /dev/null +++ b/icgparser/doml/v2/doml_v2.0.ecore @@ -0,0 +1,390 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml"> + <eAnnotations source="emf.gen"> + <details key="basePackage" value="eu.piacere.doml"/> + <details key="fileExtensions" value="domlx"/> + <details key="complianceLevel" value="JDK80"/> + </eAnnotations> + <eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons" + nsPrefix="commons"> + <eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + changeable="false" defaultValueLiteral="v2"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1" + eType="#//concrete/ConcreteInfrastructure" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1" + eType="#//commons/Configuration" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration" + eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure" + eType="#//concrete/ConcreteInfrastructure"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"> + <eOperations name="getValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//commons/DOMLElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1" + eType="#//commons/Property" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1" + eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1" + eType="#//commons/Deployment" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Deployment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1" + eType="#//application/ApplicationComponent"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1" + eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true" + eSuperTypes="#//commons/Requirement"/> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + </eSubpackages> + <eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application" + nsPrefix="app"> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1" + eType="#//application/ApplicationComponent" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true" + eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configFile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/> + <eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure" + nsPrefix="infra"> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1" + eType="#//infrastructure/ComputingNodeGenerator" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//infrastructure/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//infrastructure/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1" + eType="#//infrastructure/Credentials" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" + eType="#//infrastructure/ComputingGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroups" upperBound="-1" + eType="#//infrastructure/SecurityGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//infrastructure/Network" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1" + eType="#//infrastructure/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="deploymentNetwork" eType="#//infrastructure/Network"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind" + defaultValueLiteral="DEFAULT"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind"> + <eLiterals name="DEFAULT"/> + <eLiterals name="INTERNAL" value="1"/> + <eLiterals name="EXTERNAL" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cidr" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RuleKind"> + <eLiterals name="EGRESS"/> + <eLiterals name="INGRESS" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/Rule" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true" + eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="memory_mb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu_count" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//infrastructure/Credentials"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup" + eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind"> + <eLiterals name="SCRIPT"/> + <eLiterals name="IMAGE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1" + eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers" + upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage" + eOpposite="#//infrastructure/VMImage/generatedVMs"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage" + eOpposite="#//infrastructure/ContainerImage/generatedContainers"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="hosts" upperBound="-1" + eType="#//infrastructure/ComputingNode"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="igws" upperBound="-1" + eType="#//infrastructure/InternetGateway" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1" + eType="#//infrastructure/Subnet" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network"> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1" + eType="#//infrastructure/Subnet"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network" + eOpposite="#//infrastructure/Network/connectedIfaces"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup" + eOpposite="#//infrastructure/SecurityGroup/ifaces"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"/> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="size_gb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//infrastructure/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="user" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyfile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//infrastructure/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RoleKind"> + <eLiterals name="NONE"/> + <eLiterals name="MANAGER" value="1"/> + <eLiterals name="WORKER" value="2"/> + <eLiterals name="MASTER" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SwarmRole" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RoleKind"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Swarm" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="roles" upperBound="-1" + eType="#//infrastructure/SwarmRole" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete" + nsPrefix="concrete"> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1" + eType="#//concrete/RuntimeProvider" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1" + eType="#//concrete/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1" + eType="#//concrete/VMImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1" + eType="#//concrete/ContainerImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//concrete/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//concrete/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//concrete/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1" + eType="#//concrete/ComputingGroup" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization" + nsPrefix="optimization"> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1" + eType="#//optimization/OptimizationSolution" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1" + eType="#//optimization/OptimizationObjective" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ObjectiveValue"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="availability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="performance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" eType="#//optimization/ObjectiveValue" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="decisions" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="Max"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/> + </eSubpackages> +</ecore:EPackage> diff --git a/icgparser/doml/v2/doml_v2.1-2.ecore b/icgparser/doml/v2/doml_v2.1-2.ecore new file mode 100644 index 0000000000000000000000000000000000000000..3b499b4c9cf6c4ed09a54a0ebe0dcc3eddab87f3 --- /dev/null +++ b/icgparser/doml/v2/doml_v2.1-2.ecore @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml"> + <eAnnotations source="emf.gen"> + <details key="basePackage" value="eu.piacere.doml"/> + <details key="fileExtensions" value="domlx"/> + <details key="complianceLevel" value="JDK80"/> + </eAnnotations> + <eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons" + nsPrefix="commons"> + <eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="2.2"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1" + eType="#//concrete/ConcreteInfrastructure" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1" + eType="#//commons/Configuration" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration" + eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure" + eType="#//concrete/ConcreteInfrastructure"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1" + eType="#//commons/Property" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1" + eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1" + eType="#//commons/Deployment" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeployableElement" abstract="true"/> + <eClassifiers xsi:type="ecore:EClass" name="Deployment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1" + eType="#//commons/DeployableElement"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1" + eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true" + eSuperTypes="#//commons/Requirement"/> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="user" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyfile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Source" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="entry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="backend" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + </eSubpackages> + <eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application" + nsPrefix="app"> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1" + eType="#//application/ApplicationComponent" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="src" eType="#//commons/Source" + containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/> + <eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure" + nsPrefix="infra"> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1" + eType="#//infrastructure/ComputingNodeGenerator" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//infrastructure/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//infrastructure/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1" + eType="#//commons/Credentials" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" + eType="#//infrastructure/ComputingGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroups" upperBound="-1" + eType="#//infrastructure/SecurityGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//infrastructure/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/MonitoringRule" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="MonitoringRule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="condition" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategyConfigurationString" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1" + eType="#//infrastructure/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind" + defaultValueLiteral="DEFAULT"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind"> + <eLiterals name="DEFAULT"/> + <eLiterals name="INTERNAL" value="1"/> + <eLiterals name="EXTERNAL" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cidr" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RuleKind"> + <eLiterals name="EGRESS"/> + <eLiterals name="INGRESS" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/Rule" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="memory_mb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu_count" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//commons/Credentials"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup" + eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="disabledMonitorings" + upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind"> + <eLiterals name="SCRIPT"/> + <eLiterals name="IMAGE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1" + eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers" + upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage" + eOpposite="#//infrastructure/VMImage/generatedVMs"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerConfig" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="container_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vm_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="host" eType="#//infrastructure/ComputingNode"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="iface" eType="#//infrastructure/NetworkInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage" + eOpposite="#//infrastructure/ContainerImage/generatedContainers"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configs" upperBound="-1" + eType="#//infrastructure/ContainerConfig" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="gateways" upperBound="-1" + eType="#//infrastructure/InternetGateway" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1" + eType="#//infrastructure/Subnet" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network"> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1" + eType="#//infrastructure/Subnet"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network" + eOpposite="#//infrastructure/Network/connectedIfaces"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup" + eOpposite="#//infrastructure/SecurityGroup/ifaces"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="address" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="size_gb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RoleKind"> + <eLiterals name="NONE"/> + <eLiterals name="MANAGER" value="1"/> + <eLiterals name="WORKER" value="2"/> + <eLiterals name="MASTER" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SwarmRole" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RoleKind"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Swarm" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="roles" upperBound="-1" + eType="#//infrastructure/SwarmRole" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete" + nsPrefix="concrete"> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1" + eType="#//concrete/RuntimeProvider" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="resources" upperBound="-1" + eType="#//concrete/GenericResource" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1" + eType="#//concrete/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1" + eType="#//concrete/VMImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1" + eType="#//concrete/ContainerImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//concrete/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//concrete/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//concrete/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1" + eType="#//concrete/ComputingGroup" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="preexisting" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="refs" upperBound="-1" + eType="#//concrete/ConcreteElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="GenericResource" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="gname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization" + nsPrefix="optimization"> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1" + eType="#//optimization/OptimizationSolution" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1" + eType="#//optimization/OptimizationObjective" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ObjectiveValue"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="availability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="performance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" eType="#//optimization/ObjectiveValue" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="decisions" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="Max"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/> + </eSubpackages> +</ecore:EPackage> diff --git a/icgparser/doml/v2/doml_v2.1.ecore b/icgparser/doml/v2/doml_v2.1.ecore new file mode 100644 index 0000000000000000000000000000000000000000..02f3904f45a536afce64bd47b8e8a4f89b8209a4 --- /dev/null +++ b/icgparser/doml/v2/doml_v2.1.ecore @@ -0,0 +1,396 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml"> + <eAnnotations source="emf.gen"> + <details key="basePackage" value="eu.piacere.doml"/> + <details key="fileExtensions" value="domlx"/> + <details key="complianceLevel" value="JDK80"/> + </eAnnotations> + <eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons" + nsPrefix="commons"> + <eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + changeable="false" defaultValueLiteral="v2"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1" + eType="#//concrete/ConcreteInfrastructure" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1" + eType="#//commons/Configuration" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration" + eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure" + eType="#//concrete/ConcreteInfrastructure"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"> + <eOperations name="getValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//commons/DOMLElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1" + eType="#//commons/Property" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1" + eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1" + eType="#//commons/Deployment" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Deployment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1" + eType="#//application/ApplicationComponent"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1" + eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true" + eSuperTypes="#//commons/Requirement"/> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + </eSubpackages> + <eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application" + nsPrefix="app"> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1" + eType="#//application/ApplicationComponent" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true" + eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configFile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/> + <eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure" + nsPrefix="infra"> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1" + eType="#//infrastructure/ComputingNodeGenerator" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//infrastructure/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//infrastructure/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1" + eType="#//infrastructure/Credentials" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" + eType="#//infrastructure/ComputingGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroups" upperBound="-1" + eType="#//infrastructure/SecurityGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//infrastructure/Network" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1" + eType="#//infrastructure/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind" + defaultValueLiteral="DEFAULT"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind"> + <eLiterals name="DEFAULT"/> + <eLiterals name="INTERNAL" value="1"/> + <eLiterals name="EXTERNAL" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cidr" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RuleKind"> + <eLiterals name="EGRESS"/> + <eLiterals name="INGRESS" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/Rule" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true" + eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="memory_mb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu_count" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//infrastructure/Credentials"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup" + eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind"> + <eLiterals name="SCRIPT"/> + <eLiterals name="IMAGE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1" + eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers" + upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage" + eOpposite="#//infrastructure/VMImage/generatedVMs"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerConfig" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="container_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vm_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="host" eType="#//infrastructure/ComputingNode"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="iface" eType="#//infrastructure/NetworkInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage" + eOpposite="#//infrastructure/ContainerImage/generatedContainers"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configs" upperBound="-1" + eType="#//infrastructure/ContainerConfig" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="igws" upperBound="-1" + eType="#//infrastructure/InternetGateway" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1" + eType="#//infrastructure/Subnet" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network"> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1" + eType="#//infrastructure/Subnet"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network" + eOpposite="#//infrastructure/Network/connectedIfaces"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup" + eOpposite="#//infrastructure/SecurityGroup/ifaces"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"/> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="size_gb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//infrastructure/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="user" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyfile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//infrastructure/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RoleKind"> + <eLiterals name="NONE"/> + <eLiterals name="MANAGER" value="1"/> + <eLiterals name="WORKER" value="2"/> + <eLiterals name="MASTER" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SwarmRole" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RoleKind"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Swarm" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="roles" upperBound="-1" + eType="#//infrastructure/SwarmRole" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete" + nsPrefix="concrete"> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1" + eType="#//concrete/RuntimeProvider" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1" + eType="#//concrete/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1" + eType="#//concrete/VMImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1" + eType="#//concrete/ContainerImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//concrete/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//concrete/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//concrete/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1" + eType="#//concrete/ComputingGroup" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="address" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization" + nsPrefix="optimization"> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1" + eType="#//optimization/OptimizationSolution" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1" + eType="#//optimization/OptimizationObjective" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ObjectiveValue"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="availability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="performance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" eType="#//optimization/ObjectiveValue" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="decisions" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="Max"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/> + </eSubpackages> +</ecore:EPackage> diff --git a/icgparser/doml/v2/doml_v2.2.ecore b/icgparser/doml/v2/doml_v2.2.ecore new file mode 100644 index 0000000000000000000000000000000000000000..f80777f7bfd4820072e505a28d69b4ce691473c8 --- /dev/null +++ b/icgparser/doml/v2/doml_v2.2.ecore @@ -0,0 +1,407 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml"> + <eAnnotations source="emf.gen"> + <details key="basePackage" value="eu.piacere.doml"/> + <details key="fileExtensions" value="domlx"/> + <details key="complianceLevel" value="JDK80"/> + </eAnnotations> + <eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons" + nsPrefix="commons"> + <eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + changeable="false" defaultValueLiteral="v2.1.1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1" + eType="#//concrete/ConcreteInfrastructure" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1" + eType="#//commons/Configuration" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration" + eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure" + eType="#//concrete/ConcreteInfrastructure"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"> + <eOperations name="getValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//commons/DOMLElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1" + eType="#//commons/Property" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1" + eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1" + eType="#//commons/Deployment" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeployableElement" abstract="true"/> + <eClassifiers xsi:type="ecore:EClass" name="Deployment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1" + eType="#//commons/DeployableElement"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1" + eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true" + eSuperTypes="#//commons/Requirement"/> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="user" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyfile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Source" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="engine" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="entry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="backend" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credential" eType="#//commons/Credentials" + containment="true"/> + </eClassifiers> + </eSubpackages> + <eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application" + nsPrefix="app"> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1" + eType="#//application/ApplicationComponent" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="src" eType="#//commons/Source" + containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/> + <eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure" + nsPrefix="infra"> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1" + eType="#//infrastructure/ComputingNodeGenerator" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//infrastructure/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//infrastructure/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1" + eType="#//commons/Credentials" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" + eType="#//infrastructure/ComputingGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroups" upperBound="-1" + eType="#//infrastructure/SecurityGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//infrastructure/Network" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1" + eType="#//infrastructure/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind" + defaultValueLiteral="DEFAULT"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind"> + <eLiterals name="DEFAULT"/> + <eLiterals name="INTERNAL" value="1"/> + <eLiterals name="EXTERNAL" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cidr" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RuleKind"> + <eLiterals name="EGRESS"/> + <eLiterals name="INGRESS" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/Rule" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="memory_mb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu_count" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//commons/Credentials"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup" + eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind"> + <eLiterals name="SCRIPT"/> + <eLiterals name="IMAGE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1" + eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers" + upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage" + eOpposite="#//infrastructure/VMImage/generatedVMs"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerConfig" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="container_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vm_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="host" eType="#//infrastructure/ComputingNode"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="iface" eType="#//infrastructure/NetworkInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage" + eOpposite="#//infrastructure/ContainerImage/generatedContainers"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configs" upperBound="-1" + eType="#//infrastructure/ContainerConfig" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="igws" upperBound="-1" + eType="#//infrastructure/InternetGateway" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1" + eType="#//infrastructure/Subnet" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network"> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1" + eType="#//infrastructure/Subnet"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network" + eOpposite="#//infrastructure/Network/connectedIfaces"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup" + eOpposite="#//infrastructure/SecurityGroup/ifaces"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"/> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="size_gb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RoleKind"> + <eLiterals name="NONE"/> + <eLiterals name="MANAGER" value="1"/> + <eLiterals name="WORKER" value="2"/> + <eLiterals name="MASTER" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SwarmRole" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RoleKind"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Swarm" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="roles" upperBound="-1" + eType="#//infrastructure/SwarmRole" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete" + nsPrefix="concrete"> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1" + eType="#//concrete/RuntimeProvider" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1" + eType="#//concrete/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1" + eType="#//concrete/VMImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1" + eType="#//concrete/ContainerImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//concrete/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//concrete/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//concrete/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1" + eType="#//concrete/ComputingGroup" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="preexisting" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization" + nsPrefix="optimization"> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1" + eType="#//optimization/OptimizationSolution" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1" + eType="#//optimization/OptimizationObjective" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ObjectiveValue"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="availability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="performance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" eType="#//optimization/ObjectiveValue" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="decisions" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="Max"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/> + </eSubpackages> +</ecore:EPackage> diff --git a/icgparser/doml/v2/nio3.domlx b/icgparser/doml/v2/nio3.domlx new file mode 100644 index 0000000000000000000000000000000000000000..9b8a71d14b75dc1c46d3927a0893dd9c5c7015b6 --- /dev/null +++ b/icgparser/doml/v2/nio3.domlx @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="nio3_test_exec_env" activeInfrastructure="//@concretizations.0"> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="centos7" memory_mb="8192.0" cpu_count="2"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <storages name="disk0" label="disk0" size_gb="40"/> + <networks name="net1" protocol="tcp/ip" addressRange="0.0.0.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="concrete_vm" maps="//@infrastructure/@nodes.0"/> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + <storages name="concrete_disk" maps="//@infrastructure/@storages.0"/> + </providers> + </concretizations> +</commons:DOMLModel> diff --git a/icgparser/doml/v2/posidonia_aws.domlx b/icgparser/doml/v2/posidonia_aws.domlx new file mode 100644 index 0000000000000000000000000000000000000000..963d0970c5eccf0bdd2c2268b02c28604525d3d1 --- /dev/null +++ b/icgparser/doml/v2/posidonia_aws.domlx @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="posidonia" activeInfrastructure="//@concretizations.0" version="2.0"> + <annotations xsi:type="commons:SProperty" key="entorno" value="pre"/> + <annotations xsi:type="commons:SProperty" key="proyecto" value="baleares"/> + <infrastructure name="abstractInfra"> + <nodes xsi:type="infra:VirtualMachine" name="OracleDB" os="ami-02a6bfdcf8224bd77" storage="20" credentials="//@infrastructure/@credentials.3"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="GestautKeyName" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="ESKeyName" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="EdiKeyName" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:UserPass" name="dbCredentials" username="balearesadm" password="balearesadm"/> + <groups xsi:type="infra:AutoScalingGroup" name="gestaut_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="gestaut_vm" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.0"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </machineDefinition> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="elasticsearch_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="elasticsearch_vm" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.1"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </machineDefinition> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="edi_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="edi_vm" os="ami-02a6bfdcf8224bd77" credentials="//@infrastructure/@credentials.2"> + <ifaces name="db1" belongsTo="//@infrastructure/@networks.0/@subnets.0"/> + <ifaces name="db2" belongsTo="//@infrastructure/@networks.0/@subnets.1"/> + <ifaces name="db3" belongsTo="//@infrastructure/@networks.0/@subnets.2"/> + </machineDefinition> + </groups> + <securityGroups name="sg" ifaces="//@infrastructure/@groups.0/@machineDefinition/@ifaces.0"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="lb" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="monitor" kind="INGRESS" protocol="tcp" fromPort="6556" toPort="6556"> + <cidr>54.217.119.81/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>213.96.27.139/32</cidr> + <cidr>37.187.173.88/32</cidr> + <cidr>51.89.40.59/32</cidr> + <cidr>195.53.242.200/32</cidr> + </rules> + </securityGroups> + <securityGroups name="dbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ora" kind="INGRESS" protocol="tcp" fromPort="1521" toPort="1521"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + <cidr>84.124.78.66/32</cidr> + </rules> + </securityGroups> + <securityGroups name="elbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + </securityGroups> + <securityGroups name="checkmk"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>84.124.78.66/32</cidr> + </rules> + </securityGroups> + <networks name="vpc" protocol="tcp/ip" addressRange="10.100.0.0/16"> + <igws name="internet"/> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@groups.0/@machineDefinition/@ifaces.0 //@infrastructure/@groups.1/@machineDefinition/@ifaces.0 //@infrastructure/@groups.2/@machineDefinition/@ifaces.0"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="10.100.2.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.1 //@infrastructure/@groups.0/@machineDefinition/@ifaces.1 //@infrastructure/@groups.1/@machineDefinition/@ifaces.1 //@infrastructure/@groups.2/@machineDefinition/@ifaces.1"/> + <subnets name="subnet3" protocol="tcp/ip" addressRange="10.100.3.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.2 //@infrastructure/@groups.0/@machineDefinition/@ifaces.2 //@infrastructure/@groups.1/@machineDefinition/@ifaces.2 //@infrastructure/@groups.2/@machineDefinition/@ifaces.2"/> + </networks> + </infrastructure> + <concretizations name="dev"> + <providers name="aws"> + <vms name="concrete_oracle_db" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="concrete_gestaut_vm" maps="//@infrastructure/@groups.0/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="elasticsearch_vm" maps="//@infrastructure/@groups.1/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </vms> + <vms name="edi_vm" maps="//@infrastructure/@groups.2/@machineDefinition"/> + <networks name="concrete_vpc" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="instance_type" value="t2.micro"/> + </networks> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="availability"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 70.0" property="cost" max="70.0"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="Availability >= 66.5%" property="availability" min="66.5"/> + </optimization> +</commons:DOMLModel> diff --git a/icgparser/doml/v2/posidonia_openstack.domlx b/icgparser/doml/v2/posidonia_openstack.domlx new file mode 100644 index 0000000000000000000000000000000000000000..3e7b3c5e21a25ae1b19b249ca0afeb6ad0c7588d --- /dev/null +++ b/icgparser/doml/v2/posidonia_openstack.domlx @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="posidonia_openstack" activeInfrastructure="//@concretizations.0"> + <annotations xsi:type="commons:SProperty" key="entorno" value="pre"/> + <annotations xsi:type="commons:SProperty" key="proyecto" value="baleares"/> + <infrastructure name="abstractInfra"> + <nodes xsi:type="infra:VirtualMachine" name="OracleDB" os="Ubuntu-Focal-20.04-Daily-2022-04-19" storage="20" credentials="//@infrastructure/@credentials.3"> + <ifaces name="db" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <credentials xsi:type="infra:KeyPair" name="GestautKeyName" user="gestaut" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="ESKeyName" user="es" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="EdiKeyName" user="edi" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <credentials xsi:type="infra:KeyPair" name="DbKeyName" user="oracledb" keyfile="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" algorithm="RSA" bits="4096"/> + <groups xsi:type="infra:AutoScalingGroup" name="gestaut_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="gestaut_vm" os="Ubuntu-Focal-20.04-Daily-2022-04-19" credentials="//@infrastructure/@credentials.0"> + <ifaces name="gestaut" belongsTo="//@infrastructure/@networks.0"/> + </machineDefinition> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="elasticsearch_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="elasticsearch_vm" os="Ubuntu-Focal-20.04-Daily-2022-04-19" credentials="//@infrastructure/@credentials.1"> + <ifaces name="elasticsearch" belongsTo="//@infrastructure/@networks.0"/> + </machineDefinition> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="edi_asg" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="edi_vm" os="Ubuntu-Focal-20.04-Daily-2022-04-19" credentials="//@infrastructure/@credentials.2"> + <ifaces name="edi" belongsTo="//@infrastructure/@networks.0"/> + </machineDefinition> + </groups> + <securityGroups name="sg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="lb" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + <rules name="monitor" kind="INGRESS" protocol="tcp" fromPort="6556" toPort="6556"> + <cidr>54.217.119.81/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>213.96.27.139/32</cidr> + <cidr>37.187.173.88/32</cidr> + <cidr>51.89.40.59/32</cidr> + <cidr>195.53.242.200/32</cidr> + </rules> + </securityGroups> + <securityGroups name="dbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ora" kind="INGRESS" protocol="tcp" fromPort="1521" toPort="1521"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + <cidr>84.124.78.66/32</cidr> + </rules> + </securityGroups> + <securityGroups name="elbsg"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + <cidr>::/0</cidr> + </rules> + <rules name="es" kind="INGRESS" protocol="tcp" fromPort="9200" toPort="9200"> + <cidr>10.100.1.0/24</cidr> + <cidr>10.100.2.0/24</cidr> + <cidr>10.100.3.0/24</cidr> + </rules> + </securityGroups> + <securityGroups name="checkmk"> + <rules name="salida" protocol="-1" fromPort="0" toPort="0"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>84.124.78.66/32</cidr> + </rules> + <rules name="ftp" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>84.124.78.66/32</cidr> + </rules> + </securityGroups> + <networks name="vpc" protocol="tcp/ip" addressRange="10.100.0.0/16" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@groups.0/@machineDefinition/@ifaces.0 //@infrastructure/@groups.1/@machineDefinition/@ifaces.0 //@infrastructure/@groups.2/@machineDefinition/@ifaces.0"> + <igws name="internet"/> + <subnets name="subnet1" protocol="tcp/ip" addressRange="10.100.1.0/24"/> + <subnets name="subnet2" protocol="tcp/ip" addressRange="10.100.2.0/24"/> + <subnets name="subnet3" protocol="tcp/ip" addressRange="10.100.3.0/24"/> + </networks> + </infrastructure> + <concretizations name="dev"> + <providers name="openstack"> + <vms name="concrete_oracle_db" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + </vms> + <vms name="concrete_gestaut_vm" maps="//@infrastructure/@groups.0/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + </vms> + <vms name="elasticsearch_vm" maps="//@infrastructure/@groups.1/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + </vms> + <vms name="edi_vm" maps="//@infrastructure/@groups.2/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + </vms> + <networks name="concrete_vpc" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + </networks> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <objectives xsi:type="optimization:MeasurableObjective" kind="max" property="availability"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 70.0" property="cost" max="70.0"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="Availability >= 66.5%" property="availability" min="66.5"/> + </optimization> +</commons:DOMLModel> diff --git a/icgparser/doml/v2/uc3.domlx b/icgparser/doml/v2/uc3.domlx new file mode 100644 index 0000000000000000000000000000000000000000..aecc4e58f6278adb26e5ce6b60cb8288e6e046e6 --- /dev/null +++ b/icgparser/doml/v2/uc3.domlx @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:optimization="http://www.piacere-project.eu/doml/optimization" name="uc3_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="iwg"> + <exposedInterfaces name="net_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="osint" consumedInterfaces="//@application/@components.0/@exposedInterfaces.0 //@application/@components.3/@exposedInterfaces.0 //@application/@components.2/@exposedInterfaces.0"> + <exposedInterfaces name="osint_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="ewcf" consumedInterfaces="//@application/@components.4/@exposedInterfaces.0"> + <exposedInterfaces name="ewcf_rest_interface"/> + </components> + <components xsi:type="app:SaaS" name="external_twitter"> + <exposedInterfaces name="get_twitter" endPoint="https://twitter_api/get"/> + </components> + <components xsi:type="app:SaaS" name="external_firebase"> + <exposedInterfaces name="get_firebase" endPoint="https://firebase_api/get"/> + </components> + </application> + <infrastructure name="infra"> + <generators xsi:type="infra:VMImage" name="v_img1" generatedVMs="//@infrastructure/@groups.1/@machineDefinition"/> + <generators xsi:type="infra:VMImage" name="v_img2" generatedVMs="//@infrastructure/@groups.0/@machineDefinition"/> + <generators xsi:type="infra:VMImage" name="v_img3" generatedVMs="//@infrastructure/@groups.2/@machineDefinition"/> + <credentials xsi:type="infra:KeyPair" name="ssh_key" user="ubuntu" keyfile="/home/user1/.ssh/openstack.key" algorithm="RSA" bits="4096"/> + <groups xsi:type="infra:AutoScalingGroup" name="igw_ag" deploymentNetwork="//@infrastructure/@networks.1"> + <machineDefinition name="igw_vm" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.1"> + <ifaces name="igw_vm_net2" belongsTo="//@infrastructure/@networks.1"/> + <ifaces name="igw_vm_oam" belongsTo="//@infrastructure/@networks.3"/> + </machineDefinition> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="osint_ag" deploymentNetwork="//@infrastructure/@networks.0"> + <machineDefinition name="osint_vm" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> + <ifaces name="osint_vm_net1" belongsTo="//@infrastructure/@networks.0"/> + <ifaces name="osint_vm_oam" belongsTo="//@infrastructure/@networks.3"/> + <ifaces name="osint_igw_port" endPoint="127.0.0.1:5000" belongsTo="//@infrastructure/@networks.0"/> + </machineDefinition> + </groups> + <groups xsi:type="infra:AutoScalingGroup" name="ewcf_ag" deploymentNetwork="//@infrastructure/@networks.2"> + <machineDefinition name="ewcf_vm" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.2"> + <ifaces name="ewcf_vm_net3" belongsTo="//@infrastructure/@networks.2"/> + <ifaces name="ewcf_vm_oam" belongsTo="//@infrastructure/@networks.3"/> + </machineDefinition> + </groups> + <securityGroups name="sg"> + <rules name="icmp" protocol="icmp" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="tcp" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="tcp" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="tcp" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="net1" protocol="tcp/ip" addressRange="16.0.0.0/24" connectedIfaces="//@infrastructure/@groups.1/@machineDefinition/@ifaces.0 //@infrastructure/@groups.1/@machineDefinition/@ifaces.2"/> + <networks name="net2" protocol="tcp/ip" addressRange="16.0.1.0/24" connectedIfaces="//@infrastructure/@groups.0/@machineDefinition/@ifaces.0"/> + <networks name="net3" protocol="tcp/ip" addressRange="16.0.2.0/24" connectedIfaces="//@infrastructure/@groups.2/@machineDefinition/@ifaces.0"/> + <networks name="oam" protocol="tcp/ip" addressRange="16.0.4.0/24" connectedIfaces="//@infrastructure/@groups.0/@machineDefinition/@ifaces.1 //@infrastructure/@groups.1/@machineDefinition/@ifaces.1 //@infrastructure/@groups.2/@machineDefinition/@ifaces.1"/> + </infrastructure> + <concretizations name="con_infra"> + <providers name="openstack"> + <vms name="concrete_osint_vm" maps="//@infrastructure/@groups.1/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="osint"/> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="user1"/> + </vms> + <vms name="concrete_igw_vm" maps="//@infrastructure/@groups.0/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="igw"/> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="user1"/> + </vms> + <vms name="concrete_ewcf_vm" maps="//@infrastructure/@groups.2/@machineDefinition"> + <annotations xsi:type="commons:SProperty" key="vm_name" value="ewcf"/> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small"/> + <annotations xsi:type="commons:SProperty" key="vm_key_name" value="user1"/> + </vms> + <vmImages name="concrete_vm_image1" maps="//@infrastructure/@generators.0"> + <annotations xsi:type="commons:SProperty" key="name" value="ubuntu-20.04.3"/> + </vmImages> + <vmImages name="concrete_vm_image2" maps="//@infrastructure/@generators.1"> + <annotations xsi:type="commons:SProperty" key="name" value="ubuntu-20.04.3"/> + </vmImages> + <vmImages name="concrete_vm_image3" maps="//@infrastructure/@generators.2"> + <annotations xsi:type="commons:SProperty" key="name" value="ubuntu-20.04.3"/> + </vmImages> + <networks name="concrete_net1" maps="//@infrastructure/@networks.0"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net1"/> + </networks> + <networks name="concrete_net2" maps="//@infrastructure/@networks.1"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net2"/> + </networks> + <networks name="concrete_net3" maps="//@infrastructure/@networks.2"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net3"/> + </networks> + <networks name="concrete_net4" maps="//@infrastructure/@networks.3"> + <annotations xsi:type="commons:SProperty" key="name" value="uc3_net4"/> + </networks> + </providers> + </concretizations> + <optimization name="opt"> + <objectives xsi:type="optimization:MeasurableObjective" kind="min" property="cost"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="Cost <= 200" property="cost" max="200.0"/> + <nonfunctionalRequirements xsi:type="commons:EnumeratedRequirement" name="req2" description="Provider" property="provider"> + <values>AMAZ</values> + </nonfunctionalRequirements> + <nonfunctionalRequirements name="req3" description="elements" property="VM"/> + </optimization> + <configurations name="config"> + <deployments component="//@application/@components.1" node="//@infrastructure/@groups.1/@machineDefinition"/> + <deployments component="//@application/@components.0" node="//@infrastructure/@groups.0/@machineDefinition"/> + <deployments component="//@application/@components.2" node="//@infrastructure/@groups.2/@machineDefinition"/> + </configurations> +</commons:DOMLModel> diff --git a/icgparser/doml/v2/wordpress.domlx b/icgparser/doml/v2/wordpress.domlx new file mode 100644 index 0000000000000000000000000000000000000000..67e6d9e097ba6f14394ab4bac0b5c8ea6f829c19 --- /dev/null +++ b/icgparser/doml/v2/wordpress.domlx @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="ASCII"?> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="wordpress" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="mysql"> + <annotations xsi:type="commons:SProperty" key="db_user" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="db_password" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="db_name" value="app1"/> + <exposedInterfaces name="DB_interface"/> + </components> + <components xsi:type="app:SoftwareComponent" name="wordpress" consumedInterfaces="//@application/@components.0/@exposedInterfaces.0"> + <annotations xsi:type="commons:SProperty" key="wordpress_db_host" value="db_host"/> + <annotations xsi:type="commons:SProperty" key="wordpress_db_user" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="wordpress_db_password" value="app1user"/> + <annotations xsi:type="commons:SProperty" key="wordpress_db_name" value="app1"/> + <annotations xsi:type="commons:SProperty" key="wordpress_table_prefix" value="wp"/> + </components> + </application> + <infrastructure name="infra"> + <nodes xsi:type="infra:VirtualMachine" name="vm1" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i1" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <nodes xsi:type="infra:VirtualMachine" name="vm2" os="ubuntu-20.04.3" credentials="//@infrastructure/@credentials.0"> + <ifaces name="i2" belongsTo="//@infrastructure/@networks.0"/> + </nodes> + <networks name="net1" protocol="tcp/ip" addressRange="10.10.10.0/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.0"/> + <credentials xsi:type="infra:KeyPair" name="ssh_key" keyfile="local path to ssh key"/> + </infrastructure> + <concretizations name="con_os_infra"> + <providers name="openstack"> + <vms name="concrete_vm1" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="small-centos"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <concretizations name="con_aws_infra"> + <providers name="aws"> + <vms name="concrete_vm1" maps="//@infrastructure/@nodes.0"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="t2.micro"/> + </vms> + <vms name="concrete_vm2" maps="//@infrastructure/@nodes.1"> + <annotations xsi:type="commons:SProperty" key="vm_flavor" value="t2.micro"/> + </vms> + <networks name="concrete_net" maps="//@infrastructure/@networks.0"/> + </providers> + </concretizations> + <configurations name="config"> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.1" node="//@infrastructure/@nodes.1"/> + </configurations> +</commons:DOMLModel> diff --git a/icgparser/test_ModelResources.py b/icgparser/test_ModelResources.py new file mode 100644 index 0000000000000000000000000000000000000000..1d962b59b981f72641d2edb11a8aa38bbb176e99 --- /dev/null +++ b/icgparser/test_ModelResources.py @@ -0,0 +1,27 @@ +import unittest + +from icgparser.ModelResourcesUtilities import ModelResources, from_model_resources_to_ir_names_version1, \ + ModelResourcesUtilities + + +class MyTestCase(unittest.TestCase): + def test_ModelResources_returns_value_number(self): + first_enum = ModelResources.STEP_NAME.value + self.assertEqual(first_enum, 1) + + def test_ModelResources_returns_string_name(self): + first_enum = ModelResources.STEP_NAME.name + self.assertIsInstance(first_enum, str) + + def test_get_ir_key_name_from_model_resource_returns_doml_version_1_resourcename(self): + ir_key = from_model_resources_to_ir_names_version1(ModelResources.STEPS) + self.assertIsNotNone(ir_key) + + def test_convert_doml_version_into_integer_returns_float(self): + doml_version = "1.0" + model_resources = ModelResourcesUtilities(doml_version) + self.assertEqual(model_resources.convert_doml_version_into_integer(), 1) + + +if __name__ == '__main__': + unittest.main() diff --git a/input_file_example/nginx/parameter.json b/input_file_example/nginx/parameter.json deleted file mode 100644 index 37c1f8e33b6f0c0c726593b87dd45d4e7dea9361..0000000000000000000000000000000000000000 --- a/input_file_example/nginx/parameter.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "output_path": "output_files_generated/nginx_openstack/", - "steps": [ - { - "programming_language": "terraform", - "data": { - "provider": "openstack", - "vm": [{ - "name": "nginx-host", - "flavor": "small", - "vm_security_groups": "default", - "ssh_user": "ubuntu", - "ssh_key_file": "/home/user1/.ssh/openstack.key", - "address": "16.0.0.1", - "image": "ubuntu-20.04.3", - "network_name": "ostack2" - }], - "net": [{ - "name": "ostack2", - "address": "16.0.0.0/24", - "protocol": "tcp/ip", - "rules_name": ["rule_1", "rule_2"] - }], - "sg": [{ - "name": "rule_1", - "from_port": 80, - "to_port": 80, - "ip_protocol": "tcp", - "ipv6_cidr_blocks": "0.0.0.0/0" - }, { - "name": "rule_2", - "from_port": 22, - "to_port": 22, - "ip_protocol": "tcp", - "ipv6_cidr_blocks": "0.0.0.0/0" - }] - } - }, - { - "programming_language": "ansible", - "data": { - "operating_system": "ubuntu", - "nginx": { - "ssh_user": "ubuntu", - "ssh_key_file": "/home/user1/.ssh/openstack.key", - "address": "16.0.0.1", - "source_code": [ - "/var/www/html/index.html", - "/usr/share/nginx/html/index.html" - ] - } - } - } - ] -} \ No newline at end of file diff --git a/input_file_example/wordpress/parameters.json b/input_file_example/wordpress/parameters.json deleted file mode 100644 index 45a7d27e85e55d73610a33eaa95dae937daccc45..0000000000000000000000000000000000000000 --- a/input_file_example/wordpress/parameters.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "output_path": "output_files_generated/wordpress_azure/", - "steps": [ - { - "programming_language": "terraform", - "data": { - "provider": "azure", - "resource_group": [ - { - "name": "wordpress-rg", - "location": "eastus" - } - ], - "vms": [ - { - "resource_group_name": "wordpress-example", - "name": "wordpress-vm", - "size": "Standard_B1s", - "admin_username": "adminuser", - "admin_password": "P@$$w0rd1234!", - "ssh_user": "adminuser", - "ssh_key_file": "/ssh_keys/wordpress_rsa.pub", - "image_offer": "UbuntuServer", - "image_sku": "18.04-LTS", - "network_name": "wordpress_net" - }, - { - "resource_group_name": "wordpress-example", - "name": "myql-vm", - "size": "Standard_B1s", - "admin_username": "adminuser", - "admin_password": "P@$$w0rd1234!", - "ssh_user": "adminuser", - "ssh_key_file": "/ssh_keys/wordpress_rsa.pub", - "image_offer": "UbuntuServer", - "image_sku": "18.04-LTS", - "network_name": "mysql_net" - } - ], - "net": [ - { - "resource_group_name": "wordpress-example", - "name": "wordpress_net" - }, - { - "resource_group_name": "mysql-example", - "name": "mysql_net" - } - ] - } - }, - { - "programming_language": "ansible", - "data": { - "operating_system": "ubuntu", - "mysql": { - "db_user": "app1user", - "db_password": "app1user", - "db_name": "app1" - } - } - }, - { - "programming_language": "ansible", - "data": { - "operating_system": "ubuntu", - "wordpress": { - "wordpress_db_host": "10.10.10.10", - "wordpress_db_user": "app1user", - "wordpress_db_password": "app1user", - "wordpress_db_name": "app1", - "wordpress_table_prefix": "wp" - } - } - } - ] -} \ No newline at end of file diff --git a/input_file_generated/ir.json b/input_file_generated/ir.json index 91bfefb2658d03cef1505f75b217cc0ef1e1c1f5..e36cae6b7f9bb31eb1012764c31e239bf68b51a7 100644 --- a/input_file_generated/ir.json +++ b/input_file_generated/ir.json @@ -1,89 +1,186 @@ { - "output_path": "output_files_generated/nginx_openstack/", + "output_path": "output_files_generated/nio3_test_exec_env/", "steps": [ { "data": { - "computingGroup": [ + "credentials": [ + { + "algorithm": "RSA", + "bits": 4096, + "infra_element_name": "ssh_key" + } + ], + "networks": [ { - "http": { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": 80, - "kind": "INGRESS", - "name": "http", - "protocol": "tcp", - "toPort": 80 + "InternetGateway_g1": { + "address": "10.83.18.65", + "name": "g1" + }, + "addressRange": "/24", + "dc": { + "gname": "PIACDC", + "name": "dc", + "preexisting": true, + "type": "vsphere_datacenter" }, - "https": { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": 443, - "kind": "INGRESS", - "name": "https", - "protocol": "tcp", - "toPort": 443 + "infra_element_name": "net1", + "maps": "net1", + "name": "network", + "preexisting": true, + "protocol": "tcp/ip", + "vsphere_network_name": "Nested-ESXi" + } + ], + "provider_info": [ + { + "allow_unverified_ssl": true, + "password": "vc_password", + "provider_name": "vsphere", + "username": "vc_username", + "vsphere_server": "psvc10000002.cd.sigov.si" + } + ], + "resources": [ + { + "gname": "PIACDC", + "name": "dc", + "preexisting": true, + "type": "vsphere_datacenter" + }, + { + "dc": { + "gname": "PIACDC", + "name": "dc", + "preexisting": true, + "type": "vsphere_datacenter" }, - "icmp": { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": -1, - "kind": "EGRESS", - "name": "icmp", - "protocol": "icmp", - "toPort": -1 + "gname": "PIACC", + "name": "cl", + "preexisting": true, + "type": "vsphere_compute_cluster" + }, + { + "dc": { + "gname": "PIACDC", + "name": "dc", + "preexisting": true, + "type": "vsphere_datacenter" }, - "infra_element_name": "sg", - "ssh": { - "cidr": [ - "0.0.0.0/0" - ], - "fromPort": 22, - "kind": "INGRESS", - "name": "ssh", - "protocol": "tcp", - "toPort": 22 - } + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" } ], - "credentials": [ + "storages": [ { - "infra_element_name": "user1", - "user": "user1" + "dc": { + "gname": "PIACDC", + "name": "dc", + "preexisting": true, + "type": "vsphere_datacenter" + }, + "infra_element_name": "disk0", + "label": "disk0", + "maps": "disk0", + "name": "datastore", + "preexisting": true, + "size_gb": 100, + "vsphere_datastore_name": "NFSShare01" } ], - "networks": [ + "vmImages": [ { - "addressRange": "16.0.0.0/24", - "infra_element_name": "net1", - "infra_sgs": [ - "icmp", - "http", - "https", - "ssh" - ], - "name": "concrete_net", - "protocol": "tcp/ip" + "dc": { + "gname": "PIACDC", + "name": "dc", + "preexisting": true, + "type": "vsphere_datacenter" + }, + "infra_element_name": "img", + "kind": "SCRIPT", + "maps": "img", + "name": "template", + "preexisting": true, + "vsphere_virtual_machine_name": "c7tmp" } ], - "provider": "openstack", "vms": [ { - "credentials": "user1", - "group": "sg", - "i1": { - "associated": "sg", + "NetworkInterface_i1": { "belongsTo": "net1", - "endPoint": "16.0.0.1", + "endPoint": "10.83.18.92", "name": "i1" }, + "cpu_count": 2, + "credentials": "ssh_key", + "datastore": { + "maps": "disk0", + "name": "datastore", + "preexisting": true + }, + "disabledMonitorings": [], + "disk": "disk0", + "disk_size": 100, + "domain": "tri.lan", + "generatedFrom": "img", + "guest_id": "centos7_64Guest", + "host_name": "simpa-test00-piacere", "infra_element_name": "vm1", - "name": "concrete_vm", - "os": "Ubuntu-Focal-20.04-Daily-2022-04-19", - "vm_flavor": "small", - "vm_name": "nginx-host" + "maps": "vm1", + "memory_mb": 1024.0, + "name": "con_vm1", + "os": "centos7_64Guest", + "pool": { + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" + }, + "preexisting": false, + "template": { + "maps": "img", + "name": "template", + "preexisting": true + } + }, + { + "NetworkInterface_i1": { + "belongsTo": "net1", + "endPoint": "10.83.18.88", + "name": "i1" + }, + "cpu_count": 2, + "credentials": "ssh_key", + "datastore": { + "maps": "disk0", + "name": "datastore", + "preexisting": true + }, + "disabledMonitorings": [], + "disk": "disk1", + "disk_size": 100, + "domain": "tri.lan", + "generatedFrom": "img", + "guest_id": "centos7_64Guest", + "host_name": "simpa-test00-piacere", + "infra_element_name": "vm2", + "maps": "vm2", + "memory_mb": 1024.0, + "name": "con_vm2", + "os": "centos7_64Guest", + "pool": { + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" + }, + "preexisting": false, + "template": { + "maps": "img", + "name": "template", + "preexisting": true + } } ] }, @@ -91,52 +188,183 @@ }, { "data": { - "piacere_monitoring": { - "name": "piacere_monitoring", - "node": { - "credentials": "user1", - "group": "sg", - "i1": { - "associated": "sg", - "belongsTo": "net1", - "endPoint": "16.0.0.1", - "name": "i1" + "performance_monitoring": { + "name": "performance_monitoring", + "nodes": [ + { + "NetworkInterface_i1": { + "belongsTo": "net1", + "endPoint": "10.83.18.92", + "name": "i1" + }, + "cpu_count": 2, + "credentials": "ssh_key", + "datastore": { + "maps": "disk0", + "name": "datastore", + "preexisting": true + }, + "disabledMonitorings": [], + "disk": "disk0", + "disk_size": 100, + "domain": "tri.lan", + "generatedFrom": "img", + "guest_id": "centos7_64Guest", + "host_name": "simpa-test00-piacere", + "infra_element_name": "vm1", + "maps": "vm1", + "memory_mb": 1024.0, + "name": "con_vm1", + "os": "centos7_64Guest", + "pool": { + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" + }, + "preexisting": false, + "template": { + "maps": "img", + "name": "template", + "preexisting": true + } }, - "infra_element_name": "vm1", - "name": "concrete_vm", - "os": "Ubuntu-Focal-20.04-Daily-2022-04-19", - "vm_flavor": "small", - "vm_name": "nginx-host" - } + { + "NetworkInterface_i1": { + "belongsTo": "net1", + "endPoint": "10.83.18.88", + "name": "i1" + }, + "cpu_count": 2, + "credentials": "ssh_key", + "datastore": { + "maps": "disk0", + "name": "datastore", + "preexisting": true + }, + "disabledMonitorings": [], + "disk": "disk1", + "disk_size": 100, + "domain": "tri.lan", + "generatedFrom": "img", + "guest_id": "centos7_64Guest", + "host_name": "simpa-test00-piacere", + "infra_element_name": "vm2", + "maps": "vm2", + "memory_mb": 1024.0, + "name": "con_vm2", + "os": "centos7_64Guest", + "pool": { + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" + }, + "preexisting": false, + "template": { + "maps": "img", + "name": "template", + "preexisting": true + } + } + ] } }, "programming_language": "ansible", - "step_name": "piacere_monitoring" + "step_name": "performance_monitoring" }, { "data": { - "nginx": { - "name": "nginx", - "node": { - "credentials": "user1", - "group": "sg", - "i1": { - "associated": "sg", - "belongsTo": "net1", - "endPoint": "16.0.0.1", - "name": "i1" + "security_monitoring": { + "name": "security_monitoring", + "nodes": [ + { + "NetworkInterface_i1": { + "belongsTo": "net1", + "endPoint": "10.83.18.92", + "name": "i1" + }, + "cpu_count": 2, + "credentials": "ssh_key", + "datastore": { + "maps": "disk0", + "name": "datastore", + "preexisting": true + }, + "disabledMonitorings": [], + "disk": "disk0", + "disk_size": 100, + "domain": "tri.lan", + "generatedFrom": "img", + "guest_id": "centos7_64Guest", + "host_name": "simpa-test00-piacere", + "infra_element_name": "vm1", + "maps": "vm1", + "memory_mb": 1024.0, + "name": "con_vm1", + "os": "centos7_64Guest", + "pool": { + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" + }, + "preexisting": false, + "template": { + "maps": "img", + "name": "template", + "preexisting": true + } }, - "infra_element_name": "vm1", - "name": "concrete_vm", - "os": "Ubuntu-Focal-20.04-Daily-2022-04-19", - "vm_flavor": "small", - "vm_name": "nginx-host" - }, - "source_code": "/usr/share/nginx/html/index.html" + { + "NetworkInterface_i1": { + "belongsTo": "net1", + "endPoint": "10.83.18.88", + "name": "i1" + }, + "cpu_count": 2, + "credentials": "ssh_key", + "datastore": { + "maps": "disk0", + "name": "datastore", + "preexisting": true + }, + "disabledMonitorings": [], + "disk": "disk1", + "disk_size": 100, + "domain": "tri.lan", + "generatedFrom": "img", + "guest_id": "centos7_64Guest", + "host_name": "simpa-test00-piacere", + "infra_element_name": "vm2", + "maps": "vm2", + "memory_mb": 1024.0, + "name": "con_vm2", + "os": "centos7_64Guest", + "pool": { + "gname": "Piacere", + "name": "pool", + "preexisting": true, + "type": "vsphere_resource_pool" + }, + "preexisting": false, + "template": { + "maps": "img", + "name": "template", + "preexisting": true + } + } + ] } }, "programming_language": "ansible", - "step_name": "nginx" + "step_name": "security_monitoring" + }, + { + "data": { + "containerImages": [] + }, + "programming_language": "docker-compose" } ] } \ No newline at end of file diff --git a/main.py b/main.py index 2766ca70bdc56f4546ea86e064a4cbe3e4a172c9..6f4687c92352ef55278dc779c81424f842a7d382 100644 --- a/main.py +++ b/main.py @@ -45,8 +45,8 @@ logging.getLogger().setLevel(logging.INFO) # Parse parameters # ------------------------------------------------------------------------- skip_next = False -doml_directory = "./icgparser/doml/v1" -model_filename = "icgparser/doml/v1/nginx-openstack_v1.domlx" +doml_directory = "./icgparser/doml/v2" +model_filename = "icgparser/doml/v2/posidonia_openstack.domlx" load_split_model = False output_file_name = "iac_files.tar.gz" diff --git a/output_file_example/gitlab_1/config.yaml b/output_file_example/gitlab_1/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..90e5a8cd59886bc2fbb8fefea928cd9afa10cf9b --- /dev/null +++ b/output_file_example/gitlab_1/config.yaml @@ -0,0 +1,7 @@ +--- +iac: +- terraform +- piacere_monitoring +- git +- portainer +... \ No newline at end of file diff --git a/output_file_example/gitlab_1/git/config.yaml b/output_file_example/gitlab_1/git/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0a994ba19b5ff7bfbd24b99f8929881c7b4978f0 --- /dev/null +++ b/output_file_example/gitlab_1/git/config.yaml @@ -0,0 +1,11 @@ +## https://git.code.tecnalia.com/piacere/private/t31-doml-concepts/-/blob/main/case-studies-DOML-models/SIMPA_Validation_v2.doml + +--- +input: + - GIT_USER + - GIT_PASSWORD + - git.code.tecnalia.com/piacere/private/wp7-use-cases/uc1.si-mpa/-/tree/main/deploy-nio +output: + - ansible/provision.yml +engine: git +... diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/config.yaml b/output_file_example/gitlab_1/portainer/config.yaml similarity index 79% rename from output_files_generated/nginx_openstack/piacere_monitoring/config.yaml rename to output_file_example/gitlab_1/portainer/config.yaml index 8b7284e426fba96d8fffd9d11e5d153b09edf120..12a0d05712eeb977e6ddbf360921597304739fdf 100644 --- a/output_files_generated/nginx_openstack/piacere_monitoring/config.yaml +++ b/output_file_example/gitlab_1/portainer/config.yaml @@ -1,8 +1,8 @@ - --- input: - instance_ip_vm1 - instance_server_private_key_user1 + - ansible/provision.yml output: [] engine: ansible ... diff --git a/output_file_example/nginx_openstack_with_agents/terraform/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml b/output_file_example/nginx_openstack_with_agents/terraform/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml index 58c0cb368b76e9a0313aee87b2296e727877b2d9..47808cf1de00ffc1a13ff9c7ee26043954cfb6d1 100644 --- a/output_file_example/nginx_openstack_with_agents/terraform/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml +++ b/output_file_example/nginx_openstack_with_agents/terraform/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml @@ -1,8 +1,8 @@ roles: # - name: dj-wasabi.telegraf -# version: 0.13.2 +# version: 0.13.3 # source: https://galaxy.ansible.com - name: dj-wasabi.telegraf src: https://github.com/dj-wasabi/ansible-telegraf.git scm: git - version: 0.13.2 + version: 0.13.3 diff --git a/output_file_example/nginx_openstack_with_agents_new/ansible/config.yaml b/output_file_example/nginx_openstack_with_agents_new/ansible/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fff1792be092b69af3f0ca25b644e39c718d4f4f --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/ansible/config.yaml @@ -0,0 +1,7 @@ +--- +input: + - instance_ip + - instance_server_public_key +output: [] +engine: ansible +... diff --git a/output_file_example/nginx_openstack_with_agents_new/ansible/inventory.j2 b/output_file_example/nginx_openstack_with_agents_new/ansible/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..fb27937d59c516ee15e53689491ad2e3bc68195e --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/ansible/inventory.j2 @@ -0,0 +1,7 @@ +[vms] +{{ instance_ip }} + +[vms:vars] +ansible_connection=ssh +ansible_user=ubuntu #vm user variable potentialy +ansible_ssh_private_key_file=ssh_key \ No newline at end of file diff --git a/output_file_example/nginx_openstack_with_agents_new/ansible/ssh_key.j2 b/output_file_example/nginx_openstack_with_agents_new/ansible/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..9d5f53affb626b336ef30061a91c3c2ee0bdb43e --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/ansible/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_public_key }} \ No newline at end of file diff --git a/output_file_example/nginx_openstack_with_agents_new/config.yaml b/output_file_example/nginx_openstack_with_agents_new/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c4ece8fd1e5dc201cf88edcf02b05c2b0882aa5e --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/config.yaml @@ -0,0 +1,6 @@ +--- +iac: + - terraform + - monitoring + - ansible +... \ No newline at end of file diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/ansible.cfg b/output_file_example/nginx_openstack_with_agents_new/monitoring/ansible.cfg new file mode 100644 index 0000000000000000000000000000000000000000..660a5ebcbecd0307307b5c2d2d61083e315c4e45 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/ansible.cfg @@ -0,0 +1,7 @@ +# https://docs.ansible.com/ansible/latest/reference_appendices/config.html +[defaults] +host_key_checking = False +inventory = {{CWD}}/hosts.yaml ; This points to the file that lists your hosts +remote_user = esilab +deprecation_warnings=False ; to remove the python version depretation warning +display_skipped_hosts = no \ No newline at end of file diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/ansible_requirements.yml b/output_file_example/nginx_openstack_with_agents_new/monitoring/ansible_requirements.yml new file mode 100644 index 0000000000000000000000000000000000000000..47808cf1de00ffc1a13ff9c7ee26043954cfb6d1 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/ansible_requirements.yml @@ -0,0 +1,8 @@ +roles: +# - name: dj-wasabi.telegraf +# version: 0.13.3 +# source: https://galaxy.ansible.com + - name: dj-wasabi.telegraf + src: https://github.com/dj-wasabi/ansible-telegraf.git + scm: git + version: 0.13.3 diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/config.yaml b/output_file_example/nginx_openstack_with_agents_new/monitoring/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fff1792be092b69af3f0ca25b644e39c718d4f4f --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/config.yaml @@ -0,0 +1,7 @@ +--- +input: + - instance_ip + - instance_server_public_key +output: [] +engine: ansible +... diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/hosts.yaml b/output_file_example/nginx_openstack_with_agents_new/monitoring/hosts.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b9cbfc6d1be7e249a1f6813793dd228083d669fe --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/hosts.yaml @@ -0,0 +1,4 @@ +all: + hosts: + localhost: + ansible_connection: local diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/install_playbook_requirements.sh b/output_file_example/nginx_openstack_with_agents_new/monitoring/install_playbook_requirements.sh new file mode 100644 index 0000000000000000000000000000000000000000..843bf3b6e0c4dfb6d6157ae22687cd7585ef3a02 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/install_playbook_requirements.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +SCRIPT_DIR=$(dirname "$0") + +# to avoid the being run in a world writable directory we explicitly assign the ANSIBLE_CONFIG variable +if [[ -f ./ansible.cfg ]] +then + export ANSIBLE_CONFIG=./ansible.cfg +else + if [[ -f $SCRIPT_DIR/ansible.cfg ]] + then + export ANSIBLE_CONFIG=$SCRIPT_DIR/ansible.cfg + fi +fi + +if [[ -z "$ANSIBLE_CONFIG" ]] +then + echo ANSIBLE_CONFIG to assigned using default https://docs.ansible.com/ansible/latest/reference_appendices/config.html +else + echo ANSIBLE_CONFIG=$ANSIBLE_CONFIG +fi + +if [[ -z "$1" ]] +then + # echo without params + echo ansible-playbook $SCRIPT_DIR/site_requirements.yaml + ansible-playbook $SCRIPT_DIR/site_requirements.yaml +else + # echo with params + echo ansible-playbook $SCRIPT_DIR/site_requirements.yaml --extra-vars "$1" + ansible-playbook $SCRIPT_DIR/site_requirements.yaml --extra-vars "$1" +fi diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/inventory.j2 b/output_file_example/nginx_openstack_with_agents_new/monitoring/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..fb27937d59c516ee15e53689491ad2e3bc68195e --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/inventory.j2 @@ -0,0 +1,7 @@ +[vms] +{{ instance_ip }} + +[vms:vars] +ansible_connection=ssh +ansible_user=ubuntu #vm user variable potentialy +ansible_ssh_private_key_file=ssh_key \ No newline at end of file diff --git a/templates/ansible/ubuntu/piacere_main.tpl b/output_file_example/nginx_openstack_with_agents_new/monitoring/main.yml similarity index 100% rename from templates/ansible/ubuntu/piacere_main.tpl rename to output_file_example/nginx_openstack_with_agents_new/monitoring/main.yml diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/run-playbook.sh b/output_file_example/nginx_openstack_with_agents_new/monitoring/run-playbook.sh new file mode 100644 index 0000000000000000000000000000000000000000..f2bba22bc6dcae68d78545cc6b130677bc5083ef --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/run-playbook.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e + +SCRIPT_DIR=$(dirname "$0") + +# to avoid the being run in a world writable directory we explicitly assign the ANSIBLE_CONFIG variable +if [[ -f ./ansible.cfg ]] +then + export ANSIBLE_CONFIG=./ansible.cfg +else + if [[ -f $SCRIPT_DIR/ansible.cfg ]] + then + export ANSIBLE_CONFIG=$SCRIPT_DIR/ansible.cfg + fi +fi + +if [[ -z "$ANSIBLE_CONFIG" ]] +then + echo ANSIBLE_CONFIG to assigned using default https://docs.ansible.com/ansible/latest/reference_appendices/config.html +else + echo ANSIBLE_CONFIG=$ANSIBLE_CONFIG +fi + +if [[ -z "$1" ]] +then + # echo without params + echo ansible-playbook $SCRIPT_DIR/site.yaml + ansible-playbook $SCRIPT_DIR/site.yaml +else + # echo with params + echo ansible-playbook $SCRIPT_DIR/site.yaml --extra-vars "$1" + ansible-playbook $SCRIPT_DIR/site.yaml --extra-vars "$1" +fi diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/site.yaml b/output_file_example/nginx_openstack_with_agents_new/monitoring/site.yaml new file mode 100644 index 0000000000000000000000000000000000000000..531dbf50d5ca852802196de7eafe0c238b9beb85 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/site.yaml @@ -0,0 +1,30 @@ +- hosts: all + pre_tasks: + - name: Check parameters + fail: + msg: 'variable {{item}} not defined' + when: item is not defined + with_items: + - pma_deployment_id + - pma_influxdb_bucket + - pma_influxdb_token + - pma_influxdb_org + - pma_influxdb_addr + - name: Print parameters + debug: + msg: + - "pma_deployment_id: {{ pma_deployment_id }}" + - "pma_influxdb_bucket: {{ pma_influxdb_bucket }}" + - "pma_influxdb_token: {{ pma_influxdb_token }}" + - "pma_influxdb_org: {{ pma_influxdb_org }}" + - "pma_influxdb_addr: {{ pma_influxdb_addr }}" + - name: Ensure gnupg package + package: + name: gnupg + state: present + become: true + + vars_files: + - vars/main.yaml + roles: + - dj-wasabi.telegraf diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/site_requirements.yaml b/output_file_example/nginx_openstack_with_agents_new/monitoring/site_requirements.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3e7665dce4e17365bfd08f90425e9408d0f83045 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/site_requirements.yaml @@ -0,0 +1,9 @@ +- hosts: localhost + tasks: + - name: print disclamer + debug: + msg: this can also be done with "ansible-galaxy install -r requirements" + - name: install telegraf from galaxy + community.general.ansible_galaxy_install: + type: role + requirements_file: ansible_requirements.yml diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/ssh_key.j2 b/output_file_example/nginx_openstack_with_agents_new/monitoring/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..9d5f53affb626b336ef30061a91c3c2ee0bdb43e --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/ssh_key.j2 @@ -0,0 +1 @@ +{{ instance_server_public_key }} \ No newline at end of file diff --git a/output_file_example/nginx_openstack_with_agents_new/monitoring/vars/main.yaml b/output_file_example/nginx_openstack_with_agents_new/monitoring/vars/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..861faf3e8413d8a708702083d34c7ecd6f9a1fb1 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/monitoring/vars/main.yaml @@ -0,0 +1,27 @@ +pma_deployment_id: "123e4567-e89b-12d3-a456-426614174002" +pma_influxdb_bucket: "bucket" +pma_influxdb_token: "piacerePassword" +pma_influxdb_org: "piacere" +pma_influxdb_addr: "https://influxdb.pm.ci.piacere.digital.tecnalia.dev" + +telegraf_agent_package_state: latest + +telegraf_agent_output: + - type: influxdb_v2 + config: + - urls = ["{{ pma_influxdb_addr }}"] + - token = "{{ pma_influxdb_token }}" + - organization = "{{ pma_influxdb_org }}" + - bucket = "{{ pma_influxdb_bucket }}" + - insecure_skip_verify = true + +telegraf_global_tags: + - tag_name: deployment_id + tag_value: "{{ pma_deployment_id }}" + +telegraf_plugins_default: + - plugin: cpu + - plugin: mem + - plugin: processes + - plugin: disk + - plugin: net \ No newline at end of file diff --git a/output_file_example/nginx_openstack_with_agents_new/terraform/config.yaml b/output_file_example/nginx_openstack_with_agents_new/terraform/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3cadda98c5f9e98b9c0d4fb64d16c6402519755e --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/terraform/config.yaml @@ -0,0 +1,8 @@ +--- +engine: terraform +input: [] +output: + - instance_server_public_key + - instance_server_private_key + - instance_ip +... diff --git a/output_file_example/nginx_openstack_with_agents_new/terraform/main.tf b/output_file_example/nginx_openstack_with_agents_new/terraform/main.tf new file mode 100644 index 0000000000000000000000000000000000000000..75b5e2350079dfb376ad6d4bcb25e425ba03cd46 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/terraform/main.tf @@ -0,0 +1,116 @@ +terraform { +required_version = ">= 0.14.0" + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "~> 1.35.0" + } + } +} + +# Configure the OpenStack Provider +provider "openstack" { + insecure = true +} + +# Retrieve data +data "openstack_networking_network_v2" "external" { + name = "external" +} + +data "openstack_identity_project_v3" "test_tenant" { + name = "admin" +} + +data "openstack_networking_secgroup_v2" "default" { + name = "default" + tenant_id = data.openstack_identity_project_v3.test_tenant.id +} +# Create virtual machine +resource "openstack_compute_instance_v2" "nginx" { + name = "nginx-host" + image_name = "ubuntu-18.04" + flavor_name = "m1.tiny" + key_pair = openstack_compute_keypair_v2.user_key.name + network { + port = openstack_networking_port_v2.nginx.id + } +} + +# Create ssh keys +resource "openstack_compute_keypair_v2" "user_key" { + name = "user1" +} + +# Create floating ip +resource "openstack_networking_floatingip_v2" "nginx" { + pool = "external" + +} + +# Attach floating ip to instance +resource "openstack_compute_floatingip_associate_v2" "nginx" { + floating_ip = openstack_networking_floatingip_v2.nginx.address + instance_id = openstack_compute_instance_v2.nginx.id +} + +## Network + +# Create Network +resource "openstack_networking_network_v2" "generic" { + name = " " +} + +# Create Subnet +resource "openstack_networking_subnet_v2" "nginx" { + name = "subnet-nginx" + network_id = openstack_networking_network_v2.generic.id + cidr = "16.0.0.0/24" + dns_nameservers = ["8.8.8.8", "8.8.8.4"] +} + +# Attach networking port +resource "openstack_networking_port_v2" "nginx" { + name = "nginx" + network_id = openstack_networking_network_v2.generic.id + admin_state_up = true + security_group_ids = [ + data.openstack_networking_secgroup_v2.default.id #default flavour id + ] + fixed_ip { + subnet_id = openstack_networking_subnet_v2.nginx.id + } +} + +# Router creation. UUID external gateway +resource "openstack_networking_router_v2" "generic" { + name = "router-generic" + external_network_id = data.openstack_networking_network_v2.external.id #External network id +} +# Router interface configuration +resource "openstack_networking_router_interface_v2" "nginx" { + router_id = openstack_networking_router_v2.generic.id + subnet_id = openstack_networking_subnet_v2.nginx.id +} + +resource "openstack_compute_secgroup_v2" "http" { + name = "http" + description = "Open input http port" + rule { + from_port = 80 + to_port = 80 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } +} + +resource "openstack_compute_secgroup_v2" "ssh" { + name = "ssh" + description = "Open input ssh port" + rule { + from_port = 22 + to_port = 22 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } +} diff --git a/output_file_example/nginx_openstack_with_agents_new/terraform/output.tf b/output_file_example/nginx_openstack_with_agents_new/terraform/output.tf new file mode 100644 index 0000000000000000000000000000000000000000..c04554d815f6c58111b6ef18b6792920c37cba73 --- /dev/null +++ b/output_file_example/nginx_openstack_with_agents_new/terraform/output.tf @@ -0,0 +1,11 @@ +output "instance_server_public_key" { + value = openstack_compute_keypair_v2.user_key.public_key +} + +output "instance_server_private_key" { + value = openstack_compute_keypair_v2.user_key.private_key +} + +output "instance_ip" { + value = openstack_compute_floatingip_associate_v2.nginx.floating_ip +} \ No newline at end of file diff --git a/output_files_generated/nginx_openstack/config.yaml b/output_files_generated/nginx_openstack/config.yaml index 082e5e5f4463eaa91ce35a61957caf2dd029c03d..c1ab35fdabbb7734cb80de55c7450b9ec64fa5b1 100644 --- a/output_files_generated/nginx_openstack/config.yaml +++ b/output_files_generated/nginx_openstack/config.yaml @@ -1,6 +1,7 @@ --- iac: - terraform -- piacere_monitoring +- performance_monitoring +- security_monitoring - nginx ... \ No newline at end of file diff --git a/output_files_generated/nginx_openstack/nginx/config.yaml b/output_files_generated/nginx_openstack/nginx/config.yaml index 8b7284e426fba96d8fffd9d11e5d153b09edf120..5d4a47693a6bc109f56d939abf680347fd84a26e 100644 --- a/output_files_generated/nginx_openstack/nginx/config.yaml +++ b/output_files_generated/nginx_openstack/nginx/config.yaml @@ -1,8 +1,8 @@ --- input: - - instance_ip_vm1 - - instance_server_private_key_user1 + - instance_server_public_ip_nginx_vm + - instance_server_private_key_ubuntu_nginx_vm output: [] engine: ansible ... diff --git a/output_files_generated/nginx_openstack/nginx/inventory.j2 b/output_files_generated/nginx_openstack/nginx/inventory.j2 index c869825264308b4b47ca862b8b9e22d3bc733f11..6b3e90267dc92a870c3a86c851958dfc844a23c3 100644 --- a/output_files_generated/nginx_openstack/nginx/inventory.j2 +++ b/output_files_generated/nginx_openstack/nginx/inventory.j2 @@ -1,7 +1,7 @@ [servers_for_nginx] -{{ instance_ip_vm1 }} +{{ instance_server_public_ip_nginx_vm }} [servers_for_nginx:vars] ansible_connection=ssh diff --git a/output_files_generated/nginx_openstack/nginx/ssh_key.j2 b/output_files_generated/nginx_openstack/nginx/ssh_key.j2 index 1431f67c8cbc40dbb900c7a07be086c54ae196fe..b3880a67b52acf05764ae367c6ea501f441f8247 100644 --- a/output_files_generated/nginx_openstack/nginx/ssh_key.j2 +++ b/output_files_generated/nginx_openstack/nginx/ssh_key.j2 @@ -1 +1,2 @@ -{{ instance_server_private_key_user1 }} +{{ instance_server_private_key_ubuntu_nginx_vm}} + diff --git a/output_files_generated/nginx_openstack/piacere_monitoring/ssh_key.j2 b/output_files_generated/nginx_openstack/piacere_monitoring/ssh_key.j2 deleted file mode 100644 index 1431f67c8cbc40dbb900c7a07be086c54ae196fe..0000000000000000000000000000000000000000 --- a/output_files_generated/nginx_openstack/piacere_monitoring/ssh_key.j2 +++ /dev/null @@ -1 +0,0 @@ -{{ instance_server_private_key_user1 }} diff --git a/output_files_generated/nginx_openstack/terraform/config.yaml b/output_files_generated/nginx_openstack/terraform/config.yaml index 783f272d2a640a7e68f65c9d62c1bee0abb9430a..5baf71f58352df2dbc39bb0ae0b540a6c1ae2f39 100644 --- a/output_files_generated/nginx_openstack/terraform/config.yaml +++ b/output_files_generated/nginx_openstack/terraform/config.yaml @@ -9,8 +9,8 @@ input: - OS_PROJECT_NAME output: - - instance_server_public_key_user1 - - instance_server_private_key_user1 - - instance_ip_vm1 + - instance_server_public_key_ubuntu_nginx_vm + - instance_server_private_key_ubuntu_nginx_vm + - instance_server_public_ip_nginx_vm ... diff --git a/output_files_generated/nginx_openstack/terraform/main.tf b/output_files_generated/nginx_openstack/terraform/main.tf index 40789ea5996a43bd74a5bebf3f2d478b20d6605c..7517686a3c05a8295cafb942fff8ddc6b107f3bb 100644 --- a/output_files_generated/nginx_openstack/terraform/main.tf +++ b/output_files_generated/nginx_openstack/terraform/main.tf @@ -21,128 +21,112 @@ data "openstack_networking_network_v2" "external" { } + # Create virtual machine -resource "openstack_compute_instance_v2" "vm1" { - name = "nginx-host" +resource "openstack_compute_instance_v2" "nginx_vm" { + name = "nginx_host" image_name = "Ubuntu-Focal-20.04-Daily-2022-04-19" - flavor_name = "small" - key_pair = openstack_compute_keypair_v2.user1.name - network { - port = openstack_networking_port_v2.net1.id + flavor_name = "small-centos" + key_pair = openstack_compute_keypair_v2.ubuntu.name + network { + port = openstack_networking_port_v2.i1_networking_port.id + } } # Create floating ip -resource "openstack_networking_floatingip_v2" "vm1_floating_ip" { +resource "openstack_networking_floatingip_v2" "nginx_vm_floating_ip" { pool = "external" # fixed_ip = "" } # Attach floating ip to instance -resource "openstack_compute_floatingip_associate_v2" "vm1_floating_ip_association" { - floating_ip = openstack_networking_floatingip_v2.vm1_floating_ip.address - instance_id = openstack_compute_instance_v2.vm1.id +resource "openstack_compute_floatingip_associate_v2" "nginx_vm_floating_ip_association" { + floating_ip = openstack_networking_floatingip_v2.nginx_vm_floating_ip.address + instance_id = openstack_compute_instance_v2.nginx_vm.id } +# Router interface configuration + +resource "openstack_networking_router_interface_v2" "subnet1_router_interface" { + router_id = openstack_networking_router_v2.router.id + subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id +} + + +# Attach networking port +resource "openstack_networking_port_v2" "i1_networking_port" { + name = "i1" + network_id = openstack_networking_network_v2.net1.id + admin_state_up = true + security_group_ids = [ openstack_compute_secgroup_v2.sg.id ] + fixed_ip { + subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id + } +} + + ## Network # Create Network resource "openstack_networking_network_v2" "net1" { - name = "concrete_net" + name = "nginx_net" } -# Create Subnet -resource "openstack_networking_subnet_v2" "net1_subnet" { - name = "concrete_net_subnet" +# Subnet +resource "openstack_networking_subnet_v2" "subnet1_subnet" { + name = "subnet1_subnet" network_id = openstack_networking_network_v2.net1.id - cidr = "16.0.0.0/24" + cidr = "16.0.0.1/24" dns_nameservers = ["8.8.8.8", "8.8.8.4"] } -# Attach networking port -resource "openstack_networking_port_v2" "net1" { - name = "concrete_net" - network_id = openstack_networking_network_v2.net1.id - admin_state_up = true - security_group_ids = [ - openstack_compute_secgroup_v2.icmp.id, - openstack_compute_secgroup_v2.http.id, - openstack_compute_secgroup_v2.https.id, - openstack_compute_secgroup_v2.ssh.id, - - ] - fixed_ip { - subnet_id = openstack_networking_subnet_v2.net1_subnet.id - } -} - # Create router -resource "openstack_networking_router_v2" "net1_router" { - name = "net1_router" +resource "openstack_networking_router_v2" "router" { ## 1router, not parametric + name = "router" external_network_id = data.openstack_networking_network_v2.external.id #External network id } -# Router interface configuration -resource "openstack_networking_router_interface_v2" "net1_router_interface" { - router_id = openstack_networking_router_v2.net1_router.id - subnet_id = openstack_networking_subnet_v2.net1_subnet.id -} -# CREATING SECURITY_GROUP - -resource "openstack_compute_secgroup_v2" "icmp" { - name = "icmp" - description = "Security group rule for port -1" - rule { - from_port = -1 - to_port = -1 - ip_protocol = "icmp" - cidr = "0.0.0.0/0" - } -} - -resource "openstack_compute_secgroup_v2" "http" { - name = "http" - description = "Security group rule for port 80" - rule { - from_port = 80 - to_port = 80 - ip_protocol = "tcp" - cidr = "0.0.0.0/0" - } -} - -resource "openstack_compute_secgroup_v2" "https" { - name = "https" - description = "Security group rule for port 443" - rule { - from_port = 443 - to_port = 443 - ip_protocol = "tcp" - cidr = "0.0.0.0/0" - } -} - -resource "openstack_compute_secgroup_v2" "ssh" { - name = "ssh" - description = "Security group rule for port 22" - rule { - from_port = 22 - to_port = 22 - ip_protocol = "tcp" - cidr = "0.0.0.0/0" - } +# Create ssh keys +resource "openstack_compute_keypair_v2" "ubuntu" { + name = "ubuntu" + # public_key = "" } - -# Create ssh keys -resource "openstack_compute_keypair_v2" "user1" { - name = "user1" - # public_key = "user1" +# CREATING SECURITY_GROUP +resource "openstack_compute_secgroup_v2" "sg" { + name = "infra_element_name" + description = "PIACERE security group created - sg" + rule { + from_port = -1 + to_port = -1 + ip_protocol = "icmp" + cidr = "0.0.0.0/0" + } + rule { + from_port = 80 + to_port = 80 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + rule { + from_port = 443 + to_port = 443 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + rule { + from_port = 22 + to_port = 22 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } } + diff --git a/output_files_generated/nginx_openstack/terraform/output.tf b/output_files_generated/nginx_openstack/terraform/output.tf index f0cc70b7b297f4e5e45369d934c2537507d9fff7..d94c1df7a81d225571270e9f6b1745dc98dad2a6 100644 --- a/output_files_generated/nginx_openstack/terraform/output.tf +++ b/output_files_generated/nginx_openstack/terraform/output.tf @@ -1,14 +1,14 @@ -output "instance_server_public_key_user1" { - value = openstack_compute_keypair_v2.user1.public_key +output "instance_server_public_key_ubuntu_nginx_vm" { + value = openstack_compute_keypair_v2.ubuntu.public_key } -output "instance_server_private_key_user1" { - value = openstack_compute_keypair_v2.user1.private_key +output "instance_server_private_key_ubuntu_nginx_vm" { + value = openstack_compute_keypair_v2.ubuntu.private_key } -output "instance_ip_vm1" { - value = openstack_compute_floatingip_associate_v2.vm1_floating_ip_association.floating_ip +output "instance_server_public_ip_nginx_vm" { + value = openstack_compute_floatingip_associate_v2.nginx_vm_floating_ip_association.floating_ip } diff --git a/output_files_generated/posidonia/terraform/config.yaml b/output_files_generated/posidonia/terraform/config.yaml deleted file mode 100644 index cefdad132213cf5bec7be8d7048a4fcb1eeab364..0000000000000000000000000000000000000000 --- a/output_files_generated/posidonia/terraform/config.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -engine: terraform -input: [] -output: [] -... \ No newline at end of file diff --git a/output_files_generated/wordpress_azure/terraform/main.tf b/output_files_generated/wordpress_azure/terraform/main.tf deleted file mode 100644 index 851c1443bb1657d2954fc9639196530e521ed359..0000000000000000000000000000000000000000 --- a/output_files_generated/wordpress_azure/terraform/main.tf +++ /dev/null @@ -1,47 +0,0 @@ -terraform { - required_providers { - azurerm = { - source = "hashicorp/azurerm" - version = "~> 2.65" - } - } - - required_version = ">= 0.14.9" -} - -provider "azurerm" { - features {} -} - -## VIRTUAL NETWORK -resource "azurerm_virtual_network" "wordpress_net_vnetwork" { - name = "wordpress_net" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.wordpress-example.location - resource_group_name = azurerm_resource_group.wordpress-example.name -} - -## SUBNET -resource "azurerm_subnet" "wordpress_net_subnet" { - name = "internal" - resource_group_name = azurerm_resource_group.wordpress-example.name - virtual_network_name = azurerm_virtual_network.wordpress_net_vnetwork.name - address_prefixes = ["10.0.2.0/24"] -} - -## VIRTUAL NETWORK -resource "azurerm_virtual_network" "mysql_net_vnetwork" { - name = "mysql_net" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.mysql-example.location - resource_group_name = azurerm_resource_group.mysql-example.name -} - -## SUBNET -resource "azurerm_subnet" "mysql_net_subnet" { - name = "internal" - resource_group_name = azurerm_resource_group.mysql-example.name - virtual_network_name = azurerm_virtual_network.mysql_net_vnetwork.name - address_prefixes = ["10.0.2.0/24"] -} - diff --git a/plugin/AnsiblePlugin.py b/plugin/AnsiblePlugin.py index c4d0146db2b461bb1681dbd69836e33fdc37df01..705e290ee426dd9223fdebf3477b46f0967e35f6 100644 --- a/plugin/AnsiblePlugin.py +++ b/plugin/AnsiblePlugin.py @@ -15,7 +15,7 @@ import logging -from icgparser.IntermediateRepresentationUtility import IntermediateRepresentationResources +from icgparser.ModelResourcesUtilities import get_ir_key_name, ModelResources from plugin import TemplateUtils from plugin.PluginException import PluginResourceNotFoundError @@ -25,13 +25,18 @@ def clean_operating_system_name(operating_system): logging.info(f"AnsiblePlugin: extracting operating system from {operating_system}") if "ubuntu" in operating_system_lower_case: return "ubuntu" + if "centos" in operating_system_lower_case: + return "centos" + ## TODO to be update with more explicit parameter + if "ami" in operating_system_lower_case: + return "ubuntu" else: raise PluginResourceNotFoundError(plugin_name="AnsiblePlugin", resource_name="operating system") def find_operating_system(parameters): try: - operating_system = parameters.get("node").get("os") + operating_system = parameters.get("nodes")[0].get("os") operating_system_name = clean_operating_system_name(operating_system) return operating_system_name except Exception: @@ -46,8 +51,8 @@ def create_template_file(parameters, language, operating_system, template_name): def create_files(step, output_path): - language = step[IntermediateRepresentationResources.LANGUAGE.value] - step_name = step[IntermediateRepresentationResources.STEP_NAME.value] + language = step[get_ir_key_name(ModelResources.LANGUAGE)] + step_name = step[get_ir_key_name(ModelResources.STEP_NAME)] parameters = step["data"] for resource_name, resource in parameters.items(): logging.info("Creating template for resource '%s'", resource_name) @@ -62,7 +67,21 @@ def create_files(step, output_path): config_output_file_path = output_path + "/".join([step_name, "config"]) + ".yaml" ssh_key_output_file_path = output_path + "/".join([step_name, "ssh_key.j2"]) - template = TemplateUtils.read_template(ansible_template_path) + ### TODO Refactoring + if "," in ansible_template_path: + ansible_template_path = ansible_template_path.split(",") + template = TemplateUtils.read_template(ansible_template_path[0]) + for i in range(1, len(ansible_template_path)): + output_other_ansible_name_split = ansible_template_path[i].split('/') + output_other_ansible_name = output_other_ansible_name_split[-1].split('.') + other_ansible_output_file_path = output_path + "/".join([step_name, output_other_ansible_name[0]]) + ".yml" + + other_template = TemplateUtils.read_template(ansible_template_path[i]) + other_template_filled = TemplateUtils.edit_template(other_template, resource_params) + TemplateUtils.write_template(other_template_filled, other_ansible_output_file_path) + else: + template = TemplateUtils.read_template(ansible_template_path) + template_filled = TemplateUtils.edit_template(template, resource_params) inventory_template_filled = create_template_file(resource_params, language, operating_system, "inventory") diff --git a/plugin/DockerComposePlugin.py b/plugin/DockerComposePlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..75b093c5fe04a32757acee8b164cb473730672a5 --- /dev/null +++ b/plugin/DockerComposePlugin.py @@ -0,0 +1,60 @@ +import logging + +from icgparser.ModelResourcesUtilities import get_ir_key_name, ModelResources +from plugin import TemplateUtils + + +def search_containers_to_be_created(container_image_resource): + logging.info("Searching for containers") + containers = [] + if container_image_resource["generatedContainers"]: + containers = list(container_image_resource["generatedContainers"]) + logging.info(f"Found containers {containers}") + return containers + +def create_template_file(resource_name, parameters, extra_parameters, language): + inventory_template_path = TemplateUtils.find_template_path(iac_language=False, key=language, + resource_name=resource_name) + template = TemplateUtils.read_template(inventory_template_path) + template_filled = TemplateUtils.edit_template(template, parameters) + return template_filled + +def create_metadata_files(resource_params, output_path, language): + inventory_template_stored_path = output_path + "inventory.j2" + ssh_template_stored_path = output_path + "ssh_key.j2" + ansible_template_file_path = output_path + "main.yml" + config_template_file_path = output_path + "config.yaml" + + inventory_template_filled = create_template_file("inventory", resource_params, None, language) + config_template_filled = create_template_file("config", resource_params, None, language) + ssh_key_template_filled = create_template_file("ssh_key", resource_params, None, language) + ansible_template_filled = create_template_file("main", resource_params, None, language) + + TemplateUtils.write_template(inventory_template_filled, inventory_template_stored_path) + TemplateUtils.write_template(ansible_template_filled, ansible_template_file_path) + TemplateUtils.write_template(config_template_filled, config_template_file_path) + TemplateUtils.write_template(ssh_key_template_filled, ssh_template_stored_path) + + +def create_files(step_data, output_path): + logging.info(f"Using Docker Compose Plugin for step {step_data}") + language = step_data[get_ir_key_name(ModelResources.LANGUAGE)] + parameters = step_data["data"] + for resource_name, resources in parameters.items(): + logging.info(f"Found resource type {resource_name}") + for resource_params in resources: + containers = search_containers_to_be_created(resource_params) + for container in containers: + logging.info(f"Creating templates for resource {resource_params}") + container_name = container["name"] + output_base_folder_path = output_path + f"{container_name}/" + template_stored_path = output_base_folder_path + "docker-compose.yml" + template_path = TemplateUtils.find_template_path(iac_language=False, key=language, + resource_name=resource_name) + template = TemplateUtils.read_template(template_path) + template_filled = TemplateUtils.edit_template(template, container, resource_params) + TemplateUtils.write_template(template_filled, template_stored_path) + + create_metadata_files(container, output_base_folder_path, language) + logging.info(f"Docker compose files created for {container_name}") + logging.info(f"Docker compose files created") diff --git a/plugin/PluginUtility.py b/plugin/PluginUtility.py index ece9bbb1dfaa13800f4eba05096cbd26e1e3ebfa..1870f176a32f65f1c8a04171a715dfc73dd862d2 100644 --- a/plugin/PluginUtility.py +++ b/plugin/PluginUtility.py @@ -11,13 +11,34 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- +import logging from plugin import TemplateUtils +from utility import PropertiesReaderUtility +plugin_properties_file_name = "external-plugins.properties" +plugin_properties_main_section = "plugins" -def createExecutionFileInstructions(iac_language, key, data): - template_for_config_path = TemplateUtils.find_template_path(iac_language, key, "config") - template_for_config = TemplateUtils.read_template(template_for_config_path) - template_for_config_path_edited = TemplateUtils.edit_template(template_for_config, data) - return template_for_config_path_edited + +def createExecutionFileInstructions(iac_language, key, data, file_key_name): + template_path = TemplateUtils.find_template_path(iac_language, key, file_key_name) + template = TemplateUtils.read_template(template_path) + template_path_edited = TemplateUtils.edit_template(template, data) + return template_path_edited + + +def find_resources_names_for_plugin(plugin_name): + logging.info(f"Searching for resources name for plugin {plugin_name}") + resources = PropertiesReaderUtility.get_items_from_key(plugin_properties_file_name, + plugin_properties_main_section, plugin_name) + logging.info(f"Founded resources: {resources}") + return resources + + +def find_external_plugins_name(): + logging.info("Searching for external plugins") + plugins_name = PropertiesReaderUtility.get_key_from_properties(plugin_properties_file_name, + plugin_properties_main_section) + logging.info(f"Founded plugins: {plugins_name}") + return plugins_name diff --git a/plugin/TemplateUtils.py b/plugin/TemplateUtils.py index 6f5a1405e5987a2b3ca74b94e71dc162a1d7d467..31b0c7214487fd1946d51d9f374158f60b8fa839 100644 --- a/plugin/TemplateUtils.py +++ b/plugin/TemplateUtils.py @@ -16,6 +16,7 @@ import configparser import logging import os +from collections import OrderedDict import jinja2 from jinja2 import Template @@ -25,12 +26,14 @@ from jinja2 import Template def get_context(c): return c - def find_template_path(iac_language, key, resource_name): try: properties_reader = configparser.ConfigParser() properties_reader.read("template-location.properties") - template_path = properties_reader.get(iac_language + "." + key, resource_name) + if not iac_language: + template_path = properties_reader.get(key, resource_name) + else: + template_path = properties_reader.get(iac_language + "." + key, resource_name) logging.info("Chosen template at: '%s'", template_path) return template_path except configparser.NoOptionError as error: @@ -38,10 +41,11 @@ def find_template_path(iac_language, key, resource_name): pass -def edit_template(template, parameters: dict): +def edit_template(template, parameters: dict, extra_parameters=None): logging.info(f"Starting editing template '{template}'") template.globals['context'] = get_context template.globals['callable'] = callable + template.globals['extra_parameters'] = extra_parameters render = template.render(parameters) template_with_custom_params = "" + render + "\n" return template_with_custom_params diff --git a/plugin/TerraformPlugin.py b/plugin/TerraformPlugin.py index 01fa43bddafa661598fd8dc65a4777dcca7f035f..1aab4f564f860e2885f72e8067a3f30236a463ea 100644 --- a/plugin/TerraformPlugin.py +++ b/plugin/TerraformPlugin.py @@ -21,31 +21,31 @@ from plugin import TemplateUtils, PluginUtility def create_files(parameters, output_path): language = "terraform" - provider = parameters["provider"] + provider_name = parameters["provider_info"][0]["provider_name"] - config_file = PluginUtility.createExecutionFileInstructions(language, provider, parameters) + config_file = PluginUtility.createExecutionFileInstructions(language, provider_name, parameters, "config") resources = parameters.keys() - terraform_main_file = create_init_file(language, provider) + terraform_main_file = "" terraform_out_file = "" for resource_name in resources: logging.info("Creating output and main terraform template for resource '%s'", resource_name) - template_for_main_path = TemplateUtils.find_template_path(language, provider, resource_name) - template_for_output_path = TemplateUtils.find_template_path(language, provider, + template_for_main_path = TemplateUtils.find_template_path(language, provider_name, resource_name) + template_for_output_path = TemplateUtils.find_template_path(language, provider_name, get_resource_out_path(resource_name)) if template_for_main_path: for resource_params in parameters[resource_name]: template = TemplateUtils.read_template(template_for_main_path) # resource = parameters[resource_name] - template_filled = TemplateUtils.edit_template(template, resource_params) + template_filled = TemplateUtils.edit_template(template, resource_params, parameters) terraform_main_file = terraform_main_file + template_filled + "\n" if template_for_output_path: for resource_params in parameters[resource_name]: template_out = TemplateUtils.read_template(template_for_output_path) # resource = parameters[resource_name] - template_out_filled = TemplateUtils.edit_template(template_out, resource_params) + template_out_filled = TemplateUtils.edit_template(template_out, resource_params, None) terraform_out_file = terraform_out_file + template_out_filled + "\n" main_file_stored_path = output_path + "/main.tf" TemplateUtils.write_template(terraform_main_file, main_file_stored_path) @@ -56,13 +56,6 @@ def create_files(parameters, output_path): logging.info("Terraform main file available at: {}".format(main_file_stored_path)) logging.info(f"Terraform output file available at {output_file_stored_path}") - -def create_init_file(language, provider): - logging.info("Creating init %s file for provider %s", language, provider) - template_path = TemplateUtils.find_template_path(language, provider, "init") - template = TemplateUtils.read_template(template_path) - return template.render() + "\n" - ## TODO spostare i template di out in una cartella?? es. cartella vms&vms_out? altrimenti come prendo nome di out? ## non è nel doml def get_resource_out_path(resource_name): diff --git a/requirements.txt b/requirements.txt index 7637f4da3d9d38407d09d63a444f006b4d12babc..a970358c129de9bf4f62160496a58ebe0d1b7dae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,6 @@ Jinja2==3.0.3 PyYAML==6.0 fastapi~=0.74.1 uvicorn==0.17.5 -pyecore~=0.12.2 \ No newline at end of file +pyecore~=0.12.2 +aiofiles~=23.1.0 +python-multipart~=0.0.6 \ No newline at end of file diff --git a/service.yml b/service.yml deleted file mode 100644 index 0ba8b8a694b3cc142738887142d485e521c14ac5..0000000000000000000000000000000000000000 --- a/service.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- deployment: - - name: vm - language: terraform - code: - - outputNetwork.tf - outputdb.tf - outputvm.tf - -- orchestration: - - name: postgres - language: ansible - code: postgres-play.yml - - name: wordpress - language: ansible - code: wordpress-play.yml \ No newline at end of file diff --git a/template-location.properties b/template-location.properties index 3dcafba416a7a2e0431c5f55ec90deb1939f94fb..183dff1a9c52453832dc44d00395a16a3c5ac820 100644 --- a/template-location.properties +++ b/template-location.properties @@ -14,25 +14,50 @@ #------------------------------------------------------------------------- [terraform.openstack] -init = templates/terraform/open_stack/init.tpl +provider_info = templates/terraform/open_stack/init.tpl config = templates/terraform/open_stack/config.tpl vms = templates/terraform/open_stack/virtual_machine.tpl vms_out = templates/terraform/open_stack/virtual_machine_out.tpl networks = templates/terraform/open_stack/network.tpl computingGroup = templates/terraform/open_stack/port_rule.tpl +securityGroup = templates/terraform/open_stack/port_rule.tpl credentials = templates/terraform/open_stack/ssh_key.tpl [terraform.azure] -init = templates/terraform/azure/init.tpl +provider_info = templates/terraform/azure/init.tpl vm = templates/terraform/azure/virtual_machine.tpl net = templates/terraform/azure/network.tpl rg = templates/terraform/azure/resource_group.tpl +securityGroup = templates/terraform/azure/port_rule.tpl [terraform.aws] -init = templates/terraform/aws/init.tpl +provider_info = templates/terraform/aws/init.tpl +config = templates/terraform/aws/config.tpl vms = templates/terraform/aws/virtual_machine.tpl +vms_out = templates/terraform/aws/virtual_machine_out.tpl networks = templates/terraform/aws/network.tpl computingGroup = templates/terraform/aws/port_rule.tpl +securityGroup = templates/terraform/aws/port_rule.tpl +credentials = templates/terraform/aws/ssh_key.tpl +group = templates/terraform/aws/autoscaling_group.tpl + +[terraform.vsphere] +provider_info = templates/terraform/vsphere/init.tpl +config = templates/terraform/vsphere/config.tpl +networks = templates/terraform/vsphere/network.tpl +vms = templates/terraform/vsphere/virtual_machine.tpl +credentials = templates/terraform/vsphere/ssh_key.tpl +resources = templates/terraform/vsphere/data_resources.tpl +storages = templates/terraform/vsphere/datastore.tpl +vms_out = templates/terraform/vsphere/virtual_machine_out.tpl + +[terraform.ionoscloud] +provider_info = templates/terraform/ionos/init.tpl +config = templates/terraform/ionos/config.tpl +vms = templates/terraform/ionos/virtual_machine.tpl +vms_out = templates/terraform/ionos/virtual_machine_out.tpl +networks = templates/terraform/ionos/network.tpl +resources = templates/terraform/ionos/datacenter.tpl [ansible.ubuntu] inventory = templates/ansible/ubuntu/inventory.tpl @@ -41,10 +66,28 @@ config = templates/ansible/ubuntu/config.tpl nginx = templates/ansible/ubuntu/nginx.tpl mysql = templates/ansible/ubuntu/mysql.tpl wordpress = templates/ansible/ubuntu/wordpress.tpl +elasticsearch = templates/ansible/ubuntu/elasticsearch_main.tpl,templates/ansible/ubuntu/elasticsearch.tpl postgres = templates/ansible/ubuntu/postgres.tpl -piacere_monitoring = templates/ansible/ubuntu/piacere_main.tpl +performance_monitoring = templates/ansible/ubuntu/performance_monitoring_main.tpl +security_monitoring = templates/ansible/ubuntu/security_monitoring_main.tpl [ansible.centos] mysql = templates/ansible/centos/mysql.tpl postgres = templates/ansible/centos/postgres.tpl -wordpress = templates/ansible/centos/wordpress.tpl \ No newline at end of file +wordpress = templates/ansible/centos/wordpress.tpl +elasticsearch = templates/ansible/centos/elasticsearch_main.tpl,templates/ansible/centos/elasticsearch.tpl +performance_monitoring = templates/ansible/centos/performance_monitoring_main.tpl +security_monitoring = templates/ansible/centos/security_monitoring_main.tpl +inventory = templates/ansible/centos/inventory.tpl +config = templates/ansible/centos/config.tpl +ssh_key = templates/ansible/centos/ssh_key.tpl + +[common] +gaiax_self_description = templates/common/gaiax_self_description.yaml.tpl + +[docker-compose] +config = templates/docker_compose/config.tpl +inventory = templates/docker_compose/inventory.tpl +ssh_key = templates/docker_compose/ssh_key.tpl +main = templates/docker_compose/main.tpl +containerimages = templates/docker_compose/docker_compose.tpl \ No newline at end of file diff --git a/templates/ansible/centos/config.tpl b/templates/ansible/centos/config.tpl new file mode 100644 index 0000000000000000000000000000000000000000..507247fced2542c0e3a2b35cd8506c40adcf8cd1 --- /dev/null +++ b/templates/ansible/centos/config.tpl @@ -0,0 +1,35 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} +--- +input: + {%- if name == "performance_monitoring" %} + - INFLUXDB_BUCKET + - INFLUXDB_TOKEN + - INFLUXDB_ORG + - INFLUXDB_ADDR + - DEPLOYMENT_ID + {%- endif %} + {%- if name == "security_monitoring" %} + - DEPLOYMENT_ID + - WAZUH_MANAGER_HOST + - WAZUH_MANAGER_PORT{%- endif %} + {%- for node in nodes %} + - instance_server_public_ip_{{ node.infra_element_name }} + - instance_server_private_key_{{ node.credentials }}_{{ node.infra_element_name }} + {%- endfor %} +output: [] +engine: ansible +... diff --git a/templates/ansible/centos/elasticsearch.tpl b/templates/ansible/centos/elasticsearch.tpl new file mode 100644 index 0000000000000000000000000000000000000000..05d04329cb93c3f21e52fcb1f4d90ab77f222da5 --- /dev/null +++ b/templates/ansible/centos/elasticsearch.tpl @@ -0,0 +1,21 @@ +--- + +- name: Elasticsearch with custom configuration + hosts: servers_for_elasticsearch + roles: + - role: elastic.elasticsearch + vars: + es_data_dirs: + - "/opt/elasticsearch/data" + es_log_dir: "/opt/elasticsearch/logs" + es_config: + node.name: "node1" + cluster.name: "custom-cluster" + discovery.seed_hosts: "localhost:9301" + http.port: 9201 + transport.port: 9301 + node.data: false + node.master: true + bootstrap.memory_lock: true + es_heap_size: 1g + es_api_port: 9201 \ No newline at end of file diff --git a/templates/ansible/centos/elasticsearch_main.tpl b/templates/ansible/centos/elasticsearch_main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..5a0e4fd404051db71599ec211eb0d71892edf40c --- /dev/null +++ b/templates/ansible/centos/elasticsearch_main.tpl @@ -0,0 +1,12 @@ +--- + +- hosts: localhost + + pre_tasks: + - file: + path: roles + state: absent + + - command: ansible-galaxy install elastic.elasticsearch,v7.17.0 + tasks: + - command: ansible-playbook -i inventory elasticsearch.yml \ No newline at end of file diff --git a/templates/ansible/centos/inventory.tpl b/templates/ansible/centos/inventory.tpl new file mode 100644 index 0000000000000000000000000000000000000000..8db3ec0e608ed7d280517c348158112874adfda1 --- /dev/null +++ b/templates/ansible/centos/inventory.tpl @@ -0,0 +1,25 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +[{{ "servers_for_" ~ name }}] +{%- for node in nodes %} +{% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{%- endfor %} + +[{{ "servers_for_" ~ name }}:vars] +ansible_connection=ssh +ansible_user=centos +ansible_ssh_private_key_file=ssh_key diff --git a/templates/ansible/centos/performance_monitoring_main.tpl b/templates/ansible/centos/performance_monitoring_main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..8b32d6384d9ec8979ab6561920b6e5165386cad3 --- /dev/null +++ b/templates/ansible/centos/performance_monitoring_main.tpl @@ -0,0 +1,42 @@ +--- +- hosts: localhost + tasks: + - name: print disclamer + debug: + msg: this can also be done with "ansible-galaxy install -r requirements" + - name: install telegraf from galaxy + community.general.ansible_galaxy_install: + type: role + requirements_file: ansible_requirements.yml + +- hosts: servers_for_performance_monitoring + pre_tasks: + - name: Check parameters + fail: + msg: 'variable {{item}} not defined' + when: item is not defined + with_items: + - pma_deployment_id + - pma_influxdb_bucket + - pma_influxdb_token + - pma_influxdb_org + - pma_influxdb_addr + - name: Print parameters + debug: + msg: + - "pma_deployment_id: {{ pma_deployment_id }}" + - "pma_influxdb_bucket: {{ pma_influxdb_bucket }}" + - "pma_influxdb_token: {{ pma_influxdb_token }}" + - "pma_influxdb_org: {{ pma_influxdb_org }}" + - "pma_influxdb_addr: {{ pma_influxdb_addr }}" + - name: Ensure gnupg package + package: + name: gnupg + state: present + become: true + vars_files: + - vars/main.yaml + tasks: + - name: Install telegraf + ansible.builtin.include_role: + name: dj-wasabi.telegraf diff --git a/templates/ansible/centos/security_monitoring_main.tpl b/templates/ansible/centos/security_monitoring_main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..43a939ec202fef1188ddcac4156a8036d44334de --- /dev/null +++ b/templates/ansible/centos/security_monitoring_main.tpl @@ -0,0 +1,2 @@ +--- +- import_playbook: deploy-wazuh-agent.yml \ No newline at end of file diff --git a/templates/ansible/centos/ssh_key.tpl b/templates/ansible/centos/ssh_key.tpl new file mode 100644 index 0000000000000000000000000000000000000000..d7a25b0b80bab4646cc35634b7c94002eb688776 --- /dev/null +++ b/templates/ansible/centos/ssh_key.tpl @@ -0,0 +1,4 @@ +{%- for node in nodes %} +{%- raw %}{{ instance_server_private_key_{% endraw %}{{ node.credentials }}{% raw %}_{%- endraw %}{{node.infra_element_name}}{% raw %}}} +{% endraw %} +{%- endfor %} \ No newline at end of file diff --git a/templates/ansible/cross-platform/performance_monitoring/.gitignore b/templates/ansible/cross-platform/performance_monitoring/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2eea525d885d5148108f6f3a9a8613863f783d36 --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/templates/ansible/cross-platform/performance_monitoring/LICENSE b/templates/ansible/cross-platform/performance_monitoring/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d4f1283cebb9debd5ad8e4aeed29f7edcb96f455 --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 PIACERE / public / agents + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/templates/ansible/cross-platform/performance_monitoring/README.md b/templates/ansible/cross-platform/performance_monitoring/README.md new file mode 100644 index 0000000000000000000000000000000000000000..96f678bfc42841685480c62cc916e869903d1880 --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/README.md @@ -0,0 +1,31 @@ +# pma playbook + +This is an ansible playbook that install telegraf and cofigure to the needs of the performance monitoring component of piacere + +## How to use + +This playbook is automatically embeeded as iac by yhe ICG, the iac is then run by the IEM + + +## How to test +There are may ways to test a playbook here we document the procedure followed in our case. +* Obtain a ssh docker image of some platform +* instantiate the ssh docker +* install the playbook requirements +* launch the playbook against it + +i.e. Providing we have already an ssh docker image ... i.e. ubuntu-ssh https://git.code.tecnalia.com/smartdatalab/libraries/docker/ubuntu-ssh.git + +``` +docker rm -f ubuntu-ssh +docker network rm -f ubuntu-ssh +docker network create --driver=bridge --subnet=10.0.55.0/24 --driver=bridge ubuntu-ssh +docker run -d --name ubuntu-ssh --network ubuntu-ssh --ip 10.0.55.5 --env PUB_SSH_CERT_0="$(cat ~/.ssh/id_rsa.pub)" ubuntu-ssh +./ansible/playbooks/pma/install_playbook_requirements.sh +./ansible/playbooks/pma/run-playbook.sh '{"pma_deployment_id": "123e4567-e89b-12d3-a456-426614174001", "pma_influxdb_bucket": "bucket", "pma_influxdb_token": "piacerePassword", "pma_influxdb_org": "piacere", "pma_influxdb_addr": "https://influxdb.pm.ci.piacere.digital.tecnalia.dev" }' +ssh -o StrictHostKeyChecking=no root@10.0.55.5 service telegraf status +``` + +the output shoud be that the "telegraf Process is running `[[ OK ]]" + +## Notes diff --git a/templates/ansible/ubuntu/monitoring/ansible_requirements.yml b/templates/ansible/cross-platform/performance_monitoring/ansible_requirements.yml similarity index 90% rename from templates/ansible/ubuntu/monitoring/ansible_requirements.yml rename to templates/ansible/cross-platform/performance_monitoring/ansible_requirements.yml index 58c0cb368b76e9a0313aee87b2296e727877b2d9..77b0ab36c2240f53891c55b76d40417ed5ab6d26 100644 --- a/templates/ansible/ubuntu/monitoring/ansible_requirements.yml +++ b/templates/ansible/cross-platform/performance_monitoring/ansible_requirements.yml @@ -5,4 +5,4 @@ roles: - name: dj-wasabi.telegraf src: https://github.com/dj-wasabi/ansible-telegraf.git scm: git - version: 0.13.2 + version: 0.14.0 diff --git a/templates/ansible/cross-platform/performance_monitoring/config.yaml b/templates/ansible/cross-platform/performance_monitoring/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8720808617a2462e0910cb9919ae92c4095cd30d --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/config.yaml @@ -0,0 +1,12 @@ +--- +input: + - INFLUXDB_BUCKET + - INFLUXDB_TOKEN + - INFLUXDB_ORG + - INFLUXDB_ADDR + - DEPLOYMENT_ID + # - instance_ip_vm1 + # - instance_server_private_key_user1 +output: [] +engine: ansible +... \ No newline at end of file diff --git a/templates/ansible/cross-platform/performance_monitoring/inventory.j2 b/templates/ansible/cross-platform/performance_monitoring/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..489cb890d0ff655f6834499ee7a5926c1053b65b --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/inventory.j2 @@ -0,0 +1,9 @@ + + +[servers_for_performance_monitoring] +demo-server-for-agents + +[servers_for_performance_monitoring:vars] +ansible_connection=ssh +ansible_user=ubuntu +ansible_ssh_private_key_file=ssh_key diff --git a/templates/ansible/cross-platform/performance_monitoring/inventory.txt b/templates/ansible/cross-platform/performance_monitoring/inventory.txt new file mode 100644 index 0000000000000000000000000000000000000000..4c1b112e08c95d840d4ba11a285f7a94f0bcd0ab --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/inventory.txt @@ -0,0 +1,2 @@ +[docker] +localhost \ No newline at end of file diff --git a/templates/ansible/cross-platform/performance_monitoring/main.yml b/templates/ansible/cross-platform/performance_monitoring/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..8b32d6384d9ec8979ab6561920b6e5165386cad3 --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/main.yml @@ -0,0 +1,42 @@ +--- +- hosts: localhost + tasks: + - name: print disclamer + debug: + msg: this can also be done with "ansible-galaxy install -r requirements" + - name: install telegraf from galaxy + community.general.ansible_galaxy_install: + type: role + requirements_file: ansible_requirements.yml + +- hosts: servers_for_performance_monitoring + pre_tasks: + - name: Check parameters + fail: + msg: 'variable {{item}} not defined' + when: item is not defined + with_items: + - pma_deployment_id + - pma_influxdb_bucket + - pma_influxdb_token + - pma_influxdb_org + - pma_influxdb_addr + - name: Print parameters + debug: + msg: + - "pma_deployment_id: {{ pma_deployment_id }}" + - "pma_influxdb_bucket: {{ pma_influxdb_bucket }}" + - "pma_influxdb_token: {{ pma_influxdb_token }}" + - "pma_influxdb_org: {{ pma_influxdb_org }}" + - "pma_influxdb_addr: {{ pma_influxdb_addr }}" + - name: Ensure gnupg package + package: + name: gnupg + state: present + become: true + vars_files: + - vars/main.yaml + tasks: + - name: Install telegraf + ansible.builtin.include_role: + name: dj-wasabi.telegraf diff --git a/templates/ansible/cross-platform/performance_monitoring/ssh_key.j2 b/templates/ansible/cross-platform/performance_monitoring/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..86a197bf1b6772c1eda0f7ac9d77918997b54a4a --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/ssh_key.j2 @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA1FrTNE42EgZr9WJNMtvpKFHYhPUJ4lzEp83EM0jYY3TyjmIe +ThMuqMLAHCk22fl4a8PttucggJ5ZWKhcJh623/y8AybJcmqZgq9a41Q609dmirf0 +7frCl+6zL8Mqy2Le2BD4eRADcq11s8r8Ys6J+EBPHQgEnK9CeZLSc/WFRlVr4bOD +s0bEouDxjTAMYjYcpsCwqYgGdIXI9WWsnt3RvcEe8CaiTqoyDN8ZtgkG6MweSrTQ +js8ySHO6o25cOoF7aT9Ihhf32I+KUanNIOvk3RAw2z1FK5xkFbbqMggZqz7rJn3M +sn2dDiCQi2CWox2OYXV/jJKLC3UFuOX64fS9cwIDAQABAoIBAQCs69Tm1/Vx0ibh +aA4DJ06C1bsh8cP9v5soJgfp1xzWSGooBcA1xasOI6B6jhkrgNlNr/uIIEe4VLne +1yJKrGIwnUagrloGQMYGxDKXwYQx80p+FXRuwe7p96eUcjIL8tQSUCd1tdOI87VQ +FjBVaWiybfO+aUQQLytLgoK7iKfhb7vO+9F+ZK1iDjBDNxFuiOM5zoeWOI7boYkD +2yXIkwoBePS2rosbPLa649sVakKex2WhQdUFst4Zba2RhnWQBXUY44LvEK5TzScF +FyYphPOUSplbzzM2+fuOna91NIWmJyHmf15lj7X9kC66XFIZMlvapksB8stEpDiA +4al3IdBJAoGBAPPuM3xkr/kQYYn7E42fgpmINZ78V48gMLhpyUOabZtF8inMyMPB +q7kfHns8Vx0ET8grSNr3qwDDV82lwvGqRCFChASMdQRR9LanydkDSeqpuZyQtVlt +A/65YUdcNY7Vy+M+fRh5Srh/6qcO3beLeLWXbJ4RHBP/OEmHuF4mLfgVAoGBAN7c +qdxTOhXPvOU69Bs5rJdfo6qBI1Yg8MCGctsUwPFpw1kW773ROOPa6XI6D74Dsdg8 +ypZ+IC3pRVtx61Xi3NOwxWNTTG+dyUgTSFz+WKjywXZXeHIbWngiFqk8JFYQWPzk +6YaJk4tZhk2YuNNaCCYRgQqyWv8coEurRlMXZHlnAoGBALcJwdaQ0z8oXJimL4jw +7ZX5kIrpPWanuAdZUe4Jfj+qX8mf4fKKbCowQLYmlBOw/ZDtcfDlMYsUCdnFjZ+7 +rP3sJJYpM1F3khJRm3PdNOUCUMY8C+i7lejZADcE6SdyJFkztbjcowYI7nJHBHZL +ENvqcVW27wPOWlVKozz6lzn1AoGALVwmaoS6DtRwcwuzwZLUkR7TNhIAujgMKHN1 +DyhDOR+4tfpYI39hH+dfmnM83wTrfsKozUawkAepqToflySMo72X/2Zl6VXpMPVT +xjGyo/h87fRRvI/asxblG9702luLcTW6XjrEQBmhn0uVWtc5T15CsIWqxb/y1FPx +BVp+hcMCgYAlJXbjzjbbDoIOCsXPSPe9voBL8zVwp0aNuvQcuB/vCt1n1c1DWuPr +AGMy/fRwY0Znag+ODMuulm7RgXUQy6ifJHiz9cKVGg/mGifaJSjgC+1AI9HFlij3 +asM5CueU0gK974rDxQkwmIWpRH57+kf6s8tGDrPPvqX9S4p3oxFlTw== +-----END RSA PRIVATE KEY----- diff --git a/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml b/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7119eb9193ea507a09b39be4a6c054c2c8418d68 --- /dev/null +++ b/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml @@ -0,0 +1,28 @@ +pma_deployment_id: "{{ lookup('env', 'DEPLOYMENT_ID' ) }}" +pma_influxdb_bucket: "{{ lookup('env', 'INFLUXDB_BUCKET' ) }}" +pma_influxdb_token: "{{ lookup('env', 'INFLUXDB_TOKEN' ) }}" +pma_influxdb_org: "{{ lookup('env', 'INFLUXDB_ORG' ) }}" +pma_influxdb_addr: "{{ lookup('env', 'INFLUXDB_ADDR' ) }}" + +telegraf_agent_package_state: latest + +telegraf_agent_output: + - type: influxdb_v2 + config: + - urls = ["{{ pma_influxdb_addr }}"] + - token = "{{ pma_influxdb_token }}" + - organization = "{{ pma_influxdb_org }}" + - bucket = "{{ pma_influxdb_bucket }}" + - insecure_skip_verify = true + +telegraf_global_tags: + - tag_name: deployment_id + tag_value: "{{ pma_deployment_id }}" + +telegraf_plugins_default: + - plugin: cpu + - plugin: mem + - plugin: processes + - plugin: disk + - plugin: net + - plugin: system diff --git a/templates/ansible/cross-platform/security_monitoring/README.md b/templates/ansible/cross-platform/security_monitoring/README.md new file mode 100644 index 0000000000000000000000000000000000000000..16225ff9a690c47d3fd8b60d9ac46085619fd275 --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/README.md @@ -0,0 +1,88 @@ +# sma-playbook + +Security Monitoring Agent (Wazuh agent) deployment as a docker + +## Usage - "baremetal" + +### Configuration + +`vars.yml` include: + +``` +--- +wazuh_manager_hostname: "wazuh-manager" +wazuh_manager_port: "1514" + +piacere_deployment_id: "123e4567-e89b-12d3-a456-demo-PIACERE" +``` + +All these variables can be overriden via environemnt. + +### Run the playbook + +To run the playbook: + +``` +ansible-playbook main.yml -i inventory.txt +``` + +## Usage - Docker + +To build the agent's docker image on `docker` host from the `inventory`, run this command: + +``` +ansible-playbook build-wazuh-agent.yml -i inventory.txt +``` + +You could also build the image manually and push it to some other docker registry. In this case you should change the variable for the image name within `vars.yml`. + +To start the deployment, run this command: + +``` +ansible-playbook deploy-wazuh-docker-agent.yml -i inventory.txt +``` + +Example of the configuration (`vars.yml`): + +``` +--- +service_config_dir: "{{ ansible_env.HOME }}/piacere-wazuh-agent" +docker_image_build_dir: "{{ ansible_env.HOME }}/piacere-wazuh-agent/image" +wazuh_manager_hostname: "wazuh-manager" +wazuh_manager_port: "1514" + +wazuh_agent_network: "security-monitoring-deployment_default" +wazuh_agent_name: "wazuh-agent-container-2" +wazuh_agent_group: "default" +wazuh_agent_config_volume: "{{ service_config_dir }}/ossec.conf:/var/ossec/etc/ossec.conf" +wazuh_agent_image_name: "wazuh-agent-image" + +piacere_deployment_id: "123e4567-e89b-12d3-a456-426614174002" +``` + +All these variables can be overriden via environemnt. + +### `Build Wazuh Agent` playbook + +It uses `community.docker.docker_image` module. It copies `docker-deploy` dir to the target and then it builds the agent's image with the name from the `vars.yml` on the target machine from the inventory. + +### `Deploy Wazuh Docker Agent` playbook + +It uses `community.docker.docker_container` module. The module runs the image with a name of `wazuh-agent-deploy:latest` by default (configurable within `vars.yml`), using the network `security-monitoring-deployment_default`, on the target machine. It is very important that the Wazuh Manager runs on the same network, otherwise the agent will not be able to contact the manager. `hostname` of the Agent will be set accordingly and visible in the Manager. ENV variable `WAZUH_MANAGER` sets the hostname of the Manager running on the network mentioned above. `WAZUH_AGENT_GROUP` will also to be taken into account by the Agent deployment. `ossec.conf` from the `docker-deploy` directory will be copied to the container's `/var/ossec/` directory. + +## Run the agent as a docker instance manually, not advisable + +Consider this section as a backup in the case you can not use the playbooks above. + +Build the image + +``` +cd docker-deploy +docker build -t docker-wazuh-agent:latest . +``` + +Run the agent attached to network `security-monitoring-deployment_default` where Wazuh Manager should be already running. + +``` +docker run -d --name wazuh-agent --network=security-monitoring-deployment_default --hostname localhost -e WAZUH_MANAGER=wazuh-manager -e WAZUH_AGENT_GROUP=default -v ${PWD}/ossec.conf:/var/ossec/etc/ossec.conf docker-wazuh-agent:latest +``` \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml b/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml new file mode 100644 index 0000000000000000000000000000000000000000..93693cf02f047e5ca4b8fe33686e6ed9d411a3e6 --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml @@ -0,0 +1,20 @@ +--- +- hosts: docker + tasks: + + - name: include vars + include_vars: vars.yml + + - name: Copy build dir to dest + copy: + src: "./docker-deploy" + dest: "{{ docker_image_build_dir }}" + mode: 0644 + + - name: Build docker image + community.docker.docker_image: + build: + path: "{{ docker_image_build_dir }}/docker-deploy" + name: "{{ wazuh_agent_image_name }}" + tag: latest + source: build \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/config.yaml b/templates/ansible/cross-platform/security_monitoring/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..99deb2a45c1b30c15a5932fcd37c65e7bd4796ad --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/config.yaml @@ -0,0 +1,10 @@ +--- +input: + - DEPLOYMENT_ID + - WAZUH_MANAGER_HOST + - WAZUH_MANAGER_PORT + # - instance_ip_vm1 + # - instance_server_private_key_user1 +output: [] +engine: ansible +... diff --git a/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 b/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 new file mode 100644 index 0000000000000000000000000000000000000000..b96de85fa881bf565826b253ff787f24cd6e45b1 --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 @@ -0,0 +1,203 @@ +<ossec_config> + <client> + <server> + <address>{{ wazuh_manager_hostname }}</address> + <port>{{ wazuh_manager_port }}</port> + <protocol>tcp</protocol> + </server> + <config-profile>ubuntu, ubuntu20, ubuntu20.04</config-profile> + <notify_time>60</notify_time> + <time-reconnect>120</time-reconnect> + <auto_restart>yes</auto_restart> + <crypto_method>aes</crypto_method> + </client> + + + <client_buffer> + <!-- Agent buffer options --> + <disabled>no</disabled> + <queue_size>5000</queue_size> + <events_per_second>500</events_per_second> + </client_buffer> + + <!-- Policy monitoring --> + <rootcheck> + <disabled>no</disabled> + <check_files>yes</check_files> + <check_trojans>yes</check_trojans> + <check_dev>yes</check_dev> + <check_sys>yes</check_sys> + <check_pids>yes</check_pids> + <check_ports>yes</check_ports> + <check_if>yes</check_if> + + <!-- Frequency that rootcheck is executed - every 12 hours --> + <frequency>43200</frequency> + + <rootkit_files>etc/shared/rootkit_files.txt</rootkit_files> + <rootkit_trojans>etc/shared/rootkit_trojans.txt</rootkit_trojans> + + <skip_nfs>yes</skip_nfs> + </rootcheck> + + <wodle name="cis-cat"> + <disabled>yes</disabled> + <timeout>1800</timeout> + <interval>1d</interval> + <scan-on-start>yes</scan-on-start> + + <java_path>wodles/java</java_path> + <ciscat_path>wodles/ciscat</ciscat_path> + </wodle> + + <!-- Osquery integration --> + <wodle name="osquery"> + <disabled>yes</disabled> + <run_daemon>yes</run_daemon> + <log_path>/var/log/osquery/osqueryd.results.log</log_path> + <config_path>/etc/osquery/osquery.conf</config_path> + <add_labels>yes</add_labels> + </wodle> + + <!-- System inventory --> + <wodle name="syscollector"> + <disabled>no</disabled> + <interval>1h</interval> + <scan_on_start>yes</scan_on_start> + <hardware>yes</hardware> + <os>yes</os> + <network>yes</network> + <packages>yes</packages> + <ports all="no">yes</ports> + <processes>yes</processes> + + <!-- Database synchronization settings --> + <synchronization> + <max_eps>10</max_eps> + </synchronization> + </wodle> + + <sca> + <enabled>yes</enabled> + <scan_on_start>yes</scan_on_start> + <interval>12h</interval> + <skip_nfs>yes</skip_nfs> + </sca> + + <!-- File integrity monitoring --> + <syscheck> + <disabled>no</disabled> + + <!-- Frequency that syscheck is executed default every 12 hours --> + <frequency>43200</frequency> + + <scan_on_start>yes</scan_on_start> + + <!-- Directories to check (perform all possible verifications) --> + <directories>/etc,/usr/bin,/usr/sbin</directories> + <directories>/bin,/sbin,/boot</directories> + + <!-- Files/directories to ignore --> + <ignore>/etc/mtab</ignore> + <ignore>/etc/hosts.deny</ignore> + <ignore>/etc/mail/statistics</ignore> + <ignore>/etc/random-seed</ignore> + <ignore>/etc/random.seed</ignore> + <ignore>/etc/adjtime</ignore> + <ignore>/etc/httpd/logs</ignore> + <ignore>/etc/utmpx</ignore> + <ignore>/etc/wtmpx</ignore> + <ignore>/etc/cups/certs</ignore> + <ignore>/etc/dumpdates</ignore> + <ignore>/etc/svc/volatile</ignore> + + <!-- File types to ignore --> + <ignore type="sregex">.log$|.swp$</ignore> + + <!-- Check the file, but never compute the diff --> + <nodiff>/etc/ssl/private.key</nodiff> + + <skip_nfs>yes</skip_nfs> + <skip_dev>yes</skip_dev> + <skip_proc>yes</skip_proc> + <skip_sys>yes</skip_sys> + + <!-- Nice value for Syscheck process --> + <process_priority>10</process_priority> + + <!-- Maximum output throughput --> + <max_eps>100</max_eps> + + <!-- Database synchronization settings --> + <synchronization> + <enabled>yes</enabled> + <interval>5m</interval> + <max_interval>1h</max_interval> + <max_eps>10</max_eps> + </synchronization> + </syscheck> + + <!-- Log analysis --> + <localfile> + <log_format>command</log_format> + <command>df -P</command> + <frequency>360</frequency> + </localfile> + + <localfile> + <log_format>full_command</log_format> + <command>netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d</command> + <alias>netstat listening ports</alias> + <frequency>360</frequency> + </localfile> + + <localfile> + <log_format>full_command</log_format> + <command>last -n 20</command> + <frequency>360</frequency> + </localfile> + + <!-- Active response --> + <active-response> + <disabled>no</disabled> + <ca_store>etc/wpk_root.pem</ca_store> + <ca_verification>yes</ca_verification> + </active-response> + + <!-- Choose between "plain", "json", or "plain,json" for the format of internal logs --> + <logging> + <log_format>plain</log_format> + </logging> + + <labels> + <label key="piacere-deployment-id">{{ piacere_deployment_id }}</label> + </labels> +</ossec_config> + +<ossec_config> + <localfile> + <log_format>audit</log_format> + <location>/var/log/audit/audit.log</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/ossec/logs/active-responses.log</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/log/messages</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/log/secure</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/log/maillog</location> + </localfile> + +</ossec_config> \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml new file mode 100644 index 0000000000000000000000000000000000000000..408b26123ff32fbfba2d3fb22571b0271606d95b --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml @@ -0,0 +1,110 @@ +- hosts: servers_for_security_monitoring + gather_facts: yes + + pre_tasks: + - name: Check parameters + fail: + msg: 'variable {{item}} not defined' + when: item is not defined + with_items: + - piacere_deployment_id + - wazuh_manager_hostname + - wazuh_manager_port + - name: Print parameters + debug: + msg: + - "piacere_deployment_id: {{ piacere_deployment_id }}" + - "wazuh_manager_hostname: {{ wazuh_manager_hostname }}" + - "wazuh_manager_port: {{ wazuh_manager_port }}" + - name: Ensure gnupg package + package: + name: gnupg + state: present + become: true + vars_files: + - vars.yml + + tasks: + + - name: System details + ansible.builtin.debug: msg="{{ item }}" + with_items: + - "{{ ansible_distribution }}" + - "{{ ansible_distribution_version }}" + - "{{ ansible_distribution_major_version }}" + + - name: Other distributions not supported + ansible.builtin.shell: echo "only on Ubuntu or Debian" + when: ansible_distribution != 'Debian' and ansible_distribution != 'Ubuntu' + + - name: System upgrade + ansible.builtin.apt: + name: "*" + state: latest + update_cache: yes + force_apt_get: True + cache_valid_time: 3600 + become: yes + register: apt_action + retries: 100 + until: apt_action is success + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + + - name: APT install required packages + become: yes + ansible.builtin.apt: + name: + - curl + - python3 + state: present + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + + - name: Add wazuh apt repository and install wazuh-agent + become: yes + block: + - name: Get wazuh apt-key + ansible.builtin.apt_key: + url: https://packages.wazuh.com/key/GPG-KEY-WAZUH + state: present + - name: Add wazuh apt repository + ansible.builtin.apt_repository: + repo: "deb https://packages.wazuh.com/4.x/apt/ stable main" + state: present + filename: wazuh + update_cache: yes + - name: Install wazuh-agent + register: updatesys + apt: + name: wazuh-agent + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + + - name: Create config path + ansible.builtin.file: + path: "{{ service_config_dir }}" + state: directory + mode: 0755 + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + + - name: Copy config template to remote host + become: yes + ansible.builtin.template: + src: "{{ playbook_dir }}/config/ossec.conf.j2" + dest: "/var/ossec/etc/ossec.conf" + mode: 0644 + register: config_changed + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + + - name: Start wazuh agent service + become: yes + block: + - name: Make sure wazuh-agent service is enabled and not masked + ansible.builtin.systemd: + daemon_reload: yes + name: wazuh-agent + enabled: yes + masked: no + - name: Start the service + ansible.builtin.systemd: + name: wazuh-agent + state: started + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml new file mode 100644 index 0000000000000000000000000000000000000000..2f5029673ac777dd2091da87a26c3e87b456a837 --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml @@ -0,0 +1,34 @@ +--- +- hosts: docker + tasks: + + - name: include vars + include_vars: vars.yml + + - name: Create config path + file: + path: "{{ service_config_dir }}" + state: directory + mode: 0755 + + - name: Copy config template to remote host + template: + src: "{{ playbook_dir }}/config/ossec.conf.j2" + dest: "{{ service_config_dir }}/ossec.conf" + mode: 0644 + register: config_changed + + - name: Run docker image + docker_container: + name: wazuh-agent-container + networks: + - name: "{{ wazuh_agent_network }}" + image: "{{ wazuh_agent_image_name }}" + state: started + hostname: "{{ wazuh_agent_name }}" + auto_remove: false + env: + WAZUH_MANAGER: "{{ wazuh_manager_hostname }}" + WAZUH_AGENT_GROUP: "{{ wazuh_agent_group }}" + volumes: + - "{{ wazuh_agent_config_volume }}" \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/docker-deploy/Dockerfile b/templates/ansible/cross-platform/security_monitoring/docker-deploy/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c669855af7483c06aaf819f5a84d025c4e33fd1b --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/docker-deploy/Dockerfile @@ -0,0 +1,16 @@ +FROM debian:10.12-slim + +RUN apt-get update && apt-get install -y \ + procps curl apt-transport-https gnupg2 inotify-tools python-docker && \ + curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add - && \ + echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee /etc/apt/sources.list.d/wazuh.list && \ + apt-get update && \ + apt-get install -y lsb-release && \ + rm -rf /var/lib/apt/lists/* + +RUN curl -so wazuh-agent-4.2.5.deb https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_4.2.5-1_amd64.deb && dpkg -i ./wazuh-agent-4.2.5.deb + +COPY entrypoint.sh /entrypoint.sh +COPY ossec.conf /var/ossec/etc/ + +ENTRYPOINT ["bash","entrypoint.sh"] \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/docker-deploy/entrypoint.sh b/templates/ansible/cross-platform/security_monitoring/docker-deploy/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..dbd7d2b5a69028dd0fe74f7bd7cc41b406b40e9a --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/docker-deploy/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Start the agent + +/var/ossec/bin/wazuh-control start +status=$? +if [ $status -ne 0 ]; then + echo "Failed to start agent: $status" + exit $status +fi + +echo "background jobs running, listening for changes" + +while sleep 60; do + /var/ossec/bin/wazuh-control status > /dev/null 2>&1 + status=$? + if [ $status -ne 0 ]; then + echo "looks like the agent died." + exit 1 + fi +done diff --git a/templates/ansible/cross-platform/security_monitoring/docker-deploy/ossec.conf b/templates/ansible/cross-platform/security_monitoring/docker-deploy/ossec.conf new file mode 100644 index 0000000000000000000000000000000000000000..e49eb11c0e2118f22d83717571169b8b49e69f05 --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/docker-deploy/ossec.conf @@ -0,0 +1,203 @@ +<ossec_config> + <client> + <server> + <address>wazuh-manager</address> + <port>1514</port> + <protocol>tcp</protocol> + </server> + <config-profile>ubuntu, ubuntu20, ubuntu20.04</config-profile> + <notify_time>60</notify_time> + <time-reconnect>120</time-reconnect> + <auto_restart>yes</auto_restart> + <crypto_method>aes</crypto_method> + </client> + + + <client_buffer> + <!-- Agent buffer options --> + <disabled>no</disabled> + <queue_size>5000</queue_size> + <events_per_second>500</events_per_second> + </client_buffer> + + <!-- Policy monitoring --> + <rootcheck> + <disabled>no</disabled> + <check_files>yes</check_files> + <check_trojans>yes</check_trojans> + <check_dev>yes</check_dev> + <check_sys>yes</check_sys> + <check_pids>yes</check_pids> + <check_ports>yes</check_ports> + <check_if>yes</check_if> + + <!-- Frequency that rootcheck is executed - every 12 hours --> + <frequency>43200</frequency> + + <rootkit_files>etc/shared/rootkit_files.txt</rootkit_files> + <rootkit_trojans>etc/shared/rootkit_trojans.txt</rootkit_trojans> + + <skip_nfs>yes</skip_nfs> + </rootcheck> + + <wodle name="cis-cat"> + <disabled>yes</disabled> + <timeout>1800</timeout> + <interval>1d</interval> + <scan-on-start>yes</scan-on-start> + + <java_path>wodles/java</java_path> + <ciscat_path>wodles/ciscat</ciscat_path> + </wodle> + + <!-- Osquery integration --> + <wodle name="osquery"> + <disabled>yes</disabled> + <run_daemon>yes</run_daemon> + <log_path>/var/log/osquery/osqueryd.results.log</log_path> + <config_path>/etc/osquery/osquery.conf</config_path> + <add_labels>yes</add_labels> + </wodle> + + <!-- System inventory --> + <wodle name="syscollector"> + <disabled>no</disabled> + <interval>1h</interval> + <scan_on_start>yes</scan_on_start> + <hardware>yes</hardware> + <os>yes</os> + <network>yes</network> + <packages>yes</packages> + <ports all="no">yes</ports> + <processes>yes</processes> + + <!-- Database synchronization settings --> + <synchronization> + <max_eps>10</max_eps> + </synchronization> + </wodle> + + <sca> + <enabled>yes</enabled> + <scan_on_start>yes</scan_on_start> + <interval>12h</interval> + <skip_nfs>yes</skip_nfs> + </sca> + + <!-- File integrity monitoring --> + <syscheck> + <disabled>no</disabled> + + <!-- Frequency that syscheck is executed default every 12 hours --> + <frequency>43200</frequency> + + <scan_on_start>yes</scan_on_start> + + <!-- Directories to check (perform all possible verifications) --> + <directories>/etc,/usr/bin,/usr/sbin</directories> + <directories>/bin,/sbin,/boot</directories> + + <!-- Files/directories to ignore --> + <ignore>/etc/mtab</ignore> + <ignore>/etc/hosts.deny</ignore> + <ignore>/etc/mail/statistics</ignore> + <ignore>/etc/random-seed</ignore> + <ignore>/etc/random.seed</ignore> + <ignore>/etc/adjtime</ignore> + <ignore>/etc/httpd/logs</ignore> + <ignore>/etc/utmpx</ignore> + <ignore>/etc/wtmpx</ignore> + <ignore>/etc/cups/certs</ignore> + <ignore>/etc/dumpdates</ignore> + <ignore>/etc/svc/volatile</ignore> + + <!-- File types to ignore --> + <ignore type="sregex">.log$|.swp$</ignore> + + <!-- Check the file, but never compute the diff --> + <nodiff>/etc/ssl/private.key</nodiff> + + <skip_nfs>yes</skip_nfs> + <skip_dev>yes</skip_dev> + <skip_proc>yes</skip_proc> + <skip_sys>yes</skip_sys> + + <!-- Nice value for Syscheck process --> + <process_priority>10</process_priority> + + <!-- Maximum output throughput --> + <max_eps>100</max_eps> + + <!-- Database synchronization settings --> + <synchronization> + <enabled>yes</enabled> + <interval>5m</interval> + <max_interval>1h</max_interval> + <max_eps>10</max_eps> + </synchronization> + </syscheck> + + <!-- Log analysis --> + <localfile> + <log_format>command</log_format> + <command>df -P</command> + <frequency>360</frequency> + </localfile> + + <localfile> + <log_format>full_command</log_format> + <command>netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d</command> + <alias>netstat listening ports</alias> + <frequency>360</frequency> + </localfile> + + <localfile> + <log_format>full_command</log_format> + <command>last -n 20</command> + <frequency>360</frequency> + </localfile> + + <!-- Active response --> + <active-response> + <disabled>no</disabled> + <ca_store>etc/wpk_root.pem</ca_store> + <ca_verification>yes</ca_verification> + </active-response> + + <!-- Choose between "plain", "json", or "plain,json" for the format of internal logs --> + <logging> + <log_format>plain</log_format> + </logging> + + <labels> + <label key="piacere-deployment-id">123e4567-e89b-12d3-a456-426614174001</label> + </labels> +</ossec_config> + +<ossec_config> + <localfile> + <log_format>audit</log_format> + <location>/var/log/audit/audit.log</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/ossec/logs/active-responses.log</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/log/messages</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/log/secure</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/log/maillog</location> + </localfile> + +</ossec_config> \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/inventory.j2 b/templates/ansible/cross-platform/security_monitoring/inventory.j2 new file mode 100644 index 0000000000000000000000000000000000000000..ac48c344d8434d117b2caacb5dae9e18db3ce74b --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/inventory.j2 @@ -0,0 +1,9 @@ + + +[servers_for_security_monitoring] +demo-server-for-agents + +[servers_for_security_monitoring:vars] +ansible_connection=ssh +ansible_user=ubuntu +ansible_ssh_private_key_file=ssh_key diff --git a/templates/ansible/cross-platform/security_monitoring/inventory.txt b/templates/ansible/cross-platform/security_monitoring/inventory.txt new file mode 100644 index 0000000000000000000000000000000000000000..eac7201b349f07399d900be4f0c724bd30219c5f --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/inventory.txt @@ -0,0 +1,5 @@ +[docker] +localhost + +[sma_host] +localhost ansible_user=vagrant ansible_password=vagrant ansible_port=2222 \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/main.yml b/templates/ansible/cross-platform/security_monitoring/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..40b8c6f1193ac380eb6a1ae8657f8d524dbf246f --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/main.yml @@ -0,0 +1 @@ +- import_playbook: deploy-wazuh-agent.yml \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/ssh_key.j2 b/templates/ansible/cross-platform/security_monitoring/ssh_key.j2 new file mode 100644 index 0000000000000000000000000000000000000000..86a197bf1b6772c1eda0f7ac9d77918997b54a4a --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/ssh_key.j2 @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA1FrTNE42EgZr9WJNMtvpKFHYhPUJ4lzEp83EM0jYY3TyjmIe +ThMuqMLAHCk22fl4a8PttucggJ5ZWKhcJh623/y8AybJcmqZgq9a41Q609dmirf0 +7frCl+6zL8Mqy2Le2BD4eRADcq11s8r8Ys6J+EBPHQgEnK9CeZLSc/WFRlVr4bOD +s0bEouDxjTAMYjYcpsCwqYgGdIXI9WWsnt3RvcEe8CaiTqoyDN8ZtgkG6MweSrTQ +js8ySHO6o25cOoF7aT9Ihhf32I+KUanNIOvk3RAw2z1FK5xkFbbqMggZqz7rJn3M +sn2dDiCQi2CWox2OYXV/jJKLC3UFuOX64fS9cwIDAQABAoIBAQCs69Tm1/Vx0ibh +aA4DJ06C1bsh8cP9v5soJgfp1xzWSGooBcA1xasOI6B6jhkrgNlNr/uIIEe4VLne +1yJKrGIwnUagrloGQMYGxDKXwYQx80p+FXRuwe7p96eUcjIL8tQSUCd1tdOI87VQ +FjBVaWiybfO+aUQQLytLgoK7iKfhb7vO+9F+ZK1iDjBDNxFuiOM5zoeWOI7boYkD +2yXIkwoBePS2rosbPLa649sVakKex2WhQdUFst4Zba2RhnWQBXUY44LvEK5TzScF +FyYphPOUSplbzzM2+fuOna91NIWmJyHmf15lj7X9kC66XFIZMlvapksB8stEpDiA +4al3IdBJAoGBAPPuM3xkr/kQYYn7E42fgpmINZ78V48gMLhpyUOabZtF8inMyMPB +q7kfHns8Vx0ET8grSNr3qwDDV82lwvGqRCFChASMdQRR9LanydkDSeqpuZyQtVlt +A/65YUdcNY7Vy+M+fRh5Srh/6qcO3beLeLWXbJ4RHBP/OEmHuF4mLfgVAoGBAN7c +qdxTOhXPvOU69Bs5rJdfo6qBI1Yg8MCGctsUwPFpw1kW773ROOPa6XI6D74Dsdg8 +ypZ+IC3pRVtx61Xi3NOwxWNTTG+dyUgTSFz+WKjywXZXeHIbWngiFqk8JFYQWPzk +6YaJk4tZhk2YuNNaCCYRgQqyWv8coEurRlMXZHlnAoGBALcJwdaQ0z8oXJimL4jw +7ZX5kIrpPWanuAdZUe4Jfj+qX8mf4fKKbCowQLYmlBOw/ZDtcfDlMYsUCdnFjZ+7 +rP3sJJYpM1F3khJRm3PdNOUCUMY8C+i7lejZADcE6SdyJFkztbjcowYI7nJHBHZL +ENvqcVW27wPOWlVKozz6lzn1AoGALVwmaoS6DtRwcwuzwZLUkR7TNhIAujgMKHN1 +DyhDOR+4tfpYI39hH+dfmnM83wTrfsKozUawkAepqToflySMo72X/2Zl6VXpMPVT +xjGyo/h87fRRvI/asxblG9702luLcTW6XjrEQBmhn0uVWtc5T15CsIWqxb/y1FPx +BVp+hcMCgYAlJXbjzjbbDoIOCsXPSPe9voBL8zVwp0aNuvQcuB/vCt1n1c1DWuPr +AGMy/fRwY0Znag+ODMuulm7RgXUQy6ifJHiz9cKVGg/mGifaJSjgC+1AI9HFlij3 +asM5CueU0gK974rDxQkwmIWpRH57+kf6s8tGDrPPvqX9S4p3oxFlTw== +-----END RSA PRIVATE KEY----- diff --git a/templates/ansible/cross-platform/security_monitoring/vars.yml b/templates/ansible/cross-platform/security_monitoring/vars.yml new file mode 100644 index 0000000000000000000000000000000000000000..339a384631888c62ac3c2eb7ac35bc9c408a766b --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/vars.yml @@ -0,0 +1,13 @@ +--- +service_config_dir: "{{ ansible_env.HOME }}/piacere-wazuh-agent" +docker_image_build_dir: "{{ ansible_env.HOME }}/piacere-wazuh-agent/image" +wazuh_manager_hostname: "{{ lookup('env', 'WAZUH_MANAGER_HOST' ) }}" +wazuh_manager_port: "{{ lookup('env', 'WAZUH_MANAGER_PORT' ) }}" + +wazuh_agent_network: "security-monitoring-deployment_default" +wazuh_agent_name: "wazuh-agent-container-2" +wazuh_agent_group: "default" +wazuh_agent_config_volume: "{{ service_config_dir }}/ossec.conf:/var/ossec/etc/ossec.conf" +wazuh_agent_image_name: "wazuh-agent-image" + +piacere_deployment_id: "{{ lookup('env', 'DEPLOYMENT_ID' ) }}" diff --git a/templates/ansible/ubuntu/config.tpl b/templates/ansible/ubuntu/config.tpl index 91ddccee1d6e0920ed7c89445f5ec98321eff828..29f289e080d76b368be1d7286c82a567234a105c 100644 --- a/templates/ansible/ubuntu/config.tpl +++ b/templates/ansible/ubuntu/config.tpl @@ -15,8 +15,20 @@ #} --- input: - - instance_ip_{{ node.infra_element_name }} - - instance_server_private_key_{{ node.credentials }} + {%- if name == "performance_monitoring" %} + - INFLUXDB_BUCKET + - INFLUXDB_TOKEN + - INFLUXDB_ORG + - INFLUXDB_ADDR + - DEPLOYMENT_ID{%- endif %} + {%- if name == "security_monitoring" %} + - DEPLOYMENT_ID + - WAZUH_MANAGER_HOST + - WAZUH_MANAGER_PORT{%- endif %} + {%- for node in nodes %} + - instance_server_public_ip_{{ node.infra_element_name }} + - instance_server_private_key_{{ node.credentials }}_{{ node.infra_element_name }} + {%- endfor %} output: [] engine: ansible ... diff --git a/templates/ansible/ubuntu/elasticsearch.tpl b/templates/ansible/ubuntu/elasticsearch.tpl new file mode 100644 index 0000000000000000000000000000000000000000..05d04329cb93c3f21e52fcb1f4d90ab77f222da5 --- /dev/null +++ b/templates/ansible/ubuntu/elasticsearch.tpl @@ -0,0 +1,21 @@ +--- + +- name: Elasticsearch with custom configuration + hosts: servers_for_elasticsearch + roles: + - role: elastic.elasticsearch + vars: + es_data_dirs: + - "/opt/elasticsearch/data" + es_log_dir: "/opt/elasticsearch/logs" + es_config: + node.name: "node1" + cluster.name: "custom-cluster" + discovery.seed_hosts: "localhost:9301" + http.port: 9201 + transport.port: 9301 + node.data: false + node.master: true + bootstrap.memory_lock: true + es_heap_size: 1g + es_api_port: 9201 \ No newline at end of file diff --git a/templates/ansible/ubuntu/elasticsearch_main.tpl b/templates/ansible/ubuntu/elasticsearch_main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..5a0e4fd404051db71599ec211eb0d71892edf40c --- /dev/null +++ b/templates/ansible/ubuntu/elasticsearch_main.tpl @@ -0,0 +1,12 @@ +--- + +- hosts: localhost + + pre_tasks: + - file: + path: roles + state: absent + + - command: ansible-galaxy install elastic.elasticsearch,v7.17.0 + tasks: + - command: ansible-playbook -i inventory elasticsearch.yml \ No newline at end of file diff --git a/templates/ansible/ubuntu/inventory.tpl b/templates/ansible/ubuntu/inventory.tpl index 2c64481d048089136ee067301132be913c28d36d..9988722feb89e3425bc095b5a555f377a3e4cac8 100644 --- a/templates/ansible/ubuntu/inventory.tpl +++ b/templates/ansible/ubuntu/inventory.tpl @@ -15,7 +15,9 @@ #} [{{ "servers_for_" ~ name }}] -{% raw %}{{ instance_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{%- for node in nodes %} +{% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{%- endfor %} [{{ "servers_for_" ~ name }}:vars] ansible_connection=ssh diff --git a/templates/ansible/ubuntu/performance_monitoring_main.tpl b/templates/ansible/ubuntu/performance_monitoring_main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..8b32d6384d9ec8979ab6561920b6e5165386cad3 --- /dev/null +++ b/templates/ansible/ubuntu/performance_monitoring_main.tpl @@ -0,0 +1,42 @@ +--- +- hosts: localhost + tasks: + - name: print disclamer + debug: + msg: this can also be done with "ansible-galaxy install -r requirements" + - name: install telegraf from galaxy + community.general.ansible_galaxy_install: + type: role + requirements_file: ansible_requirements.yml + +- hosts: servers_for_performance_monitoring + pre_tasks: + - name: Check parameters + fail: + msg: 'variable {{item}} not defined' + when: item is not defined + with_items: + - pma_deployment_id + - pma_influxdb_bucket + - pma_influxdb_token + - pma_influxdb_org + - pma_influxdb_addr + - name: Print parameters + debug: + msg: + - "pma_deployment_id: {{ pma_deployment_id }}" + - "pma_influxdb_bucket: {{ pma_influxdb_bucket }}" + - "pma_influxdb_token: {{ pma_influxdb_token }}" + - "pma_influxdb_org: {{ pma_influxdb_org }}" + - "pma_influxdb_addr: {{ pma_influxdb_addr }}" + - name: Ensure gnupg package + package: + name: gnupg + state: present + become: true + vars_files: + - vars/main.yaml + tasks: + - name: Install telegraf + ansible.builtin.include_role: + name: dj-wasabi.telegraf diff --git a/templates/ansible/ubuntu/security_monitoring_main.tpl b/templates/ansible/ubuntu/security_monitoring_main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..43a939ec202fef1188ddcac4156a8036d44334de --- /dev/null +++ b/templates/ansible/ubuntu/security_monitoring_main.tpl @@ -0,0 +1,2 @@ +--- +- import_playbook: deploy-wazuh-agent.yml \ No newline at end of file diff --git a/templates/ansible/ubuntu/ssh_key.tpl b/templates/ansible/ubuntu/ssh_key.tpl index 798ef200ade5df0158a3316e588d7ffb0f57b25f..d7a25b0b80bab4646cc35634b7c94002eb688776 100644 --- a/templates/ansible/ubuntu/ssh_key.tpl +++ b/templates/ansible/ubuntu/ssh_key.tpl @@ -1 +1,4 @@ -{% raw %}{{ instance_server_private_key_{% endraw %}{{ node.credentials }} {% raw %}}}{% endraw %} \ No newline at end of file +{%- for node in nodes %} +{%- raw %}{{ instance_server_private_key_{% endraw %}{{ node.credentials }}{% raw %}_{%- endraw %}{{node.infra_element_name}}{% raw %}}} +{% endraw %} +{%- endfor %} \ No newline at end of file diff --git a/templates/common/gaiax_self_description.yaml.tpl b/templates/common/gaiax_self_description.yaml.tpl new file mode 100644 index 0000000000000000000000000000000000000000..5403076083981522f055b8834c7cb4eeb32c368e --- /dev/null +++ b/templates/common/gaiax_self_description.yaml.tpl @@ -0,0 +1,65 @@ +{ + "@context": { + "gax-participant": "http://w3id.org/gaia-x/participant#", + "gax-service": "http://w3id.org/gaia-x/service#", + "dct": "http://purl.org/dc/terms/", + "sh": "http://www.w3.org/ns/shacl#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "gax-validation": "http://w3id.org/gaia-x/validation#", + "gax-node": "http://w3id.org/gaia-x/node#", + "vcard": "http://www.w3.org/2006/vcard/ns#", + "dcat": "http://www.w3.org/ns/dcat#", + "gax-resource": "http://w3id.org/gaia-x/resource#", + "gax-core": "http://w3id.org/gaia-x/core#" + }, + "@id": "ServiceOffering-{{'{:0=10}'.format(range(0, 9999999999) | random) }}", + "@type": "gax-service:ServiceOffering", + "gax-service:hasServiceTitle": { + {% set list = output_path.split('/') %} + "@value": "{{ list[1] }}", + "@type": "xsd:string" + }, + "dct:description": { + "@value": "Gaia-X self-description generated by PIACERE ICG", + "@type": "xsd:string" + }, + "dcat:keyword": [ + "Service", + {%- for step in steps %} {% if step.data.provider_info is defined %} + {%- if step.data.provider_info[0].provider_name is defined %} + "{{ step.data.provider_info[0].provider_name }}", + {%- endif %}{%- endif %}{% endfor %} + "IaC", + "Terraform" + ], + "gax-service:maintainedBy": [ + "PIACERE Community" + ], + "gax-service:hasProvisionType": { + "@value": "Hybrid", + "@type": "xsd:string" + }, + "gax-service:hostedOn": { + {%- for step in steps %} {% if step.data.provider_info is defined %} + {%- if step.data.provider_info[0].provider_name is defined %} + "@id": "{{ step.data.provider_info[0].provider_name }}", + {%- endif %}{%- endif %}{% endfor %} + "@type": "gax-participant:Provider" + }, + "gax-service:infrastructureAsCode": [ + { + "@type": "iac:DOML", + "iac:url": { + "@value": {% raw %}"{{User placeholder: URL to the DOML source in Git}}",{% endraw %} + "@type": "xsd:anyURI" + } + }, + { + "@type": "iac:terraform", + "iac:url": { + "@value": {% raw %}"{{User placeholder: URL to the ICG result}}",{% endraw %} + "@type": "xsd:anyURI" + } + } + ] +} diff --git a/templates/docker_compose/config.tpl b/templates/docker_compose/config.tpl new file mode 100644 index 0000000000000000000000000000000000000000..a41fd52a7657e4bc6c64ae4e3178663d21cf38e2 --- /dev/null +++ b/templates/docker_compose/config.tpl @@ -0,0 +1,24 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} +--- +input: + {%- for config in configs %} + - instance_server_public_ip_{{ config.host.name }} + - instance_server_private_key_{{ config.host.credentials }}_{{ config.host.name }} + {%- endfor %} +output: [] +engine: ansible +... diff --git a/templates/docker_compose/docker_compose.tpl b/templates/docker_compose/docker_compose.tpl new file mode 100644 index 0000000000000000000000000000000000000000..239c40bd111f342804832c7f3942324af8156eaa --- /dev/null +++ b/templates/docker_compose/docker_compose.tpl @@ -0,0 +1,9 @@ +version: '3' +services: + {{ name }}: + image: {{ generatedFrom.uri }} + restart: on-failure + ports: + {%- for config in configs %} + - "{{ "127.0.0.1:" ~ config.container_port }}:{{ config.iface.name }}:{{ config.vm_port }}" + {%- endfor %} diff --git a/templates/docker_compose/inventory.tpl b/templates/docker_compose/inventory.tpl new file mode 100644 index 0000000000000000000000000000000000000000..56870524f0735c6e94a81b75b144c788915868f6 --- /dev/null +++ b/templates/docker_compose/inventory.tpl @@ -0,0 +1,27 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +[{{ "servers_for_" ~ name }}] +{%- for config in configs %} +{% raw %}{{ instance_server_public_ip_{% endraw %}{{ config.host.name }} {% raw %}}}{% endraw %} +{%- endfor %} + +[{{ "servers_for_" ~ name }}:vars] +ansible_connection=ssh +{%- for config in configs %} +ansible_user={%- if "ubuntu" in config.host.os.lower() %}ubuntu{%- elif "centos" in config.host.os.lower() %}centos{%- endif %} +{%- endfor %} +ansible_ssh_private_key_file=ssh_key diff --git a/templates/docker_compose/main.tpl b/templates/docker_compose/main.tpl new file mode 100644 index 0000000000000000000000000000000000000000..60809d8390485125b5ee460ca3ffeeef2a570f0c --- /dev/null +++ b/templates/docker_compose/main.tpl @@ -0,0 +1,12 @@ +--- +- hosts: {{ "servers_for_" ~ name }} + gather_facts: no + become: yes + tasks: + - name: Copy over docker compose + copy: + src: docker_compose.yml + dest: . + - name: Deploy application + docker_compose: + definition: docker_compose.yml diff --git a/templates/docker_compose/ssh_key.tpl b/templates/docker_compose/ssh_key.tpl new file mode 100644 index 0000000000000000000000000000000000000000..fd56742cf3b8e3b011a5e4efbbfaa6f87b41edad --- /dev/null +++ b/templates/docker_compose/ssh_key.tpl @@ -0,0 +1,4 @@ +{%- for config in configs %} +{%- raw %}{{ instance_server_private_key_{% endraw %}{{ config.host.credentials }}{% raw %}_{%- endraw %}{{config.host.name}}{% raw %} }} +{% endraw %} +{%- endfor %} diff --git a/templates/terraform/aws/autoscaling_group.tpl b/templates/terraform/aws/autoscaling_group.tpl new file mode 100644 index 0000000000000000000000000000000000000000..c46e66e12e4bd4e183d45fe407fbb6cad920001b --- /dev/null +++ b/templates/terraform/aws/autoscaling_group.tpl @@ -0,0 +1,19 @@ +resource "aws_launch_template" "{{infra_element_name}}" { + name_prefix = "{{name}}_" + //image_id = "ami-1a2b3c" + {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.lower().startswith('virtualmachine') %} + instance_type = "{{value.sizeDescription}}" + image_id = "{{value.os}}" + {%- endif %}{% endif %}{% endfor %} +} + +resource "aws_autoscaling_group" "{{infra_element_name}}" { + desired_capacity = {{min}} + max_size = {{max}} + min_size = {{min}} + + launch_template { + id = aws_launch_template.{{infra_element_name}}.id + version = "$Latest" + } +} \ No newline at end of file diff --git a/templates/terraform/aws/config.tpl b/templates/terraform/aws/config.tpl new file mode 100644 index 0000000000000000000000000000000000000000..8a4c87845c5ed32f20eb06fc90f6e8eb1568842b --- /dev/null +++ b/templates/terraform/aws/config.tpl @@ -0,0 +1,29 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +--- +engine: terraform +input: + - AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY + - AWS_REGION +output: +{%- for vm in vms %} + - instance_server_public_key_{{ vm.credentials }}_{{ vm.infra_element_name }} + - instance_server_public_ip_{{ vm.infra_element_name }} + - instance_public_dns_{{ vm.infra_element_name }} +{% endfor %} +... diff --git a/templates/terraform/aws/network.tpl b/templates/terraform/aws/network.tpl index 20c82014f5920357724d72a5b7bed864f102a127..1a53dddf68763e9656ae7a17f18e314682c4e73d 100644 --- a/templates/terraform/aws/network.tpl +++ b/templates/terraform/aws/network.tpl @@ -13,27 +13,31 @@ # limitations under the License. #------------------------------------------------------------------------- #} - +#VPC resource "aws_vpc" "{{infra_element_name}}" { cidr_block = "{{ addressRange }}" tags = { Name = "{{name}}" } } - -resource "aws_subnet" "{{infra_element_name ~ "_subnet"}}" { +{##-------- Subnets Here ##} +{% for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('Subnet') %} +# Subnet +resource "aws_subnet" "{{value.name ~ "_subnet"}}" { vpc_id = aws_vpc.{{infra_element_name}}.id - cidr_block = "{{vpc_subnet.addressRange}}" - # map_public_ip_on_launch = true + cidr_block = "{{value.addressRange}}" + map_public_ip_on_launch = false tags = { - Name = "{{name}}" + Name = "{{value.name}}" } -} - -resource "aws_network_interface" {{infra_element_name ~ "_network_interface"}} { - subnet_id = aws_subnet.{{infra_element_name ~ "_subnet"}}.id - security_groups = [aws_security_group.{{ name ~ "_security_group_rule" }}.id] ##TOBECHANGED +}{% endif %}{% endif %}{% endfor %} +{##-------- Internet Gateway Subnets Here ##} +{% for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('InternetGateway') %} +# Internet Gateway Subnet +resource "aws_internet_gateway" "{{value.name ~ "_internet_gw_subnet"}}" { + vpc_id = aws_vpc.{{infra_element_name}}.id tags = { - Name = "{{infra_element_name ~ "_network_interface"}}" + Name = "{{value.name}}" } -} +}{% endif %}{% endif %}{% endfor %} + diff --git a/templates/terraform/aws/port_rule.tpl b/templates/terraform/aws/port_rule.tpl index 7d2f8f81dda17604b1331844684ec2fe74360d78..4bee5b6738f8edf21e709107437a10467840be14 100644 --- a/templates/terraform/aws/port_rule.tpl +++ b/templates/terraform/aws/port_rule.tpl @@ -15,16 +15,16 @@ #} # CREATING SECURITY_GROUP -resource "aws_security_group" "{{ infra_element_name ~ "_security_group_rule" }}" { ## TOBECHANGE +resource "aws_security_group" "{{ infra_element_name ~ "_security_group" }}" { name = "{{ infra_element_name }}" # description = "Security group rule for port {{ fromPort }}" - vpc_id = aws_vpc.{{vpc_name}}.id ##ADD VPC NAME REFERENCE + vpc_id = aws_vpc.{{vpc_name}}.id ##MISSING VPC NAME REFERENCE FROM DOML {% for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %} {% if value == "INGRESS" %} ingress {% else %} egress {% endif %} { from_port = {{ value.fromPort }} to_port = {{ value.toPort }} protocol = "{{ value.protocol }}" - cidr_blocks = [{% for range in value.cidr %}"{{ range }}"{% endfor %}] + cidr_blocks = [{% for range in value.cidr %}"{{ range }}",{% endfor %}] } {% endif %}{% endif %}{% endfor %} } \ No newline at end of file diff --git a/controller/test_Orchestrator.py b/templates/terraform/aws/ssh_key.tpl similarity index 76% rename from controller/test_Orchestrator.py rename to templates/terraform/aws/ssh_key.tpl index 2544c453d3c8d2f0994403f388e2ec3c8e705468..e953e39082d96ce4269da64d086f402972301616 100644 --- a/controller/test_Orchestrator.py +++ b/templates/terraform/aws/ssh_key.tpl @@ -1,4 +1,4 @@ -# Copyright 2022 Hewlett Packard Enterprise Development LP +{# Copyright 2022 Hewlett Packard Enterprise Development LP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,11 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. #------------------------------------------------------------------------- - -from unittest import TestCase - - -class TestOrchestrator(TestCase): - - def test_create_iac_from_doml(self): - self.fail() +#} +resource "aws_key_pair" "{{infra_element_name}}" { + key_name = "{{infra_element_name}}" + public_key = "{{keyfile}}" +} \ No newline at end of file diff --git a/templates/terraform/aws/temp.tpl b/templates/terraform/aws/temp.tpl new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/templates/terraform/aws/virtual_machine.tpl b/templates/terraform/aws/virtual_machine.tpl index 67d49a3b3a95c34bc06252607a756754c657e6b6..e3307dda30eed01389fb2e7c44b6059212f2497c 100644 --- a/templates/terraform/aws/virtual_machine.tpl +++ b/templates/terraform/aws/virtual_machine.tpl @@ -14,13 +14,12 @@ #------------------------------------------------------------------------- #} -resource "aws_instance" "{{name}}" { +resource "aws_instance" "{{infra_element_name}}" { ami = "{{ os }}" - instance_type = "{{ instance_type }}" - key_name = "{{ssh_key_name}}" - - network_interface { - network_interface_id = aws_network_interface.{{i1.belongsTo ~ "_network_interface"}}.id - device_index = 0 + instance_type = "{% if 'vm_flavor' in context().keys() %}{{ vm_flavor }}{% else %}{{ instance_type }}{% endif %}" + key_name = "{{credentials}}" + {% if 'group' in context().keys() %}vpc_security_group_ids = [aws_security_group.{{group ~ "_security_group"}}.id]{% endif %} + tags = { + "Name" = "{{name}}" } } diff --git a/templates/terraform/aws/virtual_machine_out.tpl b/templates/terraform/aws/virtual_machine_out.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f7da256e2df25967f02c5bf207b335e54cd48585 --- /dev/null +++ b/templates/terraform/aws/virtual_machine_out.tpl @@ -0,0 +1,27 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +output "instance_server_public_key_{{ credentials }}_{{ infra_element_name }}" { + value = aws_key_pair.{{ credentials }}.public_key +} + +output "instance_server_public_ip_{{ infra_element_name }}" { + value = aws_instance.{{infra_element_name}}.public_ip +} + +output "instance_public_dns_{{ infra_element_name }}" { + value = aws_instance.{{infra_element_name}}.public_dns +} \ No newline at end of file diff --git a/templates/terraform/azure/port_rule.tpl b/templates/terraform/azure/port_rule.tpl new file mode 100644 index 0000000000000000000000000000000000000000..8ada56ba56d040559abff02b38f5b2c8964008c1 --- /dev/null +++ b/templates/terraform/azure/port_rule.tpl @@ -0,0 +1,37 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +resource "azurerm_network_security_group" " {{ infra_element_name ~ "_security_group" }}" { + name = " {{ infra_element_name }}" + location = azurerm_resource_group. {{ resource_name }}.location + resource_group_name = azurerm_resource_group. {{ resource_name }}.name + {%- for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %} + security_rule { + name = "{{ value.name }}" + priority = 100 + direction = "{% if value == "INGRESS" %} Inbound {% else %} Outbound {% endif %} " + access = "Allow" + protocol = "{{ value.protocol }}"" + source_port_range = {{ value.fromPort }}" + destination_port_range = "{{ value.toPort }}"" + source_address_prefix = "{% for range in value.cidr %}"{{ range }}"{% endfor %}" + destination_address_prefix = "{% for range in value.cidr %}"{{ range }}"{% endfor %}" + } + {%- endif %}{% endif %}{% endfor %} + tags = { + environment = "Production" + } +} diff --git a/templates/terraform/google_cloud/vm.tpl b/templates/terraform/google_cloud/vm.tpl index bd42a80121e3f5cb2cbe7c90ba219ede23f8b78d..d90853471e7bee27c9d7db66c36ff65dd7ef21f7 100644 --- a/templates/terraform/google_cloud/vm.tpl +++ b/templates/terraform/google_cloud/vm.tpl @@ -16,12 +16,12 @@ resource "google_compute_instance" "{{ default }}" { name = "{{ name }}" - machine_type = "{{ machine_type }}" - zone = "{{ zone }}" + machine_type = "{% if 'vm_flavor' in context().keys() %}{{ vm_flavor }}{% else %}{{ instance_type }}{% endif %}" + zone = "{% if 'vm_Zone' in context().keys() %}{{ vm_Zone }}{% else %}{{ zone }}{% endif %}" boot_disk { initialize_params { - image = "debian-cloud/debian-9" + image = "{{ os }}" #"debian-cloud/debian-9" } } diff --git a/templates/terraform/ionos/config.tpl b/templates/terraform/ionos/config.tpl new file mode 100644 index 0000000000000000000000000000000000000000..51cc877140d96869c73c8953a85df09977080115 --- /dev/null +++ b/templates/terraform/ionos/config.tpl @@ -0,0 +1,28 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +--- +engine: terraform +input: + - IONOS_USERNAME + - IONOS_PASSWORD + - IONOS_API_URL +output: +{% for vm in vms %} + - instance_server_password_{{ vm.infra_element_name }} + - instance_public_ip_{{ vm.infra_element_name }} +{% endfor %} +... diff --git a/templates/terraform/ionos/datacenter.tpl b/templates/terraform/ionos/datacenter.tpl new file mode 100644 index 0000000000000000000000000000000000000000..a30fb00d6bb6668f0c8ae22dde6444af168d4943 --- /dev/null +++ b/templates/terraform/ionos/datacenter.tpl @@ -0,0 +1,21 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +resource "ionoscloud_datacenter" "dc_for_vm" { + name = "{{gname}}" + location = "{% if 'vm_Region' in context().keys() %}{{ vm_Region }}{% else %}de/txl{% endif %}" + description = "Piacere demo with IONOS, Terraform and Gaia-X orchestrator" +} diff --git a/templates/terraform/ionos/init.tpl b/templates/terraform/ionos/init.tpl new file mode 100644 index 0000000000000000000000000000000000000000..07b31d3fac150a0d1238bb61c158a61dcb23eaf0 --- /dev/null +++ b/templates/terraform/ionos/init.tpl @@ -0,0 +1,25 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +terraform { + required_version = ">= 1.0.0" + required_providers { + ionoscloud = { + source = "ionos-cloud/ionoscloud" + version = "{{ _version_ }}" + } + } +} \ No newline at end of file diff --git a/templates/terraform/ionos/network.tpl b/templates/terraform/ionos/network.tpl new file mode 100644 index 0000000000000000000000000000000000000000..e17073dfd13bfa7a804ed0fa70511f39b77bca5d --- /dev/null +++ b/templates/terraform/ionos/network.tpl @@ -0,0 +1,22 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +# lan connected to the server in the nic defined on the server +resource "ionoscloud_lan" "lan_for_{{ infra_element_name }}" { + name = "LAN for Piacere demo" + datacenter_id = ionoscloud_datacenter.dc_for_{{ infra_element_name }}.id + public = true +} \ No newline at end of file diff --git a/templates/terraform/ionos/virtual_machine.tpl b/templates/terraform/ionos/virtual_machine.tpl new file mode 100644 index 0000000000000000000000000000000000000000..b95df2fa8548b233b3199709269f47c386e00e30 --- /dev/null +++ b/templates/terraform/ionos/virtual_machine.tpl @@ -0,0 +1,115 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +# we need 1 public ip +resource "ionoscloud_ipblock" "public_ip_{{ infra_element_name }}" { + name = "Public IP for Piacere demo" + location = ionoscloud_datacenter.dc_for_vm.location + size = 1 +} + +# Create virtual machine +resource "ionoscloud_server" "{{ infra_element_name }}" { + name = "{{ name }}" + datacenter_id = ionoscloud_datacenter.dc_for_vm.id + cores = {% if 'vm_Virtual_CPU_Cores' in context().keys() %}{{ vm_Virtual_CPU_Cores }}{% else %}{{ cpu_count }}{% endif %} + ram = {% if 'vm_Memory' in context().keys() %}{{ vm_Memory }}{% else %}{{ memory_mb }}{% endif %} + image_name = "{% if 'vm_Flavor' in context().keys() %}{{ vm_Flavor }}{% else %}{{ os }}{% endif %}" + availability_zone = "AUTO" + ssh_key_path = [ + "./ssh_key" + ] + nic { + lan = ionoscloud_lan.lan_for_{{ infra_element_name }}.id + dhcp = true + firewall_active = false + name = "public_nic_{{ infra_element_name }}" + ips = [ + ionoscloud_ipblock.public_ip_{{ infra_element_name }}.ips[0]] + } + volume { + # /dev/vda1 + name = "main-hdd" + size = {% if 'vm_Instance_Storage' in context().keys() %}{{ vm_Instance_Storage }}{% else %}{{ storage }}{% endif %} + disk_type = "HDD" + user_data = base64encode(<<EOF +#!/bin/bash +apt update +apt -y install ffmpeg vlc wget iproute2 + +adduser vlc-user +usermod -aG sudo vlc-user + +mkdir -p /srv/piacere /srv/piacere/pipes /srv/piacere/data + +wget -O /srv/piacere/data/piacere.mkv "https://koofr.islonline.com/content/links/6541b213-ddc8-4d71-7369-f70642b9d73f/files/get/piacere.mkv?path=%2F" + +mkfifo /srv/piacere/pipes/pipe1 + +tee /srv/piacere/loop-and-transcode.sh <<LAT >/dev/null +#!/usr/bin/env bash + +exec ffmpeg \ + -nostdin \ + -re \ + -y \ + -fflags +genpts \ + -stream_loop -1 \ + -i "/srv/piacere/data/piacere.mkv" \ + -g 75 \ + -quality realtime \ + -speed 5 \ + -threads 4 \ + -tile-columns 4 \ + -frame-parallel 1 \ + -row-mt 1 \ + -qmin 4 \ + -qmax 48 \ + -b:v 500k \ + -c:v libvpx-vp9 \ + -an \ + -f webm \ + "/srv/piacere/pipes/pipe1" +LAT + +tee /srv/piacere/http-server.sh <<HS >/dev/null +#!/usr/bin/env bash + +export SUDO_UID=$(id -u vlc-user) +exec vlc-wrapper \ + -I dummy \ + /srv/piacere/pipes/pipe1 \ + --sout '#http{mux=webm, dst=:5001}' \ + --no-sout-all \ + --sout-keep +HS + +chown -R vlc-user:vlc-user /srv/piacere +chmod a+x /srv/piacere/loop-and-transcode.sh /srv/piacere/http-server.sh + +systemd-run \ + --unit=piacere-loop-and-transcode \ + --description="Piacere stream looper and transcoder" \ + /srv/piacere/loop-and-transcode.sh + +systemd-run \ + --unit=piacere-http-server \ + --description="Piacere stream HTTP server" \ + /srv/piacere/http-server.sh + EOF + ) + } +} \ No newline at end of file diff --git a/templates/terraform/ionos/virtual_machine_out.tpl b/templates/terraform/ionos/virtual_machine_out.tpl new file mode 100644 index 0000000000000000000000000000000000000000..abaf2a5a07a49fa53c1515326ee7bb3546160fd9 --- /dev/null +++ b/templates/terraform/ionos/virtual_machine_out.tpl @@ -0,0 +1,27 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +output "instance_server_password_{{ infra_element_name }}" { + value = random_password.server_image_password.result +} + +output "instance_server_public_ip_{{ infra_element_name }}" { + value = ionoscloud_ipblock.public_ip_{{ infra_element_name }}.ips[0] +} + +output "ip_address" { + value = ionoscloud_ipblock.public_ip_{{ infra_element_name }}.ips[0] +} \ No newline at end of file diff --git a/templates/terraform/open_stack/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml b/templates/terraform/open_stack/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml index 58c0cb368b76e9a0313aee87b2296e727877b2d9..47808cf1de00ffc1a13ff9c7ee26043954cfb6d1 100644 --- a/templates/terraform/open_stack/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml +++ b/templates/terraform/open_stack/agents_playbook/ansible/playbooks/pma/ansible_requirements.yml @@ -1,8 +1,8 @@ roles: # - name: dj-wasabi.telegraf -# version: 0.13.2 +# version: 0.13.3 # source: https://galaxy.ansible.com - name: dj-wasabi.telegraf src: https://github.com/dj-wasabi/ansible-telegraf.git scm: git - version: 0.13.2 + version: 0.13.3 diff --git a/templates/terraform/open_stack/config.tpl b/templates/terraform/open_stack/config.tpl index 9aa85acf80c498b30ca20a55971979873a60cec8..612e8ae24353efea86781bef0db61a5487fbcda9 100644 --- a/templates/terraform/open_stack/config.tpl +++ b/templates/terraform/open_stack/config.tpl @@ -23,8 +23,8 @@ input: - OS_PROJECT_NAME output: {% for vm in vms %} - - instance_server_public_key_{{ vm.credentials }} - - instance_server_private_key_{{ vm.credentials }} - - instance_ip_{{ vm.infra_element_name }} + - instance_server_public_key_{{ vm.credentials }}_{{ vm.infra_element_name }} + - instance_server_private_key_{{ vm.credentials }}_{{ vm.infra_element_name }} + - instance_server_public_ip_{{ vm.infra_element_name }} {% endfor %} ... diff --git a/templates/terraform/open_stack/network.tpl b/templates/terraform/open_stack/network.tpl index 6ab4d6a3454ed4acf2050445973ca19d7388df2e..e5585674dd83a9114acb0312a8eea9db36ee6c61 100644 --- a/templates/terraform/open_stack/network.tpl +++ b/templates/terraform/open_stack/network.tpl @@ -13,43 +13,36 @@ # limitations under the License. #------------------------------------------------------------------------- #} +{##-------- Variables ##} +{%- set var_network_name = infra_element_name -%} +{%- set var_security_groups = infra_sgs -%} ## Network # Create Network -resource "openstack_networking_network_v2" "{{ infra_element_name }}" { +resource "openstack_networking_network_v2" "{{ var_network_name }}" { name = "{{ name }}" } -# Create Subnet -resource "openstack_networking_subnet_v2" "{{ infra_element_name ~ "_subnet" }}" { - name = "{{ name ~ "_subnet" }}" - network_id = openstack_networking_network_v2.{{ infra_element_name }}.id - cidr = "{{ addressRange }}" - dns_nameservers = ["8.8.8.8", "8.8.8.4"] +# Create router +resource "openstack_networking_router_v2" "router_{{ var_network_name }}" { + name = "router_{{ var_network_name }}" + external_network_id = data.openstack_networking_network_v2.external.id #External network id } -# Attach networking port -resource "openstack_networking_port_v2" "{{ infra_element_name }}" { - name = "{{ name }}" - network_id = openstack_networking_network_v2.{{ infra_element_name }}.id - admin_state_up = true - security_group_ids = [ - {% for sg in infra_sgs %}openstack_compute_secgroup_v2.{{sg}}.id, - {% endfor %} - ] - fixed_ip { - subnet_id = openstack_networking_subnet_v2.{{ infra_element_name ~ "_subnet" }}.id - } +{##-------- Subnets Here ##} +{%- for key, value in context().items() -%}{%- if not callable(value) -%}{%-if key.startswith('Subnet') -%} +# Subnet +resource "openstack_networking_subnet_v2" "{{ value.name ~ "_subnet" }}" { + name = "{{ value.name ~ "_subnet" }}" + network_id = openstack_networking_network_v2.{{ var_network_name }}.id + cidr = "{{ value.addressRange }}" + dns_nameservers = ["8.8.8.8", "8.8.8.4"] } -# Create router -resource "openstack_networking_router_v2" "{{ infra_element_name ~ "_router" }}" { - name = "{{ infra_element_name ~ "_router" }}" - external_network_id = data.openstack_networking_network_v2.external.id #External network id +# Create router interface on subnet +resource "openstack_networking_router_interface_v2" "router_interface_{{ var_network_name }}_{{ value.name ~ "_subnet" }}" { + router_id = "${openstack_networking_router_v2.router_{{ var_network_name }}.id}" + subnet_id = "${openstack_networking_subnet_v2.{{ value.name ~ "_subnet" }}.id}" } -# Router interface configuration -resource "openstack_networking_router_interface_v2" "{{ infra_element_name ~ "_router_interface" }}" { - router_id = openstack_networking_router_v2.{{ infra_element_name ~ "_router" }}.id - subnet_id = openstack_networking_subnet_v2.{{ infra_element_name ~ "_subnet" }}.id -} \ No newline at end of file +{%-endif %}{% endif %}{% endfor %} \ No newline at end of file diff --git a/templates/terraform/open_stack/port_rule.tpl b/templates/terraform/open_stack/port_rule.tpl index 3d7b10e44b264d841d6f95559d57f51e62b972b7..35607031607029bf439e6d55918064bb7693abf1 100644 --- a/templates/terraform/open_stack/port_rule.tpl +++ b/templates/terraform/open_stack/port_rule.tpl @@ -15,15 +15,17 @@ #} # CREATING SECURITY_GROUP -{% for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %} -resource "openstack_compute_secgroup_v2" "{{ key }}" { - name = "{{ key }}" - description = "Security group rule for port {{ value.fromPort }}" - rule { - from_port = {{ value.fromPort }} - to_port = {{ value.toPort }} - ip_protocol = "{{ value.protocol }}" - cidr = {% for range in value.cidr %}"{{ range }}"{% endfor %} - } +resource "openstack_compute_secgroup_v2" "{{infra_element_name}}" { + name = "infra_element_name" + description = "PIACERE security group created - {{infra_element_name}}" + + {%- for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %} + rule { + from_port = {{ value.fromPort }} + to_port = {{ value.toPort }} + ip_protocol = "{{ value.protocol }}" + cidr = {% for range in value.cidr %}"{{ range }}"{% endfor %} + } + {%- endif %}{% endif %}{% endfor %} } -{% endif %}{% endif %}{% endfor %} \ No newline at end of file + diff --git a/templates/terraform/open_stack/ssh_key.tpl b/templates/terraform/open_stack/ssh_key.tpl index a8850d9569c4db2342ca8db39fccbdbe8700887c..633ac35a892460d7e982ea81706cbf7b18958187 100644 --- a/templates/terraform/open_stack/ssh_key.tpl +++ b/templates/terraform/open_stack/ssh_key.tpl @@ -17,5 +17,5 @@ # Create ssh keys resource "openstack_compute_keypair_v2" "{{ infra_element_name }}" { name = "{{ user }}" - # public_key = "{{ user }}" + # public_key = "{{ keyfile }}" } \ No newline at end of file diff --git a/templates/terraform/open_stack/virtual_machine.tpl b/templates/terraform/open_stack/virtual_machine.tpl index 9e3777265b91c5dae523c75ccadb7592977944bb..3a7a4df51cb518150a672a4f3443a5494ca52090 100644 --- a/templates/terraform/open_stack/virtual_machine.tpl +++ b/templates/terraform/open_stack/virtual_machine.tpl @@ -16,13 +16,15 @@ # Create virtual machine resource "openstack_compute_instance_v2" "{{ infra_element_name }}" { - name = "{{ vm_name }}" + name = "{{ name }}" image_name = "{{ os }}" - flavor_name = "{{ vm_flavor }}" + flavor_name = "{% if 'sizeDescription' in context().keys() %}{{ sizeDescription }}{% elif 'vm_flavor' in context().keys() %}{{ vm_flavor }}{% else %}{{ instance_type }}{% endif %}" key_pair = openstack_compute_keypair_v2.{{ credentials }}.name + {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} network { - port = openstack_networking_port_v2.{{ i1.belongsTo }}.id + port = openstack_networking_port_v2.{{ value.name ~ "_networking_port"}}.id } + {%- endif %}{% endif %}{% endfor %} } # Create floating ip @@ -36,3 +38,28 @@ resource "openstack_compute_floatingip_associate_v2" "{{ infra_element_name ~ "_ floating_ip = openstack_networking_floatingip_v2.{{ infra_element_name ~ "_floating_ip" }}.address instance_id = openstack_compute_instance_v2.{{ infra_element_name }}.id } + +# Router interface configuration +{% for key, value in context().items() %}{% if not callable(value)%}{%- if key.startswith('NetworkInterface') %} +resource "openstack_networking_router_interface_v2" "{{ value.belongsTo ~ "_router_interface" }}" { + router_id = openstack_networking_router_v2.router.id + subnet_id = openstack_networking_subnet_v2.{{ value.belongsTo ~ "_subnet"}}.id +} + +{# adding security groups for interfaces #} +{%- if value.associated is defined %} +# Attach networking port +resource "openstack_networking_port_v2" "{{ value.name ~ "_networking_port" }}" { + name = "{{ value.name }}" + network_id = openstack_networking_network_v2.{{ extra_parameters.networks[0].infra_element_name }}.id + admin_state_up = true + security_group_ids = [ openstack_compute_secgroup_v2.{{ value.associated }}.id ] + fixed_ip { + subnet_id = openstack_networking_subnet_v2.{{ value.belongsTo ~ "_subnet" }}.id + } +} +{%- endif%} + +{%- endif %}{% endif %}{% endfor %} + + diff --git a/templates/terraform/open_stack/virtual_machine_out.tpl b/templates/terraform/open_stack/virtual_machine_out.tpl index 3b25ad5718be3016166d70140082e848006153ae..14b3aa347394f9d4169c0b431dde51689b20f7bc 100644 --- a/templates/terraform/open_stack/virtual_machine_out.tpl +++ b/templates/terraform/open_stack/virtual_machine_out.tpl @@ -14,14 +14,14 @@ #------------------------------------------------------------------------- #} -output "instance_server_public_key_{{ credentials }}" { +output "instance_server_public_key_{{ credentials }}_{{ infra_element_name }}" { value = openstack_compute_keypair_v2.{{ credentials }}.public_key } -output "instance_server_private_key_{{ credentials }}" { +output "instance_server_private_key_{{ credentials }}_{{ infra_element_name }}" { value = openstack_compute_keypair_v2.{{ credentials }}.private_key } -output "instance_ip_{{ infra_element_name }}" { +output "instance_server_public_ip_{{ infra_element_name }}" { value = openstack_compute_floatingip_associate_v2.{{ infra_element_name ~ "_floating_ip_association" }}.floating_ip } \ No newline at end of file diff --git a/templates/terraform/vsphere/config.tpl b/templates/terraform/vsphere/config.tpl new file mode 100644 index 0000000000000000000000000000000000000000..57da2182cb28acac71fa349ae94e92bb6dc513e6 --- /dev/null +++ b/templates/terraform/vsphere/config.tpl @@ -0,0 +1,30 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +--- +engine: terraform +input: + - VSPHERE_USER + - VSPHERE_PASSWORD + - VSPHERE_SERVER + - VSPHERE_ALLOW_UNVERIFIED_SSL +output: +{% for vm in vms %} + - instance_server_public_key_{{ vm.credentials }} + - instance_public_ip_{{ vm.infra_element_name }} + - instance_public_dns_{{ vm.infra_element_name }} +{% endfor %} +... diff --git a/templates/terraform/vsphere/data_resources.tpl b/templates/terraform/vsphere/data_resources.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f6f2f5a42e1b1307174e3d983565e1223df63778 --- /dev/null +++ b/templates/terraform/vsphere/data_resources.tpl @@ -0,0 +1,6 @@ +data "{{type}}" "{{name}}" { + name = "{{gname}}" +{%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} + datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} +{% endif %}{% endif %}{% endfor %} +} diff --git a/templates/terraform/vsphere/datacenter.tpl b/templates/terraform/vsphere/datacenter.tpl new file mode 100644 index 0000000000000000000000000000000000000000..7c62ba1744e6b70379d4f35940f6cdc50902f18d --- /dev/null +++ b/templates/terraform/vsphere/datacenter.tpl @@ -0,0 +1,13 @@ +{##-------- Variables ##} +{%- set preexinsting = preexisting -%} + +{%- if preexinsting %} +data "vsphere_datacenter" "{{datacenter}}" { + name = "{{datacenter}}" +} +{%- else %} +resource "vsphere_datacenter" "{{datacenter}}" { + name = "{{datacenter}}" + folder = "{{folder_path}}" +} +{%-endif %} \ No newline at end of file diff --git a/templates/terraform/vsphere/datastore.tpl b/templates/terraform/vsphere/datastore.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f35c6b5d74148987f1526712d48ffc21aad6f72a --- /dev/null +++ b/templates/terraform/vsphere/datastore.tpl @@ -0,0 +1,8 @@ +{%- if preexisting %} +data "vsphere_datastore" "{{name}}" { + name = "{{vsphere_datastore_name}}" +{%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} + datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} +{% endif %}{% endif %}{% endfor %} +} +{%- endif %} \ No newline at end of file diff --git a/templates/terraform/vsphere/init.tpl b/templates/terraform/vsphere/init.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f1614868a63878dd9cb8e7bcc4a4e8f9bb07c713 --- /dev/null +++ b/templates/terraform/vsphere/init.tpl @@ -0,0 +1,22 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +provider "vsphere" { + #user = VSPHERE_USER + #password = VSPHERE_PASSWORD + #vsphere_server = VSPHERE_SERVER + #allow_unverified_ssl = {{allow_unverified_ssl}} +} diff --git a/templates/terraform/vsphere/network.tpl b/templates/terraform/vsphere/network.tpl new file mode 100644 index 0000000000000000000000000000000000000000..5294d77162136f7afef64be353b3c504c4561221 --- /dev/null +++ b/templates/terraform/vsphere/network.tpl @@ -0,0 +1,13 @@ +{##-------- Variables ##} +{%- set preexinsting = preexisting -%} + +{%- if preexinsting %} +data "vsphere_network" "{{infra_element_name}}" { + name = "{{vsphere_network_name}}" +{%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} + datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} +{% endif %}{% endif %}{% endfor %} +} +{% else %} +TODO +{%-endif %} \ No newline at end of file diff --git a/templates/terraform/vsphere/ssh_key.tpl b/templates/terraform/vsphere/ssh_key.tpl new file mode 100644 index 0000000000000000000000000000000000000000..f16964d787d031908bdb049e53162f758d48b2d1 --- /dev/null +++ b/templates/terraform/vsphere/ssh_key.tpl @@ -0,0 +1,19 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} +resource "tls_private_key" "{{infra_element_name}}" { + algorithm = "{{algorithm}}" + rsa_bits = {{bits}} +} \ No newline at end of file diff --git a/templates/terraform/vsphere/virtual_machine.tpl b/templates/terraform/vsphere/virtual_machine.tpl new file mode 100644 index 0000000000000000000000000000000000000000..a31bafe4a86f8f8a9951da350ebc0d32daa67b7c --- /dev/null +++ b/templates/terraform/vsphere/virtual_machine.tpl @@ -0,0 +1,77 @@ +{# Copyright 2022 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +# Create virtual machine +resource "vsphere_virtual_machine" "{{ infra_element_name }}" { + name = "{{ name }}" + {%- if pool and pool.preexisting %} + resource_pool_id = ${data.{{pool.type}}.{{ pool.name }}.id} + {%- endif %} + {%- if datastore and datastore.preexisting %} + datastore_id = ${data.vsphere_datastore.{{ datastore.name }}.id} + {%- endif %} + num_cpus = {% if 'vm_Virtual_CPU_Cores' in context().keys() %}{{ vm_Virtual_CPU_Cores }}{% else %}{{ cpu_count }}{% endif %} + memory = {% if 'vm_Memory' in context().keys() %}{{ vm_Memory }}{% else %}{{ memory_mb }}{% endif %} + + guest_id = "{{guest_id}}" + + network_interface { + network_id = {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} ${data.vsphere_network.{{ value.belongsTo }}.id} + {%- endif %}{% endif %}{% endfor %} + } + + disk { + label = "{{disk}}" //TODO Missing attach option in DOML - datastore and disk are two different resources + size = {% if 'vm_Instance_Storage' in context().keys() %}{{ vm_Instance_Storage }}{% else %}{{ disk_size }}{% endif %} + + } + + clone { + template_uuid = ${data.vsphere_virtual_machine.{{template.name}}.id} + customize { + linux_options { + host_name = "{{host_name}}" + domain = "{{domain}}" + } + network_interface { + ipv4_address = {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} "{{ value.endPoint }}"{%- endif %}{% endif %}{% endfor %} + ipv4_netmask = 27 //TODO retrieve in some way the netmask from the network (ICG Parser) + dns_server_list = ["10.81.34.36, 10.81.34.60"] + } + ipv4_gateway = "10.83.18.65" //TODO the DOML v2.2 definition of gateway is still not implemented in IDE + } + } + + connection { + type = "ssh" + user = "${var.username}" + password = "${var.password}" + host = "${self.default_ip_address}" # TCN GBE + } + + provisioner "remote-exec" { + inline = [ + "systemctl stop firewalld", + "echo 'nameserver 10.81.34.36' | sudo tee /etc/resolv.conf", + "mkdir /root/.ssh", + "chmod 700 /root/.ssh", + "touch /root/.ssh/authorized_keys", + "chmod 600 /root/.ssh/authorized_keys", + "echo -e '${tls_private_key.{{ credentials }}.public_key_openssh}' >> /root/.ssh/authorized_keys" # TCN GBE + ] + } + +} \ No newline at end of file diff --git a/templates/terraform/vsphere/virtual_machine_out.tpl b/templates/terraform/vsphere/virtual_machine_out.tpl new file mode 100644 index 0000000000000000000000000000000000000000..46abc7219d460c07044e22351b5b6e997768f8b3 --- /dev/null +++ b/templates/terraform/vsphere/virtual_machine_out.tpl @@ -0,0 +1,15 @@ +output "instance_server_public_key_{{ credentials }}_{{ infra_element_name }}" { + value = tls_private_key.{{ credentials }}.public_key_openssh +} + +output "instance_server_private_key_{{ credentials }}_{{ infra_element_name }}" { + value = nonsensitive(tls_private_key.{{ credentials }}.private_key_openssh) +} + +output "instance_user_{{ infra_element_name }}" { + value = var.username +} + +output "instance_ip_{{ infra_element_name }}" { + value = vsphere_virtual_machine.{{ infra_element_name }}.default_ip_address +} \ No newline at end of file diff --git a/templates/terraform/vsphere/vm_image.tpl b/templates/terraform/vsphere/vm_image.tpl new file mode 100644 index 0000000000000000000000000000000000000000..e6570d992e301f9c5a3dc7c4d30bca225219ae30 --- /dev/null +++ b/templates/terraform/vsphere/vm_image.tpl @@ -0,0 +1,8 @@ +{%- if preexisting %} +data "vsphere_virtual_machine" "{{name}}" { + name = "{{vsphere_virtual_machine_name}}" +{%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} + datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} +{% endif %}{% endif %}{% endfor %} +} +{%- endif %} \ No newline at end of file diff --git a/utility/PropertiesReaderUtility.py b/utility/PropertiesReaderUtility.py new file mode 100644 index 0000000000000000000000000000000000000000..483c474f29e43eeecaf1154533c0996b31ef2cca --- /dev/null +++ b/utility/PropertiesReaderUtility.py @@ -0,0 +1,44 @@ +import configparser +import logging +import os + + +def read_properties_file(properties_file_name): + current_folder = os.path.dirname(os.path.realpath(__file__)) + logging.info(f"Reading {properties_file_name} file from folder {current_folder}") + config = configparser.ConfigParser() + config.read(properties_file_name) + return config + +def get_sections(properties_file_name): + logging.info(f"Searching section in file {properties_file_name}") + config_parser = read_properties_file(properties_file_name) + sections =config_parser.sections() + logging.info(f"Founded sections {sections}") + return sections + +def get_items_from_section(properties_file_name, section): + logging.info(f"Searching items in {properties_file_name}.{section}") + config_parser = read_properties_file(properties_file_name) + sections = get_sections(properties_file_name) + for sec in sections: + if sec == section: + items = dict(config_parser.items(section)) + logging.info(f"Founded {items} in {properties_file_name}.{section}") + return items + return logging.info(f"No section {section} found in {properties_file_name}") + +def get_items_from_key(properties_file_name, section, key): + logging.info(f"Searching items in {properties_file_name}.{section}.{key}") + items = get_items_from_section(properties_file_name, section) + values = items.get(key) + return values.split(",") + +def get_key_from_properties(properties_file_name, section): + logging.info(f"Searching items in {properties_file_name}.{section}") + items = get_items_from_section(properties_file_name, section) + return items.keys() + + + +