Commit c9be5596 authored by Spiros Koulouzis's avatar Spiros Koulouzis

reorganize compose files

parent ca9c7832
...@@ -13,7 +13,7 @@ topology_template: ...@@ -13,7 +13,7 @@ topology_template:
properties: properties:
Environment_variables: Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
monitoring_server: SET_ITS_VALUE monitoring_server: monitoring_server
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
ports_mapping: ports_mapping:
scaling_mode: single scaling_mode: single
...@@ -36,15 +36,15 @@ topology_template: ...@@ -36,15 +36,15 @@ topology_template:
multicastAddrPort3: 3004 multicastAddrPort3: 3004
metrics: true metrics: true
multicastAddrIP: "225.2.2.0" multicastAddrIP: "225.2.2.0"
switcherOutAddrPort: SET_ITS_VALUE switcherOutAddrPort: 6000
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
machineip: switcher machineip: VideoSwitcher
videoHeight: 406 videoHeight: 406
waitingTime: 5 waitingTime: 5
multicastAddrPort: 3000 multicastAddrPort: 3000
statsdPort: 8125 statsdPort: 8125
camnumber: 4 camnumber: 4
switcherOutAddrIP: SET_ITS_VALUE switcherOutAddrIP: "226.2.2.2"
switcherREST: 8008 switcherREST: 8008
multicastAddrPort4: 3006 multicastAddrPort4: 3006
videoWidth: 720 videoWidth: 720
...@@ -60,19 +60,20 @@ topology_template: ...@@ -60,19 +60,20 @@ topology_template:
requirements: requirements:
- dependency: - dependency:
- VideoSwitcher - VideoSwitcher
- Monitoring_Adapter_v2
type: "Switch.nodes.Application.Container.Docker.MOG_InputDistributor" type: "Switch.nodes.Application.Container.Docker.MOG_InputDistributor"
properties: properties:
Environment_variables: Environment_variables:
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
statsdPort: 8125 statsdPort: 8125
multicastAddrPort: 3000 multicastAddrPort: 3006
inPort: 2000 inPort: 2000
videoWidth: 720 videoWidth: 720
metrics: true metrics: true
waitingTime: 5 waitingTime: 5
multicastAddrIP: "225.2.2.0" multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
machineip: InputDistributor machineip: InputDistributor4
videoHeight: 406 videoHeight: 406
ports_mapping: ports_mapping:
- "2006:2006/udp" - "2006:2006/udp"
...@@ -89,15 +90,15 @@ topology_template: ...@@ -89,15 +90,15 @@ topology_template:
type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2" type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2"
properties: properties:
Environment_variables: Environment_variables:
metrics: SET_ITS_VALUE metrics: true
machineip: SET_ITS_VALUE machineip: ProxyTranscoderOut
multicastAddrIP: SET_ITS_VALUE multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
statsdPort: SET_ITS_VALUE statsdPort: 8125
multicastAddrPort: SET_ITS_VALUE multicastAddrPort: 6000
videoWidth: SET_ITS_VALUE videoWidth: 720
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
videoHeight: SET_ITS_VALUE videoHeight: 406
ports_mapping: ports_mapping:
scaling_mode: single scaling_mode: single
ProxyTranscoder2: ProxyTranscoder2:
...@@ -112,15 +113,15 @@ topology_template: ...@@ -112,15 +113,15 @@ topology_template:
type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2" type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2"
properties: properties:
Environment_variables: Environment_variables:
metrics: SET_ITS_VALUE metrics: true
machineip: SET_ITS_VALUE machineip: ProxyTranscoder2
multicastAddrIP: SET_ITS_VALUE multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
statsdPort: SET_ITS_VALUE statsdPort: 8125
multicastAddrPort: SET_ITS_VALUE multicastAddrPort: 3002
videoWidth: SET_ITS_VALUE videoWidth: 720
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
videoHeight: SET_ITS_VALUE videoHeight: 406
ports_mapping: ports_mapping:
scaling_mode: single scaling_mode: single
InputDistributor1: InputDistributor1:
...@@ -145,7 +146,7 @@ topology_template: ...@@ -145,7 +146,7 @@ topology_template:
waitingTime: 5 waitingTime: 5
multicastAddrIP: "225.2.2.0" multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
machineip: InputDistributor machineip: InputDistributor1
videoHeight: 406 videoHeight: 406
ports_mapping: ports_mapping:
- "2000:2000/udp" - "2000:2000/udp"
...@@ -159,19 +160,20 @@ topology_template: ...@@ -159,19 +160,20 @@ topology_template:
requirements: requirements:
- dependency: - dependency:
- VideoSwitcher - VideoSwitcher
- Monitoring_Adapter_v2
type: "Switch.nodes.Application.Container.Docker.MOG_InputDistributor" type: "Switch.nodes.Application.Container.Docker.MOG_InputDistributor"
properties: properties:
Environment_variables: Environment_variables:
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
statsdPort: 8125 statsdPort: 8125
multicastAddrPort: 3000 multicastAddrPort: 3002
inPort: 2000 inPort: 2000
videoWidth: 720 videoWidth: 720
metrics: true metrics: true
waitingTime: 5 waitingTime: 5
multicastAddrIP: "225.2.2.0" multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
machineip: InputDistributor machineip: InputDistributor2
videoHeight: 406 videoHeight: 406
ports_mapping: ports_mapping:
- "2002:2002/udp" - "2002:2002/udp"
...@@ -185,19 +187,20 @@ topology_template: ...@@ -185,19 +187,20 @@ topology_template:
requirements: requirements:
- dependency: - dependency:
- VideoSwitcher - VideoSwitcher
- Monitoring_Adapter_v2
type: "Switch.nodes.Application.Container.Docker.MOG_InputDistributor" type: "Switch.nodes.Application.Container.Docker.MOG_InputDistributor"
properties: properties:
Environment_variables: Environment_variables:
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
statsdPort: 8125 statsdPort: 8125
multicastAddrPort: 3000 multicastAddrPort: 3004
inPort: 2000 inPort: 2000
videoWidth: 720 videoWidth: 720
metrics: true metrics: true
waitingTime: 5 waitingTime: 5
multicastAddrIP: "225.2.2.0" multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
machineip: InputDistributor machineip: InputDistributor3
videoHeight: 406 videoHeight: 406
ports_mapping: ports_mapping:
- "2004:2004/udp" - "2004:2004/udp"
...@@ -209,16 +212,18 @@ topology_template: ...@@ -209,16 +212,18 @@ topology_template:
repository: SWITCH_docker_hub repository: SWITCH_docker_hub
file: "mogpsantos/switchgui" file: "mogpsantos/switchgui"
requirements: requirements:
- dependency: null - dependency:
- VideoSwitcher
type: "Switch.nodes.Application.Container.Docker.LOKSORR_MOGFrontend" type: "Switch.nodes.Application.Container.Docker.LOKSORR_MOGFrontend"
properties: properties:
Environment_variables: Environment_variables:
ipPT1: SET_ITS_VALUE ipPT1: ProxyTranscoder1
ipPT2: SET_ITS_VALUE ipPT2: ProxyTranscoder2
ipPT3: SET_ITS_VALUE ipPT3: ProxyTranscoder3
ipPT4: SET_ITS_VALUE ipPT4: ProxyTranscoder4
ipPTout: ProxyTranscoderOut
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
ipVS: SET_ITS_VALUE ipVS: VideoSwitcher
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
ports_mapping: ports_mapping:
- "5050:80" - "5050:80"
...@@ -234,16 +239,17 @@ topology_template: ...@@ -234,16 +239,17 @@ topology_template:
type: "Switch.nodes.Application.Container.Docker.LOKSORR_OutputTranscoder" type: "Switch.nodes.Application.Container.Docker.LOKSORR_OutputTranscoder"
properties: properties:
Environment_variables: Environment_variables:
OutIP: SET_ITS_VALUE OutIP: "10.20.155.5"
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
statsdPort: SET_ITS_VALUE statsdPort: 8125
OutPort: SET_ITS_VALUE OutPort: 4000
machineip: OutputTranscoder
metrics: true metrics: true
multicastAddrIP: SET_ITS_VALUE multicastAddrIP: "226.2.2.2"
multicastAddrPortmulticastAddrIP: SET_ITS_VALUE multicastAddrPortmulticastAddrIP: 6000
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
videoWidth: SET_ITS_VALUE videoWidth: 720
videoHeight: SET_ITS_VALUE videoHeight: 406
ports_mapping: ports_mapping:
- "4000:4000" - "4000:4000"
scaling_mode: single scaling_mode: single
...@@ -259,15 +265,15 @@ topology_template: ...@@ -259,15 +265,15 @@ topology_template:
type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2" type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2"
properties: properties:
Environment_variables: Environment_variables:
metrics: SET_ITS_VALUE metrics: true
machineip: SET_ITS_VALUE machineip: ProxyTranscoder4
multicastAddrIP: SET_ITS_VALUE multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
statsdPort: SET_ITS_VALUE statsdPort: 8125
multicastAddrPort: SET_ITS_VALUE multicastAddrPort: 3006
videoWidth: SET_ITS_VALUE videoWidth: 720
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
videoHeight: SET_ITS_VALUE videoHeight: 406
ports_mapping: ports_mapping:
scaling_mode: single scaling_mode: single
ProxyTranscoder3: ProxyTranscoder3:
...@@ -282,15 +288,15 @@ topology_template: ...@@ -282,15 +288,15 @@ topology_template:
type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2" type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2"
properties: properties:
Environment_variables: Environment_variables:
metrics: SET_ITS_VALUE metrics: true
machineip: SET_ITS_VALUE machineip: ProxyTranscoder3
multicastAddrIP: SET_ITS_VALUE multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
statsdPort: SET_ITS_VALUE statsdPort: 8125
multicastAddrPort: SET_ITS_VALUE multicastAddrPort: 3004
videoWidth: SET_ITS_VALUE videoWidth: 720
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
videoHeight: SET_ITS_VALUE videoHeight: 406
ports_mapping: ports_mapping:
scaling_mode: single scaling_mode: single
monitoring_server: monitoring_server:
...@@ -350,15 +356,15 @@ topology_template: ...@@ -350,15 +356,15 @@ topology_template:
type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2" type: "Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2"
properties: properties:
Environment_variables: Environment_variables:
metrics: SET_ITS_VALUE metrics: true
machineip: SET_ITS_VALUE machineip: ProxyTranscoder1
multicastAddrIP: SET_ITS_VALUE multicastAddrIP: "225.2.2.0"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca" TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/237/tosca"
statsdPort: SET_ITS_VALUE statsdPort: 8125
multicastAddrPort: SET_ITS_VALUE multicastAddrPort: 3000
videoWidth: SET_ITS_VALUE videoWidth: 720
MONITORING_PROXY: "Monitoring Proxy" MONITORING_PROXY: "Monitoring Proxy"
videoHeight: SET_ITS_VALUE videoHeight: 406
ports_mapping: ports_mapping:
scaling_mode: single scaling_mode: single
artifact_types: artifact_types:
......
...@@ -134,7 +134,7 @@ public class ConfigurationService { ...@@ -134,7 +134,7 @@ public class ConfigurationService {
Matcher match = p.matcher(ymlStr); Matcher match = p.matcher(ymlStr);
while (match.find()) { while (match.find()) {
String line = match.group(); String line = match.group();
if (!line.contains("\"") || line.contains("'")) { if (!line.contains("\"") || !line.contains("'")) {
String number = line.split(": ")[1]; String number = line.split(": ")[1];
ymlStr = ymlStr.replaceAll(number, "\'" + number + "\'"); ymlStr = ymlStr.replaceAll(number, "\'" + number + "\'");
} }
...@@ -155,7 +155,7 @@ public class ConfigurationService { ...@@ -155,7 +155,7 @@ public class ConfigurationService {
match = p.matcher(ymlStr); match = p.matcher(ymlStr);
while (match.find()) { while (match.find()) {
String line = match.group(); String line = match.group();
if (!line.contains("\"") || line.contains("'")) { if (!line.contains("\"") || !line.contains("'")) {
String memory = line.split(":")[1]; String memory = line.split(":")[1];
memory = memory.replaceAll("}", "").trim(); memory = memory.replaceAll("}", "").trim();
ymlStr = ymlStr.replaceAll(memory, '\'' + memory + '\''); ymlStr = ymlStr.replaceAll(memory, '\'' + memory + '\'');
......
...@@ -82,23 +82,29 @@ def handle_delivery(message): ...@@ -82,23 +82,29 @@ def handle_delivery(message):
def test_local(): def test_local():
home = expanduser("~") home = expanduser("~")
transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/mog_tosca_v1.yml") transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/MOG/mog_tosca_v1.yml")
compose = transformer.getnerate_compose() compose = transformer.getnerate_compose()
print yaml.dump(compose) print yaml.dump(compose)
response = {}
current_milli_time = lambda: int(round(time.time() * 1000))
response["creationDate"] = current_milli_time()
response["parameters"] = []
parameter = {} with open(home+'/Downloads/docker-compose.yml', 'w') as outfile:
parameter['value'] = str(yaml.dump(compose)) yaml.dump(compose, outfile, default_flow_style=False)
parameter['name'] = 'docker-compose.yml'
parameter['encoding'] = 'UTF-8' # response = {}
response["parameters"].append(parameter) # current_milli_time = lambda: int(round(time.time() * 1000))
print response # response["creationDate"] = current_milli_time()
# response["parameters"] = []
#
# parameter = {}
# parameter['value'] = str(yaml.dump(compose))
# parameter['name'] = 'docker-compose.yml'
# parameter['encoding'] = 'UTF-8'
# response["parameters"].append(parameter)
# print response
if __name__ == "__main__": if __name__ == "__main__":
# test_local() if(sys.argv[1] == "test_local"):
test_local()
else:
print sys.argv print sys.argv
channel = init_chanel(sys.argv) channel = init_chanel(sys.argv)
global queue_name global queue_name
......
...@@ -85,7 +85,7 @@ class DockerComposeTransformer: ...@@ -85,7 +85,7 @@ class DockerComposeTransformer:
ports_mappings = properties['ports_mapping'] ports_mappings = properties['ports_mapping']
if ports_mappings: if ports_mappings:
for port_map_key in ports_mappings: for port_map_key in ports_mappings:
port_map = {} port_map = ''
if isinstance(ports_mappings,dict): if isinstance(ports_mappings,dict):
if 'host_port' in ports_mappings[port_map_key]: if 'host_port' in ports_mappings[port_map_key]:
host_port = ports_mappings[port_map_key]['host_port'] host_port = ports_mappings[port_map_key]['host_port']
...@@ -98,13 +98,15 @@ class DockerComposeTransformer: ...@@ -98,13 +98,15 @@ class DockerComposeTransformer:
if not isinstance(container_port, (int, long, float, complex)) and '$' in container_port: if not isinstance(container_port, (int, long, float, complex)) and '$' in container_port:
container_port_var = container_port.replace('${','').replace('}','') container_port_var = container_port.replace('${','').replace('}','')
container_port = properties[container_port_var] container_port = properties[container_port_var]
port_map[host_port] = container_port # port_map[host_port] = container_port
port_map = str(host_port)+':'+str(container_port)
port_maps.append(port_map) port_maps.append(port_map)
elif isinstance(ports_mappings,list): elif isinstance(ports_mappings,list):
for mapping in ports_mappings: for mapping in ports_mappings:
host_port = mapping.split(":")[0] host_port = mapping.split(":")[0]
container_port = mapping.split(":")[1] container_port = mapping.split(":")[1]
port_map[host_port] = container_port # port_map[host_port] = container_port
port_map = str(host_port)+':'+str(container_port)
port_maps.append(port_map) port_maps.append(port_map)
if 'in_ports' in properties: if 'in_ports' in properties:
ports_mappings = properties['in_ports'] ports_mappings = properties['in_ports']
...@@ -120,7 +122,8 @@ class DockerComposeTransformer: ...@@ -120,7 +122,8 @@ class DockerComposeTransformer:
if protocol: if protocol:
container_port=container_port+'/'+protocol container_port=container_port+'/'+protocol
if container_port: if container_port:
port_map[host_port] = container_port # port_map[host_port] = container_port
port_map = str(host_port)+':'+str(container_port)
port_maps.append(port_map) port_maps.append(port_map)
if 'out_ports' in properties: if 'out_ports' in properties:
ports_mappings = properties['out_ports'] ports_mappings = properties['out_ports']
...@@ -133,7 +136,8 @@ class DockerComposeTransformer: ...@@ -133,7 +136,8 @@ class DockerComposeTransformer:
protocol = ports_mappings[port_map_key]['protocol'] protocol = ports_mappings[port_map_key]['protocol']
if protocol: if protocol:
container_port=container_port+'/'+protocol container_port=container_port+'/'+protocol
port_map[host_port] = container_port # port_map[host_port] = container_port
port_map = str(host_port)+':'+str(container_port)
port_maps.append(port_map) port_maps.append(port_map)
return port_maps return port_maps
...@@ -157,7 +161,7 @@ class DockerComposeTransformer: ...@@ -157,7 +161,7 @@ class DockerComposeTransformer:
docker_types = self.get_docker_types() docker_types = self.get_docker_types()
node_templates = self.get_node_templates() node_templates = self.get_node_templates()
services = {} services = {}
# services['version'] = '2' services['version'] = '2'
services['services'] = {} services['services'] = {}
all_volumes = [] all_volumes = []
for node_template_key in node_templates: for node_template_key in node_templates:
......
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