Commit c9be5596 authored by Spiros Koulouzis's avatar Spiros Koulouzis

reorganize compose files

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