Skip to content
Snippets Groups Projects
Commit 76ec005f authored by debora.benedetto@hpe.com's avatar debora.benedetto@hpe.com
Browse files

Update doml ecore and openstack etmplates

parent 98af4c22
Branches
No related tags found
No related merge requests found
......@@ -26,12 +26,22 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements"
upperBound="-1" eType="#//commons/Requirement" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Property">
<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"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" 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>
......@@ -54,7 +64,6 @@
eType="#//infrastructure/InfrastructureElement"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Requirement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="identifier" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<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"/>
......@@ -125,8 +134,6 @@
eType="#//infrastructure/ComputingNode" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1"
eType="#//infrastructure/VPC" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="secGroups" upperBound="-1"
eType="#//infrastructure/SecurityGroup" 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"
......@@ -135,6 +142,8 @@
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"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1"
......@@ -163,7 +172,7 @@
<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="addressRanges" upperBound="-1"
<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">
......@@ -182,9 +191,9 @@
<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" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="memory" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
<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" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu" 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"/>
......@@ -225,7 +234,8 @@
<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="host" eType="#//infrastructure/ComputingNode"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="hosts" upperBound="-1"
eType="#//infrastructure/ComputingNode"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Network" abstract="true" eSuperTypes="#//commons/DOMLElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
......@@ -253,7 +263,8 @@
</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="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<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" 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"/>
......@@ -265,6 +276,8 @@
</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>
......@@ -272,6 +285,21 @@
<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"
......@@ -319,7 +347,7 @@
<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"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/AutoScalingGroup"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/>
</eSubpackages>
......@@ -334,7 +362,17 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements"
upperBound="-1" eType="#//commons/Requirement" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"/>
<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"
......
This diff is collapsed.
......@@ -3,11 +3,46 @@
"steps": [
{
"data": {
"credentials": [
"computingGroup": [
{
"algorithm": "RSA",
"bits": 4096,
"name": "ssh_key"
"cidr": [
"0.0.0.0/0"
],
"fromPort": -1,
"kind": "EGRESS",
"name": "out_all",
"protocol": "-1",
"toPort": -1
},
{
"cidr": [
"0.0.0.0/0"
],
"fromPort": 80,
"kind": "INGRESS",
"name": "http",
"protocol": "tcp",
"toPort": 80
},
{
"cidr": [
"0.0.0.0/0"
],
"fromPort": 443,
"kind": "INGRESS",
"name": "https",
"protocol": "tcp",
"toPort": 443
},
{
"cidr": [
"0.0.0.0/0"
],
"fromPort": 22,
"kind": "INGRESS",
"name": "ssh",
"protocol": "tcp",
"toPort": 22
}
],
"networks": [
......@@ -39,11 +74,20 @@
},
"infra_element_name": "vm1",
"name": "concrete_vm",
"ssh_key_file": "/home/user1/.ssh/openstack.key",
"ssh_user": "ubuntu",
"vm_flavor": "small",
"vm_key_name": "user1",
"vm_name": "nginx-host"
"os": "ubuntu-20.04.3",
"vm_Availability": 98,
"vm_Cost_Currency": 4.53,
"vm_Frequency_per_Core": 1500,
"vm_Instance_Storage": 40,
"vm_Memory": 0.5,
"vm_Optimized_for": "GEPU",
"vm_Region": "00EU",
"vm_Response_time_Virtual_Machine_Performance": 3,
"vm_Virtual_CPU_Cores": 1,
"vm_Zone": "IEEU",
"vm_flavor": "t2.nano",
"vm_provider_OU": "AMAZ",
"vm_public_IP_type": "IPV4"
}
]
},
......
---
input: ~
output: ~
engine: ansible
...
---
iac:
- terraform
- ansible
...
\ No newline at end of file
---
input: ~
output: ~
engine: terraform
...
......@@ -17,11 +17,6 @@ provider "openstack" {
insecure = true
}
resource "openstack_compute_keypair_v2" "user_key" {
name = "user1"
public_key = var.ssh_key
}
# Retrieve data
data "openstack_networking_network_v2" "external" {
name = "external"
......@@ -35,21 +30,43 @@ 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 = "cirros"
flavor_name = "m1.tiny"
key_pair = openstack_compute_keypair_v2.user_key.name
network {
port = openstack_networking_port_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
# Create ssh keys
resource "openstack_compute_keypair_v2" "user_key" {
name = "user1"
public_key = var.ssh_key
}
# Network creation
# 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 = " "
}
#### HTTP SUBNET ####
# Subnet configuration
# Create Subnet
resource "openstack_networking_subnet_v2" "nginx" {
name = "subnet-nginx"
network_id = openstack_networking_network_v2.generic.id
......@@ -57,6 +74,24 @@ resource "openstack_networking_subnet_v2" "nginx" {
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
......@@ -84,40 +119,3 @@ resource "openstack_compute_secgroup_v2" "ssh" {
cidr = "0.0.0.0/0"
}
}
#
# Create instance
#
resource "openstack_compute_instance_v2" "nginx" {
name = "nginx-host"
image_name = "cirros"
flavor_name = "m1.tiny"
key_pair = openstack_compute_keypair_v2.user_key.name
network {
port = openstack_networking_port_v2.nginx.id
}
}
# Create network 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
}
}
# 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
}
......@@ -17,11 +17,6 @@ provider "openstack" {
insecure = true
}
resource "openstack_compute_keypair_v2" "user_key" {
name = "user1"
public_key = var.ssh_key
}
# Retrieve data
data "openstack_networking_network_v2" "external" {
name = "external"
......@@ -37,9 +32,9 @@ data "openstack_networking_secgroup_v2" "default" {
}
# Create virtual machine
resource "openstack_compute_instance_v2" "vm1" {
name = "nginx-host"
image_name = "i1"
flavor_name = "small"
name = ""
image_name = "ubuntu-20.04.3"
flavor_name = "t2.nano"
key_pair = openstack_compute_keypair_v2.ssh_key.name
network {
port = openstack_networking_port_v2.net1.id
......@@ -48,8 +43,8 @@ resource "openstack_compute_instance_v2" "vm1" {
# Create ssh keys
resource "openstack_compute_keypair_v2" "ssh_key" {
name = "ubuntu"
public_key = "/home/user1/.ssh/openstack.key"
name = ""
public_key = ""
}
# Create floating ip
......@@ -103,3 +98,47 @@ resource "openstack_networking_router_interface_v2" "net1_router_interface" {
subnet_id = openstack_networking_subnet_v2.net1_subnet.id
}
resource "openstack_compute_secgroup_v2" "out_all" {
name = "out_all"
description = "Security group rule for port -1"
rule {
from_port = -1
to_port = -1
ip_protocol = "-1"
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"
}
}
......@@ -17,11 +17,6 @@ provider "openstack" {
insecure = true
}
resource "openstack_compute_keypair_v2" "user_key" {
name = "user1"
public_key = var.ssh_key
}
# Retrieve data
data "openstack_networking_network_v2" "external" {
name = "external"
......
resource "openstack_compute_secgroup_v2" "{{ name }}" {
name = "{{ name }}"
description = "Security group rule for port {{ from_port }}-{{ to_port }}"
description = "Security group rule for port {{ fromPort }}"
rule {
from_port = {{ fromPort }}
to_port = {{ toPort }}
ip_protocol = "{{ protocol }}"
cidr = [
{% for range in addressRanges %}
{{ range }},
{% endfor %}
]
cidr = {% for range in cidr %}"{{ range }}"{% endfor %}
}
}
\ No newline at end of file
# Create virtual machine
resource "openstack_compute_instance_v2" "{{ infra_element_name }}" {
name = "{{ vm_name }}"
image_name = "{{ i1.name }}"
image_name = "{{ os }}"
flavor_name = "{{ vm_flavor }}"
key_pair = openstack_compute_keypair_v2.{{ credentials }}.name
network {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment