diff options
author | Idan Amit <ia096e@intl.att.com> | 2017-12-29 09:40:43 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-12-31 08:51:03 +0000 |
commit | 2c285722c35d8ee7fd6c9085c8e60f0fa87d5761 (patch) | |
tree | b99164f8030c843091088a68a5638f9d9d1d80dc | |
parent | 0195e726cae3f5267dd3be69e089bbbeb4ad5f09 (diff) |
SDC Designers Integration - Part 1
Finished first part of designers integration
Added templated configuration file
Added tests
Change-Id: I76e8b413063b939e1eb58da4a5502c4b526168f2
Issue-ID: SDC-687
Signed-off-by: Idan Amit <ia096e@intl.att.com>
17 files changed, 411 insertions, 18 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java new file mode 100644 index 0000000000..cadaf19e96 --- /dev/null +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java @@ -0,0 +1,78 @@ +package org.openecomp.sdc.fe.impl; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.openecomp.sdc.fe.config.ConfigurationManager; +import org.openecomp.sdc.fe.config.DesignersConfiguration; +import org.openecomp.sdc.fe.config.DesignersConfiguration.Designer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class DesignerStatusBL { + + private static Logger log = LoggerFactory.getLogger(DesignerStatusBL.class.getName()); + private static Gson gson = new GsonBuilder().setPrettyPrinting().create(); + private CloseableHttpClient client = null; + + public DesignerStatusBL() { + this.client = HttpClients.createDefault(); + } + + public DesignerStatusBL(CloseableHttpClient client) { + this.client = client; + + } + + public String checkDesinerListAvailability() { + String result = null; + + DesignersConfiguration designersConfiguarion = ConfigurationManager.getConfigurationManager() + .getDesignersConfiguration(); + + if (designersConfiguarion == null || designersConfiguarion.getDesignersList() == null) { + log.warn("Configuration of type {} was not found", DesignersConfiguration.class); + } else { + log.debug("The value returned from getConfig is {}", designersConfiguarion); + + Map<String, Designer> avaiableDesignersMap = new HashMap<String, Designer>(); + + designersConfiguarion.getDesignersList().forEach((key, value) -> { + if (CheckDesignerAvailabilty(value)) { + avaiableDesignersMap.put(key, value); + } + + }); + result = gson.toJson(avaiableDesignersMap); + } + return result; + } + + private boolean CheckDesignerAvailabilty(Designer designer) { + + StringBuilder requestString = new StringBuilder(); + boolean result = false; + + requestString.append(designer.getDesignerProtocol()).append("://").append(designer.getDesignerHost()).append(":") + .append(designer.getDesignerPort()).append(designer.getDesignerPath()); + + HttpHead head = new HttpHead(requestString.toString()); + + try (CloseableHttpResponse response = this.client.execute(head)) { + result = response != null && response.getStatusLine().getStatusCode() == 200; + } catch (IOException e) { + log.debug("The designer {} is offline", designer); + } + + return result; + } + +} diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java index b132c46866..ea67efbc7e 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java @@ -30,6 +30,7 @@ import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.listener.AppContextListener; import org.openecomp.sdc.fe.config.ConfigurationManager; +import org.openecomp.sdc.fe.impl.DesignerStatusBL; import org.openecomp.sdc.fe.monitoring.FeMonitoringService; import org.openecomp.sdc.fe.servlets.HealthCheckService; import org.slf4j.Logger; @@ -48,6 +49,9 @@ public class FEAppContextListener extends AppContextListener implements ServletC log.debug("loading configuration from configDir:{} appName:{}", ExternalConfiguration.getConfigDir(), ExternalConfiguration.getAppName()); context.getServletContext().setAttribute(Constants.CONFIGURATION_MANAGER_ATTR, configurationManager); + + DesignerStatusBL dsbl = new DesignerStatusBL(); + context.getServletContext().setAttribute(Constants.DESIGNER_BL_COMPONENT, dsbl); // Health Check service HealthCheckService hcs = new HealthCheckService(context.getServletContext()); diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java index b8d623b72e..bcaf504497 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java @@ -33,11 +33,13 @@ import javax.ws.rs.container.TimeoutHandler; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.servlets.BasicServlet; import org.openecomp.sdc.fe.config.Configuration; +import org.openecomp.sdc.fe.impl.DesignerStatusBL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,11 +49,12 @@ import org.slf4j.LoggerFactory; @Path("/config") public class ConfigServlet extends BasicServlet { + private static final long serialVersionUID = 1L; private static Logger log = LoggerFactory.getLogger(ConfigServlet.class.getName()); - @GET - @Path("/get") - @Produces(MediaType.APPLICATION_JSON) + //@GET + //@Path("/get") + //@Produces(MediaType.APPLICATION_JSON) public String getConfig(@Context final HttpServletRequest request) { String result = null; @@ -82,8 +85,8 @@ public class ConfigServlet extends BasicServlet { } - @GET - @Path("/asyncget") + //@GET + //@Path("/asyncget") public void asyncGet(@Suspended final AsyncResponse asyncResponse) { asyncResponse.setTimeoutHandler(new TimeoutHandler() { @@ -111,4 +114,19 @@ public class ConfigServlet extends BasicServlet { }).start(); } + @GET + @Path("/ui/designers") + @Produces(MediaType.APPLICATION_JSON) + public Response getDesignersConfiguration(@Context final HttpServletRequest request) { + String result = null; + + ServletContext context = request.getSession().getServletContext(); + + DesignerStatusBL designerStatusBL = (DesignerStatusBL) context.getAttribute(Constants.DESIGNER_BL_COMPONENT); + + result = designerStatusBL.checkDesinerListAvailability(); + + return Response.status(Status.OK).entity(result).build(); + + } } diff --git a/catalog-fe/src/main/resources/config/designers-configuration.yaml b/catalog-fe/src/main/resources/config/designers-configuration.yaml new file mode 100644 index 0000000000..c8c041b975 --- /dev/null +++ b/catalog-fe/src/main/resources/config/designers-configuration.yaml @@ -0,0 +1,13 @@ +designersList: + DCAE: + displayName: DCAE + designerHost: 192.168.50.5 + designerPort: 8080 + designerPath: "/dcae" + designerProtocol: http + WORKFLOW: + displayName: WORKFLOW + designerHost: 192.168.50.5 + designerPort: 9527 + designerPath: "" + designerProtocol: http
\ No newline at end of file diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java new file mode 100644 index 0000000000..0ad233fd6d --- /dev/null +++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java @@ -0,0 +1,110 @@ +package org.openecomp.sdc.fe.servlets; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.apache.http.StatusLine; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.impl.client.CloseableHttpClient; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.fe.config.ConfigurationManager; +import org.openecomp.sdc.fe.config.DesignersConfiguration; +import org.openecomp.sdc.fe.config.DesignersConfiguration.Designer; +import org.openecomp.sdc.fe.impl.DesignerStatusBL; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class DesignerStatusBLTest { + + final static CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class); + DesignerStatusBL designerStatusBL = new DesignerStatusBL(httpClient); + private static Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + final static ConfigurationManager configurationManager = Mockito.mock(ConfigurationManager.class); + final static DesignersConfiguration designersConfiguraiton = Mockito.mock(DesignersConfiguration.class); + final static Designer offlineDesigner = new Designer(); + final static Designer onlineDesinger = new Designer(); + final static CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class); + final static StatusLine statusLine = Mockito.mock(StatusLine.class); + final static Map<String, Designer> testDesignersList = new HashMap<String, Designer>(); + + final static String offlineDesignerDisplayName = "offlineDesigner"; + final static String offlineDesignerHost = "192.168.10.1"; + final static int offlineDesignerPort = 1000; + final static String offlineDesignerPath = "/offline"; + final static String offlineDesignerProtocol = "http"; + + final static String onlineDesignerDisplayName = "onlineDesigner"; + final static String onlineDesignerHost = "192.168.20.2"; + final static int onlineDesignerPort = 2000; + final static String onlineDesignerPath = "/online"; + final static String onlineDesignerProtocol = "http"; + + StringBuilder offlineRequestString = new StringBuilder(); + StringBuilder onlineRequestString = new StringBuilder(); + + @BeforeClass + public static void beforeClass() { + ConfigurationManager.setTestInstance(configurationManager); + when(configurationManager.getDesignersConfiguration()).thenReturn(designersConfiguraiton); + + offlineDesigner.setDisplayName(offlineDesignerDisplayName); + offlineDesigner.setDesignerHost(offlineDesignerHost); + offlineDesigner.setDesignerPort(offlineDesignerPort); + offlineDesigner.setDesignerPath(offlineDesignerPath); + offlineDesigner.setDesignerProtocol(offlineDesignerProtocol); + + StringBuilder offlineRequestString = new StringBuilder(); + offlineRequestString.append(offlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":") + .append(offlineDesignerPort).append(offlineDesignerPath); + + onlineDesinger.setDisplayName(onlineDesignerDisplayName); + onlineDesinger.setDesignerHost(onlineDesignerHost); + onlineDesinger.setDesignerPort(onlineDesignerPort); + onlineDesinger.setDesignerPath(onlineDesignerPath); + onlineDesinger.setDesignerProtocol(onlineDesignerProtocol); + + StringBuilder onlineRequestString = new StringBuilder(); + onlineRequestString.append(onlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":") + .append(offlineDesignerPort).append(offlineDesignerPath); + + } + + @Test + public void TestOfflineDesignerNotBeingReturnedWhenCallingCheckDesinerListAvailability() throws ClientProtocolException, IOException { + testDesignersList.put("offlineDesigner", offlineDesigner); + when(designersConfiguraiton.getDesignersList()).thenReturn(testDesignersList); + + when(statusLine.getStatusCode()).thenReturn(404); + when(httpResponse.getStatusLine()).thenReturn(statusLine); + when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse); + + assertTrue(designerStatusBL.checkDesinerListAvailability().equals("{}")); + + } + + @Test + public void TestOnlineDesignerNotBeingReturnedWhenCallingCheckDesinerListAvailability() throws ClientProtocolException, IOException { + testDesignersList.put("onlineDesigner", onlineDesinger); + when(designersConfiguraiton.getDesignersList()).thenReturn(testDesignersList); + + when(statusLine.getStatusCode()).thenReturn(200); + when(httpResponse.getStatusLine()).thenReturn(statusLine); + when(httpClient.execute(Mockito.any())).thenReturn(httpResponse); + + String result = gson.toJson(testDesignersList); + + assertTrue(designerStatusBL.checkDesinerListAvailability().equals(result)); + + } + +} diff --git a/catalog-ui/configurations/dev.js b/catalog-ui/configurations/dev.js index 8367963adf..bde0d1e614 100644 --- a/catalog-ui/configurations/dev.js +++ b/catalog-ui/configurations/dev.js @@ -26,6 +26,7 @@ const SDC_CONFIG = { "GET_resource_interface_artifact": "/v1/catalog/:type/:entityId/standard/:operation/artifacts/:id", "GET_resource_api_artifact": "/v1/catalog/:type/:entityId/artifacts/api/:id", "GET_configuration_ui": "/v1/configuration/ui", + "GET_designers_configuration": "/config/ui/designers", "GET_resource_validate_name": "/v1/catalog/resources/validate-name/:name", "GET_activity_log": "/v1/catalog/audit-records/:type/:id", "GET_service": "/v1/catalog/services/:id", @@ -46,6 +47,7 @@ const SDC_CONFIG = { "GET_lifecycle_state_CERTIFICATIONREQUEST":"lifecycleState/CERTIFICATIONREQUEST", "GET_lifecycle_state_UNDOCHECKOUT":"lifecycleState/UNDOCHECKOUT", "root": "/sdc1/feProxy/rest", + "no_proxy_root": "/sdc1/rest", "PUT_service": "/v1/catalog/services/:id/metadata", "GET_download_artifact": "/v1/catalog/", "GET_SDC_Version": "/version", diff --git a/catalog-ui/src/app/models/app-config.ts b/catalog-ui/src/app/models/app-config.ts index 40eb18b8b4..556603d4ab 100644 --- a/catalog-ui/src/app/models/app-config.ts +++ b/catalog-ui/src/app/models/app-config.ts @@ -7,9 +7,9 @@ * 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. @@ -53,6 +53,7 @@ export interface IApi { GET_resource_artifact_types:string; GET_activity_log:string; GET_configuration_ui:string; + GET_designers_configuration:string; GET_service:string; GET_ecomp_menu_items:string; GET_service_validate_name:string; @@ -71,6 +72,7 @@ export interface IApi { GET_lifecycle_state_CERTIFICATIONREQUEST:string; GET_lifecycle_state_UNDOCHECKOUT:string; root:string; + no_proxy_root:string; PUT_service:string; GET_download_artifact:string; GET_SDC_Version:string; diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts index 291768a500..7108be93f9 100644 --- a/catalog-ui/src/app/ng2/app.module.ts +++ b/catalog-ui/src/app/ng2/app.module.ts @@ -7,9 +7,9 @@ * 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. @@ -50,7 +50,10 @@ import { TranslationServiceConfig } from "./config/translation.service.config"; export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); export function configServiceFactory(config:ConfigService) { - return () => config.loadValidationConfiguration(); + return () => { + config.loadValidationConfiguration(); + config.loadDesignersConfiguration(); + } } diff --git a/catalog-ui/src/app/ng2/services/config.service.ts b/catalog-ui/src/app/ng2/services/config.service.ts index 9bb7b7a075..1c0ee18d33 100644 --- a/catalog-ui/src/app/ng2/services/config.service.ts +++ b/catalog-ui/src/app/ng2/services/config.service.ts @@ -7,9 +7,9 @@ * 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. @@ -26,6 +26,7 @@ import { Injectable, Inject } from '@angular/core'; import { Http, Response } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import {IAppConfigurtaion, ValidationConfiguration, Validations} from "app/models"; +import {IApi} from "app/models/app-config"; import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @Injectable() @@ -33,9 +34,11 @@ export class ConfigService { private baseUrl; public configuration: IAppConfigurtaion; + public api:IApi; constructor(private http: Http, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { - this.baseUrl = this.sdcConfig.api.root + this.sdcConfig.api.component_api_root; + this.api = this.sdcConfig.api; + this.baseUrl = this.api.root + this.api.component_api_root; } loadValidationConfiguration(): Promise<ValidationConfiguration> { @@ -45,7 +48,7 @@ export class ConfigService { ValidationConfiguration.validation = validationData; }).catch((ex) => { console.error('Error loading validation.json configuration file, using fallback data', ex); - + let fallback:Validations = { "propertyValue": { "max": 2500, @@ -58,12 +61,23 @@ export class ConfigService { "integer": "^(([-+]?\\d+)|([-+]?0x[0-9a-fA-F]+))$" } }; - + ValidationConfiguration.validation = fallback; - + }); return promise; } + loadDesignersConfiguration(): void { + let url:string = this.api.no_proxy_root + this.api.GET_designers_configuration; + let promise: Promise<any> = this.http.get(url).map((res: Response) => res.json()).toPromise(); + + promise.then((config:any) => { + console.log(config); + }).catch((ex) => { + console.error('Error was:', ex); + }) + } + } diff --git a/catalog-ui/webpack.server.js b/catalog-ui/webpack.server.js index b8c79a6197..e53d79f533 100644 --- a/catalog-ui/webpack.server.js +++ b/catalog-ui/webpack.server.js @@ -44,6 +44,13 @@ module.exports = function(env) { secure: false })); + middlewares.push( + proxy(['/sdc1/rest'],{ + target: 'http://localhost:' + fePort, + changeOrigin: true, + secure: false + })); + // Redirect dcae urls to feHost middlewares.push( proxy(['/dcae','/sdc1/feProxy/dcae-api'],{ @@ -77,4 +84,4 @@ module.exports = function(env) { }; return ServerConfig; -}
\ No newline at end of file +} diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java index 8e15b96e0c..839dc0bdd2 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java @@ -140,4 +140,7 @@ public interface Constants { //external HealthCheck components public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING"; public static final String HC_COMPONENT_DCAE = "DCAE"; + + //Designer BL + public static final String DESIGNER_BL_COMPONENT = "designerStatusBL"; } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java index b3164fd283..0e1aabcccf 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java @@ -30,11 +30,14 @@ import org.openecomp.sdc.common.api.FileChangeCallback; import org.openecomp.sdc.common.config.EcompErrorConfiguration; import org.openecomp.sdc.common.config.IEcompConfigurationManager; import org.openecomp.sdc.common.rest.api.RestConfigurationInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ConfigurationManager implements FileChangeCallback, IEcompConfigurationManager { ConfigurationSource configurationSource = null; private static ConfigurationManager instance; + private static Logger log = LoggerFactory.getLogger(ConfigurationManager.class.getName()); public ConfigurationManager(ConfigurationSource configurationSource) { super(); @@ -50,11 +53,14 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura loadConfigurationClass(Configuration.class); loadConfigurationClass(RestConfigurationInfo.class); loadConfigurationClass(EcompErrorConfiguration.class); + loadConfigurationClass(DesignersConfiguration.class); } private <T extends BasicConfiguration> void loadConfigurationClass(Class<T> clazz) { ConfigurationListener configurationListener = new ConfigurationListener(clazz, this); + + log.info("created listener for class {}: {}", clazz.getName(), configurationListener); T object = configurationSource.getAndWatchConfiguration(clazz, configurationListener); @@ -85,6 +91,13 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura return (EcompErrorConfiguration) configurations.get(getKey(EcompErrorConfiguration.class)); } + + public DesignersConfiguration getDesignersConfiguration() { + + log.info("requested designers configuration and got this:{}", (DesignersConfiguration) configurations.get(getKey(DesignersConfiguration.class))); + + return (DesignersConfiguration) configurations.get(getKey(DesignersConfiguration.class)); + } public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) { @@ -114,4 +127,8 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura public static ConfigurationManager getConfigurationManager() { return instance; } + + public static void setTestInstance(ConfigurationManager configurationManagerInstance) { + instance = configurationManagerInstance; + } } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java new file mode 100644 index 0000000000..1b89ba02fd --- /dev/null +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java @@ -0,0 +1,77 @@ +package org.openecomp.sdc.fe.config; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.sdc.common.api.BasicConfiguration; + +public class DesignersConfiguration extends BasicConfiguration { + + private Map<String,Designer> designersList; + + public Map<String,Designer> getDesignersList() { + return designersList; + } + + public void setDesignersList(Map<String,Designer> designersList) { + this.designersList = designersList; + } + + public DesignersConfiguration() { + this.designersList = new HashMap<String, Designer>(); + } + + public static class Designer { + + private String displayName; + private String designerHost; + private Integer designerPort; + private String designerPath; + private String designerProtocol; + + + public String getDesignerProtocol() { + return designerProtocol; + } + + public void setDesignerProtocol(String designerProtocol) { + this.designerProtocol = designerProtocol; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getDesignerHost() { + return designerHost; + } + + public void setDesignerHost(String designerHost) { + this.designerHost = designerHost; + } + + public Integer getDesignerPort() { + return designerPort; + } + + public void setDesignerPort(Integer designerPort) { + this.designerPort = designerPort; + } + + public String getDesignerPath() { + return designerPath; + } + + public void setDesignerPath(String designerPath) { + this.designerPath = designerPath; + } + + } + +} + + diff --git a/sdc-os-chef/environments/Template.json b/sdc-os-chef/environments/Template.json index 2109d71a16..fd3b683058 100644 --- a/sdc-os-chef/environments/Template.json +++ b/sdc-os-chef/environments/Template.json @@ -39,6 +39,20 @@ "FE": "yyy", "ES": "yyy", "KB": "yyy" + }, + "Designers": { + "DCAE": { + "dcae_host": "yyy", + "dcae_port": "yyy", + "dcae_path": "yyy", + "dcae_protocol": "yyy" + }, + "WORKFLOW": { + "workflow_host": "yyy", + "workflow_port": "yyy", + "workflow_path": "yyy", + "workflow_protocol": "yyy" + } } }, "override_attributes": { diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb index 006eed8831..7dcf260d31 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb +++ b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb @@ -16,6 +16,24 @@ template "catalog-fe-config" do }) end +template "designers-fe-config" do + path "#{jetty_base}/config/catalog-fe/designers-configuration.yaml" + source "FE-designers-configuration.yaml.erb" + owner "jetty" + group "jetty" + mode "0755" + variables({ + :dcae_host => node['Designers']['DCAE']['dcae_host'], + :dcae_port => node['Designers']['DCAE']['dcae_port'], + :dcae_path => node['Designers']['DCAE']['dcae_path'], + :dcae_protocol => node['Designers']['DCAE']['dcae_protocol'], + :workflow_host => node['Designers']['WORKFLOW']['workflow_host'], + :workflow_port => node['Designers']['WORKFLOW']['workflow_port'], + :workflow_path => node['Designers']['WORKFLOW']['workflow_path'], + :workflow_protocol => node['Designers']['WORKFLOW']['workflow_protocol'] + }) +end + template "onboarding-fe-config" do path "#{jetty_base}/config/onboarding-fe/onboarding_configuration.yaml" diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-designers-configuration.yaml.erb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-designers-configuration.yaml.erb new file mode 100644 index 0000000000..b5092728ba --- /dev/null +++ b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-designers-configuration.yaml.erb @@ -0,0 +1,13 @@ +designersList: + DCAE: + displayName: DCAE + designerHost: <%= @dcae_host %> + designerPort: <%= @dcae_port %> + designerPath: <%= @dcae_path %> + designerProtocol: <%= @dcae_protocol %> + WORKFLOW: + displayName: WORKFLOW + designerHost: <%= @workflow_host %> + designerPort: <%= @workflow_port %> + designerPath: <%= @workflow_path %> + designerProtocol: <%= @workflow_protocol %>
\ No newline at end of file diff --git a/sdc-os-chef/sdc-frontend/startup.sh b/sdc-os-chef/sdc-frontend/startup.sh index 4b000c984f..82aef0b352 100644 --- a/sdc-os-chef/sdc-frontend/startup.sh +++ b/sdc-os-chef/sdc-frontend/startup.sh @@ -5,7 +5,7 @@ cd /root/chef-solo echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-catalog-fe/attributes/default.rb chef-solo -c solo.rb -E ${CHEFNAME} -sed -i '/^set -e/aJAVA_OPTIONS=\"-XX:MaxPermSize=256m -Xmx512m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-fe\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-fe\/configuration.yaml -Donboarding_configuration.yaml=${JETTY_BASE}\/config\/onboarding-fe\/onboarding_configuration.yaml\"' /docker-entrypoint.sh +sed -i '/^set -e/aJAVA_OPTIONS=\" -Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -XX:MaxPermSize=256m -Xmx512m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-fe\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-fe\/configuration.yaml -Donboarding_configuration.yaml=${JETTY_BASE}\/config\/onboarding-fe\/onboarding_configuration.yaml\"' /docker-entrypoint.sh sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh cd /var/lib/jetty |