Commit 64511f5b authored by Spiros Koulouzis's avatar Spiros Koulouzis

change env from list to map

parent f697af80
version: '3'
services:
server:
image: salmant/ul_monitoring_server_container_image2
ports:
- "8080:8080"
- "4242:4242"
- "4245:4245"
- "7199:7199"
- "7000:7000"
- "7001:7001"
- "9160:9160"
- "9042:9042"
- "8012:8012"
- "61621:61621"
environment:
- "MONITORING_SERVER=server"
agent:
image: salmant/monitoring_agent
deploy: {replicas: 10}
depends_on: [server]
command: --monitoringServerIP=server
\ No newline at end of file
AlertChecker:
container_name: alerter_AlertChecker
environment: ['TOSCA=http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca',
MONITORING_PROXY=Monitoring Proxy]
image: beia/alerter
Graphite:
container_name: graphite_Graphite
environment: [Environment=SET_ITS_VALUE, Environment=SET_ITS_VALUE, Environment=SET_ITS_VALUE,
TOSCA=SET_ITS_VALUE, TOSCA=SET_ITS_VALUE, TOSCA=SET_ITS_VALUE, MONITORING_PROXY=SET_ITS_VALUE,
MONITORING_PROXY=SET_ITS_VALUE, MONITORING_PROXY=SET_ITS_VALUE]
image: vladwing/graphite
SIPNotifier:
container_name: sip_notifier_SIPNotifier
environment: ['TOSCA=http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca',
MONITORING_PROXY=Monitoring Proxy]
image: beia/sip_notifier
version: '2'
\ No newline at end of file
---
topology_template:
node_templates:
"Graphite":
artifacts:
graphite_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: vladwing/graphite
requirements: []
type: 'Switch.nodes.Application.Container.Docker.VLAD_Graphite'
properties:
Environment_variables:
Environment:
string_2: SET_ITS_VALUE
string_0: SET_ITS_VALUE
string_1: SET_ITS_VALUE
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca"
MONITORING_PROXY: "Monitoring Proxy"
scaling_mode: single
"SIPNotifier":
artifacts:
sipnotifier_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/sip_notifier
requirements:
- Graphite
type: 'Switch.nodes.Application.Container.Docker.VLAD_SIPNotifier'
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca"
MONITORING_PROXY: "Monitoring Proxy"
scaling_mode: single
"AlertChecker":
artifacts:
alertchecker_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/alerter
requirements:
- Graphite
type: 'Switch.nodes.Application.Container.Docker.VLAD_AlertChecker'
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca"
MONITORING_PROXY: "Monitoring Proxy"
scaling_mode: single
artifact_types:
tosca.artifacts.Deployment.Image.Container.Docker:
derived_from: tosca.artifacts.Deployment.Image
description: Version 3
node_types:
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_ProxyTranscoder:
properties:
multicastAddrPort:
default: 3000
type: Switch.datatypes.port
multicastAddrIP:
default: 225.2.2.0
type: Switch.datatypes.Network.Multicast
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_THE_IMPALER_RTUSensorDataAcquisition:
properties:
name:
required: 'false'
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_InputDistributor:
properties:
inPort:
default: 2000
type: Switch.datatypes.port
derived_from: Switch.nodes.Application.Container.Docker
tosca.groups.Root: {}
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_InputDistributor.Cardiff:
properties:
multicastAddrPort:
default: 3000
type: Switch.datatypes.port
multicastAddrIP:
default: 225.2.2.0
type: Switch.datatypes.Network.Multicast
inPort:
default: 2000
type: Switch.datatypes.port
waitingTime:
default: 5
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.LOKSORR_SomethingStrange:
artifacts:
somethingstrange_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: matej/somethingStrange
properties:
das:
default: das
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_Gateway:
properties:
Name:
default: BEIA_Gateway
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_Acquisition:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_Switcher.Cardiff:
properties:
waitingTime:
default: 5
type: integer
multicastAddrIP:
default: 225.2.2.0
type: Switch.datatypes.Network.Multicast
switcherREST:
default: switcherREST
type: Switch.datatypes.port
switcherOutAddrPort:
default: 6000
type: Switch.datatypes.port
multicastAddrIP2:
default: 225.2.2.2
type: Switch.datatypes.Network.Multicast
switcherOutAddrIP:
default: 226.2.2.2
type: Switch.datatypes.Network.Multicast
multicastAddrPort:
default: 3000
type: Switch.datatypes.port
videoWidth:
default: 176
type: integer
multicastAddrPort2:
default: 3002
type: Switch.datatypes.port
videoHeight:
default: 100
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker:
properties:
in_ports:
entry_schema:
type: Switch.datatypes.port
required: 'false'
type: map
dockers:
required: 'false'
type: string
QoS:
required: 'false'
type: Switch.datatypes.QoS.AppComponent
name:
required: 'false'
type: string
out_ports:
entry_schema:
type: Switch.datatypes.port
required: 'false'
type: map
ports_mapping:
entry_schema:
type: Switch.datatypes.port_mapping
type: map
scaling_mode:
required: 'false'
type: string
ethernet_port:
entry_schema:
type: Switch.datatypes.ethernet_port
required: 'false'
type: list
derived_from: tosca.nodes.Container.Application
Switch.nodes.Application.Container.Docker.BEIA_RTUSensorDataAcquisition:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Compute:
artifacts:
gateway_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: /???
derived_from: tosca.nodes.Compute
Switch.nodes.Application.Container.Docker.BEIA_V1_NotificationServer:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_AlertChecker:
artifacts:
sipnotifier_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/sip_notifier
derived_from: Switch.nodes.Application.Container.Docker
switch.Component.Component.Docker:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Network:
derived_from: tosca.nodes.network.Network
Switch.nodes.EventListener:
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.LOKSORR_A:
artifacts:
a_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: sad
properties:
dass:
entry_schema:
type: string
type: map
das:
default: dsasd
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_DatabaseServer:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.VirtualNetwork:
artifacts:
switcher.cardiff_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file:
properties:
subnet:
default: 192.168.10.0
type: string
netmask:
default: 255.255.255.0
type: string
name:
type: string
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.VLAD_BEIAComponent:
artifacts:
beiacomponent_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/hang
properties:
Environment:
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_RTUSensorDataManagement:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.MonitoringAgent:
properties:
agent_id:
default:
type: string
probes:
entry_schema:
type: Switch.datatypes.monitoring.probe
type: map
derived_from: tosca.nodes.Root
Switch.nodes.AdaptationPolicy:
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.VLAD_Alterter:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_Graphite:
artifacts:
webui_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/nginx
properties:
Environment:
entry_schema:
type: string
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_Input:
properties:
port2:
default: 24
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_Alerter:
properties:
Environment:
entry_schema:
type: string
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_Monitoring:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS.MOG_Input_Distributor:
properties:
Input_RTP_TS_Port:
default: 2000
type: string
Waiting_Time:
default: 5
type: string
Output_Uncompressed_Video_Multicast_Address:
default: 225.2.2.0
type: string
Output_Uncompressed_Video_Multicast_Port:
default: 3000 waiting time Waiting time (in seconds) for Input Distributor
to receive TS stream 5 switcherOutAddrIP Multicast IP address where Video
Switcher
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Component:
derived_from: tosca.nodes.Root
Switch.nodes.Constraint:
requirements:
- monitor_server_endpoint:
node: Switch.nodes.Application.Container.Docker.MonitoringServer
capability: tosca.capabilities.Node
relationship: tosca.relationships.DependsOn
properties:
QoS:
type: Switch.datatypes.QoS.AppComponent
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS.MOG_Switcher:
properties:
Input_A_Uncompressed_Video_Multicast_Address:
default: 225.2.2.0
type: string
Input_Video_Width:
default: 176
type: string
Input_B_Uncompressed_Video_Multicast_Port:
default: 3002
type: string
Input_B_Uncompressed_Video_Multicast_Address:
default: 225.2.2.1
type: string
port:
default: 23
type: integer
Output_Uncompressed_Video_Multicast_Address:
default: 226.2.2.2
type: string
Output_REST_PORT:
default: 8008
type: string
Output_Uncompressed_Video_Multicast_Port:
default: 6000
type: string
Input_Video_Height:
default: 100
type: string
Input_A_Uncompressed_Video_Multicast_Port:
default: 3000
type: string
Waiting_Time:
default: 5
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_RTUSensorDataAcquisitions:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.LOKSORR_Blabla:
artifacts:
blabla_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: matej/biba
properties:
da:
default: sda
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_SIPNotifier:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_RTUSensorData:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_OutputTranscoder.Cardiff:
properties:
OutIP:
default: 192.168.1.194
type: Switch.datatypes.Network.Multicast
videoWidth:
default: 176
type: integer
OutPort:
default: 4000
type: Switch.datatypes.port
videoHeight:
default: 100
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.MOG_InputDistributor:
properties:
waitingTime:
default: 5
type: integer
multicastAddrIP:
default: 255.2.2.0
type: string
multicastAddrPort:
default: 3000
type: integer
videoWidth:
default: 170
type: integer
inPort:
default: 2000
type: integer
videoHeight:
default: 100
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Connection:
properties:
source:
type: Switch.datatypes.Application.Connection.EndPoint
bandwidth:
type: integer
multicast:
type: Switch.datatypes.Network.Multicast
jitter:
required: 'false'
type: integer
target:
type: Switch.datatypes.Application.Connection.EndPoint
latency:
required: 'false'
type: integer
QoS:
type: Switch.datatypes.QoS.AppComponent
derived_from: tosca.nodes.Root
Switch.nodes.Requirement:
properties:
host:
type: Switch.datatypes.hw.host
os:
type: Switch.datatypes.hw.os
derived_from: tosca.nodes.Root
Switch.nodes.ExternalComponent:
derived_from: tosca.nodes.Root
Switch.nodes.DST:
properties:
dave:
type: string
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.LOKSORR_Bb:
properties:
bb:
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_NotificationServer:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_RTUSensorDataAcquisition:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.MonitoringServer:
properties:
ports_mapping:
entry_schema:
type: Switch.datatypes.port_mapping
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.UL_JitsiMeet_docker:
properties:
ips:
type: string
deploy:
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.LOKSORR_MatejsMagic:
artifacts:
matejsmagic_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: matej/magic
properties:
das:
default: das
required: 'false'
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_DataCollector:
artifacts:
data_collector_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/data_collector
properties:
Environment:
entry_schema:
type: string
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_BEIAGUI:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_WebUI:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_TelemetryGateway:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_Dashboard:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.MessagePasser:
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.BEIA_DB:
derived_from: Switch.nodes.Application.Container.Docker
repositories:
SWITCH_docker_hub:
url: https://github.com/switch-project
credential:
token_type: X-Auth-Token
token: 604bbe45ac7143a79e14f3158df67091
protocol: xauth
description: switch repository in GitHub
data_types:
Switch.datatypes.monitoring.metric.threshold:
properties:
operator:
type: string
value:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.port:
properties:
type:
type: string
port:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.Application.Connection.EndPoint:
properties:
netmask:
type: string
component_name:
type: string
port_name:
type: string
address:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.monitoring.probe:
properties:
active:
type: boolean
path:
required: 'false'
type: string
static:
type: boolean
name:
type: string
metrics:
entry_schema:
type: Switch.datatypes.monitoring.metric
type: map
derived_from: tosca.datatypes.Root
Switch.datatypes.hw.host:
properties:
cpu_frequency:
type: float
mem_size:
type: integer
num_cpus:
type: integer
disk_size:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.ethernet_port:
properties:
subnet_name:
type: string
name:
type: string
address:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.hw.os:
properties:
os_version:
type: string
distribution:
type: string
type:
type: string
architecture:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.QoS.AppComponent:
properties:
response_time:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.Application.Connection.Multicast:
properties:
multicastAddrPort:
type: string
multicastAddrIP:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.Network.Multicast:
properties:
multicastAddrPort:
type: string
multicastAddrIP:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.port_mapping:
properties:
host_port:
type: integer
container_port:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.monitoring.metric:
properties:
thresholds:
entry_schema:
type: Switch.datatypes.monitoring.metric.threshold
required: 'false'
type: map
type:
type: string
name:
type: string
unit:
required: 'false'
type: string
derived_from: tosca.datatypes.Root
tosca_definitions_version: tosca_simple_yaml_1_0
......@@ -82,7 +82,7 @@ def handle_delivery(message):
def test_local():
home = expanduser("~")
transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/Matej.BEIA.yml")
transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/BEIAv3.yml")
compose = transformer.getnerate_compose()
print yaml.dump(compose)
response = {}
......
......@@ -63,9 +63,16 @@ class DockerComposeTransformer:
for prop in properties:
if prop == 'Environment_variables' or prop == 'Live_variables' or prop =='Environment':
for var in properties[prop]:
if 'Environment' in properties[prop]:
for key in properties[prop]['Environment']:
environment ={}
environment[var] = properties[prop][var]
environment[str(key)] = str(properties[prop]['Environment'][key])
environments.append(environment)
else:
environment ={}
environment[str(var)] = str(properties[prop][var])
environments.append(environment)
# environments.append(str(var)+"="+str(properties[prop][var]))
# if properties[prop] and not isinstance(properties[prop],dict):
# environment.append(prop+"="+str(properties[prop]))
return environments
......@@ -140,7 +147,7 @@ class DockerComposeTransformer:
docker_types = self.get_docker_types()
node_templates = self.get_node_templates()
services = {}
services['version'] = '2'
# services['version'] = '2'
services['services'] = {}
all_volumes = []
for node_template_key in node_templates:
......@@ -162,7 +169,9 @@ class DockerComposeTransformer:
properties = self.get_properties(node_templates[node_template_key])
environment = self.get_enviroment_vars(properties)
if environment:
service['environment'] = environment
for env in environment:
service['environment'] = env
# service['environment'] = environment
port_maps = self.get_port_map(properties)
if port_maps:
......
......@@ -99,14 +99,14 @@ def handle_delivery(message):
return json.dumps(response)
if __name__ == "__main__":
# home = expanduser("~")
# planner = DumpPlanner(home+"/workspace/DRIP/docs/input_tosca_files/BEIA_cardif2.yml")
# print planner.plan()
logger.info("Input args: " + sys.argv[0] + ' ' + sys.argv[1] + ' ' + sys.argv[2])
channel = init_chanel(sys.argv)
global queue_name
queue_name = sys.argv[2]
start(channel)
home = expanduser("~")
planner = DumpPlanner(home+"/workspace/DRIP/docs/input_tosca_files/BEIAv3.yml")
print planner.plan()
# logger.info("Input args: " + sys.argv[0] + ' ' + sys.argv[1] + ' ' + sys.argv[2])
# channel = init_chanel(sys.argv)
# global queue_name
# queue_name = sys.argv[2]
# start(channel)
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment