From 19620eb066c4cbb2c2b60cecdcd55fded03af2d1 Mon Sep 17 00:00:00 2001 From: Fiachra Corcoran Date: Mon, 27 Aug 2018 17:59:42 +0100 Subject: Add subscriber docker image for client testing Issue-ID: DMAAP-662 Change-Id: I5f8f5a23e5116b2077689f704962e88dbeafb1b0 Signed-off-by: Fiachra Corcoran --- Subscriber/src/SSASubscriber.java | 115 ------ Subscriber/src/SubscriberServlet.java | 149 -------- Subscriber/src/log4j.properties | 9 - datarouter-prov/pom.xml | 2 +- .../dmaap/datarouter/provisioning/utils/DB.java | 6 +- .../docker-compose/database/sql_init_01.sql | 145 -------- .../resources/docker-compose/docker-compose.yml | 96 ----- .../docker-compose/node_data/node.properties | 112 ------ .../node_data/self_signed/cacerts.jks | Bin 1936 -> 0 bytes .../node_data/self_signed/keystore.jks | Bin 2273 -> 0 bytes .../docker-compose/node_data/self_signed/mykey.cer | Bin 921 -> 0 bytes .../node_data/self_signed/nodekey.cer | Bin 921 -> 0 bytes .../docker-compose/prov_data/addFeed3.txt | 44 --- .../docker-compose/prov_data/addSubscriber.txt | 36 -- .../docker-compose/prov_data/provserver.properties | 49 --- .../prov_data/self_signed/cacerts.jks | Bin 983 -> 0 bytes .../prov_data/self_signed/keystore.jks | Bin 2272 -> 0 bytes .../docker-compose/prov_data/self_signed/mykey.cer | Bin 921 -> 0 bytes datarouter-subscriber/pom.xml | 393 +++++++++++++++++++++ .../dmaap/datarouter/subscriber/Subscriber.java | 120 +++++++ .../datarouter/subscriber/SubscriberServlet.java | 168 +++++++++ .../src/main/resources/docker/Dockerfile | 6 + .../src/main/resources/docker/startup.sh | 12 + .../src/main/resources/log4j.properties | 31 ++ .../src/main/resources/subscriber.properties | 40 +++ docker-compose/database/sql_init_01.sql | 145 ++++++++ docker-compose/docker-compose.yml | 108 ++++++ docker-compose/node_data/node.properties | 112 ++++++ docker-compose/node_data/self_signed/cacerts.jks | Bin 0 -> 1936 bytes docker-compose/node_data/self_signed/keystore.jks | Bin 0 -> 2273 bytes docker-compose/node_data/self_signed/mykey.cer | Bin 0 -> 921 bytes docker-compose/node_data/self_signed/nodekey.cer | Bin 0 -> 921 bytes docker-compose/prov_data/addFeed3.txt | 44 +++ docker-compose/prov_data/addSubscriber.txt | 36 ++ docker-compose/prov_data/provserver.properties | 49 +++ docker-compose/prov_data/self_signed/cacerts.jks | Bin 0 -> 983 bytes docker-compose/prov_data/self_signed/keystore.jks | Bin 0 -> 2272 bytes docker-compose/prov_data/self_signed/mykey.cer | Bin 0 -> 921 bytes .../subscriber_data/subscriber.properties | 40 +++ pom.xml | 1 + 40 files changed, 1308 insertions(+), 760 deletions(-) delete mode 100644 Subscriber/src/SSASubscriber.java delete mode 100644 Subscriber/src/SubscriberServlet.java delete mode 100644 Subscriber/src/log4j.properties delete mode 100644 datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql delete mode 100644 datarouter-prov/src/main/resources/docker-compose/docker-compose.yml delete mode 100644 datarouter-prov/src/main/resources/docker-compose/node_data/node.properties delete mode 100644 datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/cacerts.jks delete mode 100644 datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/keystore.jks delete mode 100644 datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/mykey.cer delete mode 100644 datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/nodekey.cer delete mode 100644 datarouter-prov/src/main/resources/docker-compose/prov_data/addFeed3.txt delete mode 100644 datarouter-prov/src/main/resources/docker-compose/prov_data/addSubscriber.txt delete mode 100644 datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties delete mode 100644 datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/cacerts.jks delete mode 100644 datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/keystore.jks delete mode 100644 datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/mykey.cer create mode 100755 datarouter-subscriber/pom.xml create mode 100644 datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java create mode 100644 datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberServlet.java create mode 100644 datarouter-subscriber/src/main/resources/docker/Dockerfile create mode 100644 datarouter-subscriber/src/main/resources/docker/startup.sh create mode 100644 datarouter-subscriber/src/main/resources/log4j.properties create mode 100644 datarouter-subscriber/src/main/resources/subscriber.properties create mode 100644 docker-compose/database/sql_init_01.sql create mode 100644 docker-compose/docker-compose.yml create mode 100644 docker-compose/node_data/node.properties create mode 100644 docker-compose/node_data/self_signed/cacerts.jks create mode 100644 docker-compose/node_data/self_signed/keystore.jks create mode 100644 docker-compose/node_data/self_signed/mykey.cer create mode 100644 docker-compose/node_data/self_signed/nodekey.cer create mode 100644 docker-compose/prov_data/addFeed3.txt create mode 100644 docker-compose/prov_data/addSubscriber.txt create mode 100644 docker-compose/prov_data/provserver.properties create mode 100644 docker-compose/prov_data/self_signed/cacerts.jks create mode 100644 docker-compose/prov_data/self_signed/keystore.jks create mode 100644 docker-compose/prov_data/self_signed/mykey.cer create mode 100644 docker-compose/subscriber_data/subscriber.properties diff --git a/Subscriber/src/SSASubscriber.java b/Subscriber/src/SSASubscriber.java deleted file mode 100644 index 5ec099bd..00000000 --- a/Subscriber/src/SSASubscriber.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START================================================== - * * org.onap.dmaap - * * =========================================================================== - * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * * =========================================================================== - * * 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. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * * ============LICENSE_END==================================================== - * * - * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * * - ******************************************************************************/ - - -import org.eclipse.jetty.http.HttpVersion; -import org.eclipse.jetty.servlet.*; -import org.eclipse.jetty.util.ssl.*; -import org.eclipse.jetty.server.*; -import org.apache.log4j.Logger; - -/** - * Example stand alone subscriber - */ -public class SSASubscriber { - private static final int Port = 8447; - private static final String KeyStoreType = "jks"; - private static final String KeyStoreFile = "/root/sub/subscriber.jks"; - //private static final String KeyStoreFile = "c:/tmp/subscriber.jks"; - private static final String KeyStorePassword = "changeit"; - private static final String KeyPassword = "changeit"; - private static final String ContextPath = "/"; - private static final String URLPattern = "/*"; - - public static void main(String[] args) throws Exception { - //User story # US792630 -Jetty Upgrade to 9.3.11 - //SSASubscriber register Jetty server. - Server server = new Server(); - HttpConfiguration http_config = new HttpConfiguration(); - http_config.setSecureScheme("https"); - http_config.setSecurePort(Port); - http_config.setRequestHeaderSize(8192); - - // HTTP connector - ServerConnector http = new ServerConnector(server, - new HttpConnectionFactory(http_config)); - http.setPort(7070); - http.setIdleTimeout(30000); - - // SSL Context Factory - SslContextFactory sslContextFactory = new SslContextFactory(); - sslContextFactory.setKeyStoreType(KeyStoreType); - sslContextFactory.setKeyStorePath(KeyStoreFile); - sslContextFactory.setKeyStorePassword(KeyStorePassword); - sslContextFactory.setKeyManagerPassword(KeyPassword); - - // sslContextFactory.setTrustStorePath(ncm.getKSFile()); - // sslContextFactory.setTrustStorePassword("changeit"); - sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA", - "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA", - "SSL_RSA_EXPORT_WITH_RC4_40_MD5", - "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", - "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", - "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"); - - // SSL HTTP Configuration - HttpConfiguration https_config = new HttpConfiguration(http_config); - https_config.addCustomizer(new SecureRequestCustomizer()); - - // SSL Connector - ServerConnector sslConnector = new ServerConnector(server, - new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()), - new HttpConnectionFactory(https_config)); - sslConnector.setPort(Port); - server.addConnector(sslConnector); - - /**Skip SSLv3 Fixes*/ - sslContextFactory.addExcludeProtocols("SSLv3"); - System.out.println("Excluded protocols SSASubscriber-"+sslContextFactory.getExcludeProtocols().toString()); - /**End of SSLv3 Fixes*/ - - // HTTPS Configuration - ServerConnector https = new ServerConnector(server, - new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()), - new HttpConnectionFactory(https_config)); - https.setPort(Port); - https.setIdleTimeout(30000); - //server.setConnectors(new Connector[] { http, https }); - server.setConnectors(new Connector[] { http }); - ServletContextHandler ctxt = new ServletContextHandler(0); - ctxt.setContextPath(ContextPath); - server.setHandler(ctxt); - - ctxt.addServlet(new ServletHolder(new SubscriberServlet()), "/*"); - - try { - server.start(); - } catch ( Exception e ) { - System.out.println("Jetty failed to start. Reporting will we unavailable-"+e); - }; - server.join(); - - System.out.println("Subscriber started-"+ server.getState()); - - } -} \ No newline at end of file diff --git a/Subscriber/src/SubscriberServlet.java b/Subscriber/src/SubscriberServlet.java deleted file mode 100644 index 1af62a63..00000000 --- a/Subscriber/src/SubscriberServlet.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START================================================== - * * org.onap.dmaap - * * =========================================================================== - * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * * =========================================================================== - * * 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. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * * ============LICENSE_END==================================================== - * * - * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * * - ******************************************************************************/ - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URLEncoder; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; - -/** - * Example stand alone subscriber servlet with Authorization header checking - */ -public class SubscriberServlet extends HttpServlet { - private static Logger logger = Logger.getLogger("com.att.datarouter.pubsub.ssasubscribe.SubscriberServlet"); - private String Login = "LOGIN"; - private String Password = "PASSWORD"; - private String OutputDirectory = "/root/sub/received"; - - private String auth; - - private static String gp(ServletConfig config, String param, String deflt) { - param = config.getInitParameter(param); - if (param == null || param.length() == 0) { - param = deflt; - } - return(param); - } - /** - * Configure this subscriberservlet. Configuration parameters from config.getInitParameter() are: - * - */ - public void init(ServletConfig config) throws ServletException { - Login = gp(config, "Login", Login); - Password = gp(config, "Password", Password); - OutputDirectory = gp(config, "OutputDirectory", OutputDirectory); - (new File(OutputDirectory)).mkdirs(); - auth = "Basic " + Base64.encodeBase64String((Login + ":" + Password).getBytes()); - } - /** - * Invoke common(req, resp, false). - */ - protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - common(req, resp, false); - } - /** - * Invoke common(req, resp, true). - */ - protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - common(req, resp, true); - } - /** - * Process a PUT or DELETE request. - *
    - *
  1. Verify that the request contains an Authorization header - * or else UNAUTHORIZED. - *
  2. Verify that the Authorization header matches the configured - * Login and Password or else FORBIDDEN. - *
  3. If the request is PUT, store the message body as a file - * in the configured OutputDirectory directory protecting against - * evil characters in the received FileID. The file is created - * initially with its name prefixed with a ".", and once it is complete, it is - * renamed to remove the leading "." character. - *
  4. If the request is DELETE, instead delete the file (if it exists) from the configured OutputDirectory directory. - *
  5. Respond with NO_CONTENT. - *
- */ - protected void common(HttpServletRequest req, HttpServletResponse resp, boolean isdelete) throws ServletException, IOException { - String ah = req.getHeader("Authorization"); - if (ah == null) { - logger.info("Rejecting request with no Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo()); - resp.sendError(HttpServletResponse.SC_UNAUTHORIZED); - return; - } - if (!auth.equals(ah)) { - logger.info("Rejecting request with incorrect Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo()); - resp.sendError(HttpServletResponse.SC_FORBIDDEN); - return; - } - String fileid = req.getPathInfo(); - fileid = fileid.substring(fileid.lastIndexOf('/') + 1); - String qs = req.getQueryString(); - if (qs != null) { - fileid = fileid + "?" + qs; - } - String publishid = req.getHeader("X-ATT-DR-PUBLISH-ID"); - String filename = URLEncoder.encode(fileid, "UTF-8").replaceAll("^\\.", "%2E").replaceAll("\\*", "%2A"); - String finalname = OutputDirectory + "/" + filename; - String tmpname = OutputDirectory + "/." + filename; - try { - if (isdelete) { - (new File(finalname)).delete(); - logger.info("Received delete for file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + finalname); - } else { - InputStream is = req.getInputStream(); - OutputStream os = new FileOutputStream(tmpname); - byte[] buf = new byte[65536]; - int i; - while ((i = is.read(buf)) > 0) { - os.write(buf, 0, i); - } - is.close(); - os.close(); - (new File(tmpname)).renameTo(new File(finalname)); - logger.info("Received file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + finalname); - resp.setStatus(HttpServletResponse.SC_NO_CONTENT); - logger.info("Received file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + finalname); - } - resp.setStatus(HttpServletResponse.SC_NO_CONTENT); - } catch (IOException ioe) { - (new File(tmpname)).delete(); - logger.info("Failure to save file " + finalname + " from " + req.getRemoteAddr() + ": " + req.getPathInfo(), ioe); - throw ioe; - } - } -} diff --git a/Subscriber/src/log4j.properties b/Subscriber/src/log4j.properties deleted file mode 100644 index 8c12d5ca..00000000 --- a/Subscriber/src/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -log4j.debug=FALSE -log4j.rootLogger=INFO,Root - -log4j.appender.Root=org.apache.log4j.DailyRollingFileAppender -log4j.appender.Root.file=/opt/app/datartr/logs/subscriber.log -log4j.appender.Root.datePattern='.'yyyyMMdd -log4j.appender.Root.append=true -log4j.appender.Root.layout=org.apache.log4j.PatternLayout -log4j.appender.Root.layout.ConversionPattern=%d %p %t %m%n diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml index b3c28782..a970f715 100755 --- a/datarouter-prov/pom.xml +++ b/datarouter-prov/pom.xml @@ -277,7 +277,7 @@ src/main/resources true - **/proserver.properties + **/provserver.properties diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java index a907a03b..bbcacb53 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java @@ -38,14 +38,12 @@ import java.util.*; */ public class DB { - /** - * The name of the properties file (in CLASSPATH) - */ + private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + private static String DB_URL; private static String DB_LOGIN; private static String DB_PASSWORD; private static Properties props; - private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); private static final Queue queue = new LinkedList<>(); public static String HTTPS_PORT; diff --git a/datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql b/datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql deleted file mode 100644 index e01ce3b0..00000000 --- a/datarouter-prov/src/main/resources/docker-compose/database/sql_init_01.sql +++ /dev/null @@ -1,145 +0,0 @@ -use datarouter; - -CREATE TABLE FEEDS ( - FEEDID INT UNSIGNED NOT NULL PRIMARY KEY, - GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, - NAME VARCHAR(255) NOT NULL, - VERSION VARCHAR(20) NOT NULL, - DESCRIPTION VARCHAR(1000), - BUSINESS_DESCRIPTION VARCHAR(1000) DEFAULT NULL, - AUTH_CLASS VARCHAR(32) NOT NULL, - PUBLISHER VARCHAR(8) NOT NULL, - SELF_LINK VARCHAR(256), - PUBLISH_LINK VARCHAR(256), - SUBSCRIBE_LINK VARCHAR(256), - LOG_LINK VARCHAR(256), - DELETED BOOLEAN DEFAULT FALSE, - LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - SUSPENDED BOOLEAN DEFAULT FALSE, - CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -CREATE TABLE FEED_ENDPOINT_IDS ( - FEEDID INT UNSIGNED NOT NULL, - USERID VARCHAR(20) NOT NULL, - PASSWORD VARCHAR(32) NOT NULL -); - -CREATE TABLE FEED_ENDPOINT_ADDRS ( - FEEDID INT UNSIGNED NOT NULL, - ADDR VARCHAR(44) NOT NULL -); - -CREATE TABLE SUBSCRIPTIONS ( - SUBID INT UNSIGNED NOT NULL PRIMARY KEY, - FEEDID INT UNSIGNED NOT NULL, - GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, - DELIVERY_URL VARCHAR(256), - DELIVERY_USER VARCHAR(20), - DELIVERY_PASSWORD VARCHAR(32), - DELIVERY_USE100 BOOLEAN DEFAULT FALSE, - METADATA_ONLY BOOLEAN DEFAULT FALSE, - SUBSCRIBER VARCHAR(8) NOT NULL, - SELF_LINK VARCHAR(256), - LOG_LINK VARCHAR(256), - LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - SUSPENDED BOOLEAN DEFAULT FALSE, - CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP - -); - -CREATE TABLE PARAMETERS ( - KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY, - VALUE VARCHAR(4096) NOT NULL -); - -CREATE TABLE LOG_RECORDS ( - TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL, - EVENT_TIME BIGINT NOT NULL, /* time of the publish request */ - PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */ - FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */ - REQURI VARCHAR(256) NOT NULL, /* request URI */ - METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */ - CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */ - CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */ - - FEED_FILEID VARCHAR(256), /* file ID of published file */ - REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */ - USER VARCHAR(50), /* user name of publishing endpoint */ - STATUS SMALLINT, /* status code returned to delivering agent */ - - DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */ - DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */ - RESULT SMALLINT, /* result received from subscribing agent */ - - ATTEMPTS INT, /* deliveries attempted */ - REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'), - - RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */ - CONTENT_LENGTH_2 BIGINT, - - INDEX (FEEDID) USING BTREE, - INDEX (DELIVERY_SUBID) USING BTREE, - INDEX (RECORD_ID) USING BTREE -) ENGINE = MyISAM; - -CREATE TABLE INGRESS_ROUTES ( - SEQUENCE INT UNSIGNED NOT NULL, - FEEDID INT UNSIGNED NOT NULL, - USERID VARCHAR(20), - SUBNET VARCHAR(44), - NODESET INT UNSIGNED NOT NULL -); - -CREATE TABLE EGRESS_ROUTES ( - SUBID INT UNSIGNED NOT NULL PRIMARY KEY, - NODEID INT UNSIGNED NOT NULL -); - -CREATE TABLE NETWORK_ROUTES ( - FROMNODE INT UNSIGNED NOT NULL, - TONODE INT UNSIGNED NOT NULL, - VIANODE INT UNSIGNED NOT NULL -); - -CREATE TABLE NODESETS ( - SETID INT UNSIGNED NOT NULL, - NODEID INT UNSIGNED NOT NULL -); - -CREATE TABLE NODES ( - NODEID INT UNSIGNED NOT NULL PRIMARY KEY, - NAME VARCHAR(255) NOT NULL, - ACTIVE BOOLEAN DEFAULT TRUE -); - -CREATE TABLE GROUPS ( - GROUPID INT UNSIGNED NOT NULL PRIMARY KEY, - AUTHID VARCHAR(100) NOT NULL, - NAME VARCHAR(50) NOT NULL, - DESCRIPTION VARCHAR(255), - CLASSIFICATION VARCHAR(20) NOT NULL, - MEMBERS TINYTEXT, - LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -INSERT INTO PARAMETERS VALUES - ('ACTIVE_POD', 'prov.datarouternew.com'), - ('PROV_ACTIVE_NAME', 'prov.datarouternew.com'), - ('STANDBY_POD', ''), - ('PROV_NAME', 'prov.datarouternew.com'), - ('NODES', '172.100.0.1|node.datarouternew.com'), - ('PROV_DOMAIN', 'datarouternew.com'), - ('DELIVERY_INIT_RETRY_INTERVAL', '10'), - ('DELIVERY_MAX_AGE', '86400'), - ('DELIVERY_MAX_RETRY_INTERVAL', '3600'), - ('DELIVERY_RETRY_RATIO', '2'), - ('LOGROLL_INTERVAL', '300'), - ('PROV_AUTH_ADDRESSES', '172.100.0.1|prov.datarouternew.com|node.datarouternew.com'), - ('PROV_AUTH_SUBJECTS', ''), - ('PROV_MAXFEED_COUNT', '10000'), - ('PROV_MAXSUB_COUNT', '100000'), - ('PROV_REQUIRE_CERT', 'false'), - ('PROV_REQUIRE_SECURE', 'false'), - ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE') - ; diff --git a/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml b/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml deleted file mode 100644 index 6aee4dbd..00000000 --- a/datarouter-prov/src/main/resources/docker-compose/docker-compose.yml +++ /dev/null @@ -1,96 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START================================================== -# * org.onap.dmaap -# * =========================================================================== -# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# * =========================================================================== -# * 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. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# * ============LICENSE_END==================================================== -# * -# * ECOMP is a trademark and service mark of AT&T Intellectual Property. -# * -#------------------------------------------------------------------------------- -version: '2.1' -services: - datarouter-prov: - image: nexus3.onap.org:10003/onap/dmaap/datarouter-prov - container_name: datarouter-prov - hostname: prov.datarouternew.com - ports: - - "8443:8443" - - "8080:8080" - volumes: - - ./prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties - - ./prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt - - ./prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt - depends_on: - mariadb_container: - condition: service_healthy - healthcheck: - test: ["CMD", "curl", "-f", "http://prov.datarouternew.com:8080/internal/prov"] - interval: 10s - timeout: 10s - retries: 5 - extra_hosts: - - "node.datarouternew.com:172.100.0.4" - networks: - testing_net: - ipv4_address: 172.100.0.3 - - datarouter-node: - image: nexus3.onap.org:10003/onap/dmaap/datarouter-node - container_name: datarouter-node - hostname: node.datarouternew.com - ports: - - "9443:8443" - - "9090:8080" - volumes: - - ./node_data/node.properties:/opt/app/datartr/etc/node.properties - depends_on: - datarouter-prov: - condition: service_healthy - extra_hosts: - - "prov.datarouternew.com:172.100.0.3" - networks: - testing_net: - ipv4_address: 172.100.0.4 - - mariadb_container: - image: mariadb:10.2.14 - container_name: mariadb - ports: - - "3306:3306" -# volumes: -# - ./database/sql_init_01.sql:/docker-entrypoint-initdb.d/sql_init_01.sql - environment: - MYSQL_ROOT_PASSWORD: datarouter - MYSQL_DATABASE: datarouter - MYSQL_USER: datarouter - MYSQL_PASSWORD: datarouter - healthcheck: - test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"] - interval: 10s - timeout: 30s - retries: 5 - - networks: - testing_net: - ipv4_address: 172.100.0.2 - -networks: - testing_net: - driver: bridge - ipam: - driver: default - config: - - subnet: 172.100.0.0/16 diff --git a/datarouter-prov/src/main/resources/docker-compose/node_data/node.properties b/datarouter-prov/src/main/resources/docker-compose/node_data/node.properties deleted file mode 100644 index 48485023..00000000 --- a/datarouter-prov/src/main/resources/docker-compose/node_data/node.properties +++ /dev/null @@ -1,112 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START================================================== -# * org.onap.dmaap -# * =========================================================================== -# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# * =========================================================================== -# * 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. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# * ============LICENSE_END==================================================== -# * -# * ECOMP is a trademark and service mark of AT&T Intellectual Property. -# * -#------------------------------------------------------------------------------- -# -# Configuration parameters fixed at startup for the DataRouter node -# -# URL to retrieve dynamic configuration -# -#ProvisioningURL: ${DRTR_PROV_INTURL:-https://feeds-drtr.web.att.com/internal/prov} -ProvisioningURL=https://prov.datarouternew.com:8443/internal/prov - -# -# URL to upload PUB/DEL/EXP logs -# -#LogUploadURL: ${DRTR_LOG_URL:-https://feeds-drtr.web.att.com/internal/logs} -LogUploadURL=https://prov.datarouternew.com:8443/internal/logs - -# -# The port number for http as seen within the server -# -#IntHttpPort: ${DRTR_NODE_INTHTTPPORT:-8080} -IntHttpPort=8080 -# -# The port number for https as seen within the server -# -IntHttpsPort=8443 -# -# The external port number for https taking port mapping into account -# -ExtHttpsPort=443 -# -# The minimum interval between fetches of the dynamic configuration -# from the provisioning server -# -MinProvFetchInterval=10000 -# -# The minimum interval between saves of the redirection data file -# -MinRedirSaveInterval=10000 -# -# The path to the directory where log files are stored -# -LogDir=/opt/app/datartr/logs -# -# The retention interval (in days) for log files -# -LogRetention=30 -# -# The path to the directories where data and meta data files are stored -# -SpoolDir=/opt/app/datartr/spool -# -# The path to the redirection data file -# -#RedirectionFile: etc/redirections.dat -# -# The type of keystore for https -# -KeyStoreType: jks -# -# The path to the keystore for https -# -KeyStoreFile:/opt/app/datartr/self_signed/keystore.jks -# -# The password for the https keystore -# -KeyStorePassword=changeit -# -# The password for the private key in the https keystore -# -KeyPassword=changeit -# -# The type of truststore for https -# -TrustStoreType=jks -# -# The path to the truststore for https -# -#TrustStoreFile=/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts -TrustStoreFile=/opt/app/datartr/self_signed/cacerts.jks -# -# The password for the https truststore -# -TrustStorePassword=changeit -# -# The path to the file used to trigger an orderly shutdown -# -QuiesceFile=etc/SHUTDOWN -# -# The key used to generate passwords for node to node transfers -# -NodeAuthKey=Node123! - diff --git a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/cacerts.jks b/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/cacerts.jks deleted file mode 100644 index dfd81433..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/cacerts.jks and /dev/null differ diff --git a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/keystore.jks b/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/keystore.jks deleted file mode 100644 index e5a4e781..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/keystore.jks and /dev/null differ diff --git a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/mykey.cer b/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/mykey.cer deleted file mode 100644 index 2a5c9d70..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/mykey.cer and /dev/null differ diff --git a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/nodekey.cer b/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/nodekey.cer deleted file mode 100644 index 4cdfdfe3..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/node_data/self_signed/nodekey.cer and /dev/null differ diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/addFeed3.txt b/datarouter-prov/src/main/resources/docker-compose/prov_data/addFeed3.txt deleted file mode 100644 index 21000d0a..00000000 --- a/datarouter-prov/src/main/resources/docker-compose/prov_data/addFeed3.txt +++ /dev/null @@ -1,44 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START================================================== -# * org.onap.dmaap -# * =========================================================================== -# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# * =========================================================================== -# * 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. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# * ============LICENSE_END==================================================== -# * -# * ECOMP is a trademark and service mark of AT&T Intellectual Property. -# * -#------------------------------------------------------------------------------- -{ - "name": "Jettydemo", - "version": "m1.0", - "description": "Jettydemo", - "business_description": "Jettydemo", - "suspend": false, - "deleted": false, - "changeowner": true, - "authorization": { - "classification": "unclassified", - "endpoint_addrs": [ - "172.100.0.3", - ], - "endpoint_ids": [ - { - "password": "rs873m", - "id": "rs873m" - } - ] - }, -} - diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/addSubscriber.txt b/datarouter-prov/src/main/resources/docker-compose/prov_data/addSubscriber.txt deleted file mode 100644 index 45e12732..00000000 --- a/datarouter-prov/src/main/resources/docker-compose/prov_data/addSubscriber.txt +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START================================================== -# * org.onap.dmaap -# * =========================================================================== -# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# * =========================================================================== -# * 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. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# * ============LICENSE_END==================================================== -# * -# * ECOMP is a trademark and service mark of AT&T Intellectual Property. -# * -#------------------------------------------------------------------------------- -{ - "delivery" : - - { - "url" : "http://172.100.0.3:7070/", - "user" : "datarouter", - "password" : "datarouter", - "use100" : true - }, - "metadataOnly" : false, - "suspend" : false, - "groupid" : 29, - "subscriber" : "sg481n" -} diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties b/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties deleted file mode 100644 index 7758a64d..00000000 --- a/datarouter-prov/src/main/resources/docker-compose/prov_data/provserver.properties +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------- -# ============LICENSE_START================================================== -# * org.onap.dmaap -# * =========================================================================== -# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. -# * =========================================================================== -# * 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. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# * ============LICENSE_END==================================================== -# * -# * ECOMP is a trademark and service mark of AT&T Intellectual Property. -# * -#------------------------------------------------------------------------------- - -#Jetty Server properties -org.onap.dmaap.datarouter.provserver.http.port = 8080 -org.onap.dmaap.datarouter.provserver.https.port = 8443 -org.onap.dmaap.datarouter.provserver.https.relaxation = true - -org.onap.dmaap.datarouter.provserver.keystore.type = jks -org.onap.dmaap.datarouter.provserver.keymanager.password = changeit -org.onap.dmaap.datarouter.provserver.keystore.path = /opt/app/datartr/self_signed/keystore.jks -org.onap.dmaap.datarouter.provserver.keystore.password = changeit -org.onap.dmaap.datarouter.provserver.truststore.path = /opt/app/datartr/self_signed/cacerts.jks -org.onap.dmaap.datarouter.provserver.truststore.password = changeit - -org.onap.dmaap.datarouter.provserver.accesslog.dir = /opt/app/datartr/logs -org.onap.dmaap.datarouter.provserver.spooldir = /opt/app/datartr/spool -org.onap.dmaap.datarouter.provserver.dbscripts = /opt/app/datartr/etc/misc -org.onap.dmaap.datarouter.provserver.logretention = 30 - -#DMAAP-597 (Tech Dept) REST request source IP auth -# relaxation to accommodate OOM kubernetes deploy -org.onap.dmaap.datarouter.provserver.isaddressauthenabled = false - -# Database access -org.onap.dmaap.datarouter.db.driver = org.mariadb.jdbc.Driver -org.onap.dmaap.datarouter.db.url = jdbc:mariadb://172.100.0.2:3306/datarouter -org.onap.dmaap.datarouter.db.login = datarouter -org.onap.dmaap.datarouter.db.password = datarouter diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/cacerts.jks b/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/cacerts.jks deleted file mode 100644 index 76a480ad..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/cacerts.jks and /dev/null differ diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/keystore.jks b/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/keystore.jks deleted file mode 100644 index 2c22b4ac..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/keystore.jks and /dev/null differ diff --git a/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/mykey.cer b/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/mykey.cer deleted file mode 100644 index 2a5c9d70..00000000 Binary files a/datarouter-prov/src/main/resources/docker-compose/prov_data/self_signed/mykey.cer and /dev/null differ diff --git a/datarouter-subscriber/pom.xml b/datarouter-subscriber/pom.xml new file mode 100755 index 00000000..52cb25c7 --- /dev/null +++ b/datarouter-subscriber/pom.xml @@ -0,0 +1,393 @@ + + + 4.0.0 + + org.onap.dmaap.datarouter + parent + 1.0.1-SNAPSHOT + ../pom.xml + + datarouter-subscriber + jar + datarouter-subscriber + + java + false + true + /content/sites/site/${project.groupId}/${project.artifactId}/${project.version} + + ${basedir}/target/${artifactId} + onap/dmaap/datarouter-subscriber + + + + org.eclipse.jetty + jetty-server + ${jetty.version} + + + org.eclipse.jetty + jetty-continuation + ${jetty.version} + + + org.eclipse.jetty + jetty-util + ${jetty.version} + + + org.eclipse.jetty + jetty-deploy + ${jetty.version} + + + org.eclipse.jetty + jetty-servlet + ${jetty.version} + + + org.eclipse.jetty + jetty-servlets + ${jetty.version} + + + org.eclipse.jetty + jetty-http + ${jetty.version} + + + org.eclipse.jetty + jetty-security + ${jetty.version} + + + org.eclipse.jetty + jetty-websocket + ${jetty.websocket.version} + + + org.eclipse.jetty + jetty-io + ${jetty.version} + + + org.apache.httpcomponents + httpclient + 4.5.3 + + + org.sonatype.http-testing-harness + junit-runner + 0.11 + + + org.databene + contiperf + + + + + junit + junit + 4.10 + test + + + log4j + log4j + 1.2.17 + compile + + + + + docker + + false + false + true + + + + + com.spotify + docker-maven-plugin + 1.0.0 + + ${onap.nexus.dockerregistry.daily}/${datarouter.prov.image.name} + ${docker.location} + ${onap.nexus.dockerregistry.daily} + false + + ${project.version} + latest + + true + + + / + ${project.basedir} + + target/**/* + pom.xml + + + + + / + ${project.build.directory} + **/** + + + + + + + + + + datarouter-subscriber + + + src/main/resources + true + + **/*.properties + + + + src/main/resources + true + + **/subscriber.properties + + + + src/main/resources + true + + **/log4j.properties + + + + src/test/resources + true + + **/log4j.properties + + + + + + maven-assembly-plugin + 2.4 + + + jar-with-dependencies + + ${basedir}/target/opt/app/subscriber/lib + + + true + org.onap.dmaap.datarouter.subscriber.Subscriber + + + + + + make-assembly + + package + + + single + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + 3.6.0 + + + maven-resources-plugin + 2.7 + + + copy-docker-file + package + + copy-resources + + + ${docker.location} + true + + + ${basedir}/src/main/resources/docker + true + + **/* + + + + + + + copy-resources-1 + validate + + copy-resources + + + ${basedir}/target/opt/app/subscriber/lib + + + ${project.basedir}/src/main/resources + + **/*.jar + + + + + + + copy-resources-2 + validate + + copy-resources + + + ${basedir}/target/opt/app/subscriber/etc + + + ${basedir}/src/main/resources + + *.properties + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.10 + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory}/opt/app/subscriber/lib + false + false + true + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + failsafeArgLine + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + + + + diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java new file mode 100644 index 00000000..b6edb670 --- /dev/null +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/Subscriber.java @@ -0,0 +1,120 @@ +/******************************************************************************* + * ============LICENSE_START================================================== + * * org.onap.dmaap + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ + +package org.onap.dmaap.datarouter.subscriber; + +import org.apache.log4j.Logger; +import org.eclipse.jetty.servlet.*; +import org.eclipse.jetty.util.ssl.*; +import org.eclipse.jetty.server.*; +import org.eclipse.jetty.http.HttpVersion; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.Properties; + +public class Subscriber { + + private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.subscriber.Subscriber"); + + private static final String CONTEXT_PATH = "/"; + private static final String URL_PATTERN = "/*"; + + static Properties props; + + private static void loadProps() { + if (props == null) { + props = new Properties(); + try { + props.load(new FileInputStream(System.getProperty( + "org.onap.dmaap.datarouter.subscriber.properties", + "/opt/app/subscriber/etc/subscriber.properties"))); + } catch (IOException e) { + logger.fatal("SubServlet: Exception opening properties: " + e.getMessage()); + System.exit(1); + } + } + } + + public static void main(String[] args) throws Exception { + //Load the properties + loadProps(); + + int httpsPort = Integer.parseInt(props.getProperty("org.onap.dmaap.datarouter.subscriber.https.port", "8443")); + int httpPort = Integer.parseInt(props.getProperty("org.onap.dmaap.datarouter.subscriber.http.port", "8080")); + + Server server = new Server(); + HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setRequestHeaderSize(8192); + + // HTTP connector + ServletContextHandler ctxt; + try (ServerConnector httpServerConnector = new ServerConnector(server, + new HttpConnectionFactory(httpConfig))) { + httpServerConnector.setPort(httpPort); + httpServerConnector.setIdleTimeout(30000); + + // SSL Context Factory + SslContextFactory sslContextFactory = new SslContextFactory(); + + // SSL HTTP Configuration + HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); + httpsConfig.addCustomizer(new SecureRequestCustomizer()); + + // SSL Connector + ServerConnector sslConnector = new ServerConnector(server, + new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), + new HttpConnectionFactory(httpsConfig)); + sslConnector.setPort(httpsPort); + server.addConnector(sslConnector); + + /*Skip SSLv3 Fixes*/ + sslContextFactory.addExcludeProtocols("SSLv3"); + logger.info("Excluded protocols for Subscriber:" + Arrays.toString(sslContextFactory.getExcludeProtocols())); + /*End of SSLv3 Fixes*/ + + // HTTPS Configuration + try (ServerConnector https = new ServerConnector(server, + new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), + new HttpConnectionFactory(httpsConfig))) { + https.setPort(httpsPort); + https.setIdleTimeout(30000); + } + server.setConnectors(new Connector[]{ httpServerConnector }); + } + ctxt = new ServletContextHandler(0); + ctxt.setContextPath(CONTEXT_PATH); + server.setHandler(ctxt); + + ctxt.addServlet(new ServletHolder(new SubscriberServlet()), URL_PATTERN); + try { + server.start(); + } catch ( Exception e ) { + logger.info("Jetty failed to start. Reporting will be unavailable-"+e); + } + server.join(); + logger.info("org.onap.dmaap.datarouter.subscriber.Subscriber started-"+ server.getState()); + + } +} \ No newline at end of file diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberServlet.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberServlet.java new file mode 100644 index 00000000..72afcf06 --- /dev/null +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SubscriberServlet.java @@ -0,0 +1,168 @@ +/******************************************************************************* + * ============LICENSE_START================================================== + * * org.onap.dmaap + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ + +package org.onap.dmaap.datarouter.subscriber; + +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; + +import javax.servlet.ServletConfig; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.nio.file.attribute.PosixFilePermissions; + +import static org.onap.dmaap.datarouter.subscriber.Subscriber.props; + +public class SubscriberServlet extends HttpServlet { + + private static Logger logger = Logger.getLogger("org.onap.dmaap.datarouter.subscriber.SubscriberServlet"); + private String outputDirectory; + private String basicAuth; + + /** + * Configure this subscriberservlet. Configuration parameters from config.getInitParameter() are: + *
    + *
  • Login - The login expected in the Authorization header (default "LOGIN"). + *
  • Password - The password expected in the Authorization header (default "PASSWORD"). + *
  • outputDirectory - The directory where files are placed (default "tmp"). + *
+ */ + @Override + public void init(ServletConfig config) { + String login = props.getProperty("org.onap.dmaap.datarouter.subscriber.auth.user", "LOGIN"); + String password = props.getProperty("org.onap.dmaap.datarouter.subscriber.auth.password", "PASSWORD"); + outputDirectory = props.getProperty("org.onap.dmaap.datarouter.subscriber.delivery.dir", "/tmp"); + try { + Files.createDirectory(Paths.get(outputDirectory), PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwxrwx"))); + } catch (IOException e) { + logger.info("SubServlet: Failed to create delivery dir: " + e.getMessage()); + e.printStackTrace(); + } + basicAuth = "Basic " + Base64.encodeBase64String((login + ":" + password).getBytes()); + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + File filesPath = new File(outputDirectory); + File[] filesArr = filesPath.listFiles(); + assert filesArr != null; + for (File file: filesArr) { + try (BufferedReader in = new BufferedReader(new FileReader(file))) { + String line = in.readLine(); + while (line != null) { + line = in.readLine(); + } + } + } + } + /** + * Invoke common(req, resp, false). + */ + @Override + protected void doPut(HttpServletRequest req, HttpServletResponse resp) { + try { + common(req, resp, false); + } catch (IOException e) { + logger.info("SubServlet: Failed to doPut: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e); + } + } + /** + * Invoke common(req, resp, true). + */ + @Override + protected void doDelete(HttpServletRequest req, HttpServletResponse resp) { + try { + common(req, resp, true); + } catch (IOException e) { + logger.info("SubServlet: Failed to doDelete: " + req.getRemoteAddr() + " : " + req.getPathInfo(), e); + } + } + /** + * Process a PUT or DELETE request. + *
    + *
  1. Verify that the request contains an Authorization header + * or else UNAUTHORIZED. + *
  2. Verify that the Authorization header matches the configured + * Login and Password or else FORBIDDEN. + *
  3. If the request is PUT, store the message body as a file + * in the configured outputDirectory directory protecting against + * evil characters in the received FileID. The file is created + * initially with its name prefixed with a ".", and once it is complete, it is + * renamed to remove the leading "." character. + *
  4. If the request is DELETE, instead delete the file (if it exists) from the configured outputDirectory directory. + *
  5. Respond with NO_CONTENT. + *
+ */ + private void common(HttpServletRequest req, HttpServletResponse resp, boolean isdelete) throws IOException { + String authHeader = req.getHeader("Authorization"); + if (authHeader == null) { + logger.info("Rejecting request with no Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo()); + resp.sendError(HttpServletResponse.SC_UNAUTHORIZED); + return; + } + if (!basicAuth.equals(authHeader)) { + logger.info("Rejecting request with incorrect Authorization header from " + req.getRemoteAddr() + ": " + req.getPathInfo()); + resp.sendError(HttpServletResponse.SC_FORBIDDEN); + return; + } + String fileid = req.getPathInfo(); + fileid = fileid.substring(fileid.lastIndexOf('/') + 1); + String queryString = req.getQueryString(); + if (queryString != null) { + fileid = fileid + "?" + queryString; + } + String publishid = req.getHeader("X-ATT-DR-PUBLISH-ID"); + String filename = URLEncoder.encode(fileid, "UTF-8").replaceAll("^\\.", "%2E").replaceAll("\\*", "%2A"); + String fullPath = outputDirectory + "/" + filename; + String tmpPath = outputDirectory + "/." + filename; + try { + if (isdelete) { + Files.deleteIfExists(Paths.get(fullPath)); + logger.info("Received delete for file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + fullPath); + } else { + new File(tmpPath).createNewFile(); + try (InputStream is = req.getInputStream(); OutputStream os = new FileOutputStream(tmpPath)) { + byte[] buf = new byte[65536]; + int i; + while ((i = is.read(buf)) > 0) { + os.write(buf, 0, i); + } + } + Files.move(Paths.get(tmpPath), Paths.get(fullPath), StandardCopyOption.REPLACE_EXISTING); + logger.info("Received file id " + fileid + " from " + req.getRemoteAddr() + " publish id " + publishid + " as " + fullPath); + resp.setStatus(HttpServletResponse.SC_NO_CONTENT); + } + resp.setStatus(HttpServletResponse.SC_NO_CONTENT); + } catch (IOException ioe) { + Files.deleteIfExists(Paths.get(tmpPath)); + logger.info("Failed to process file " + fullPath + " from " + req.getRemoteAddr() + ": " + req.getPathInfo()); + throw ioe; + } + } +} diff --git a/datarouter-subscriber/src/main/resources/docker/Dockerfile b/datarouter-subscriber/src/main/resources/docker/Dockerfile new file mode 100644 index 00000000..6cc74cc3 --- /dev/null +++ b/datarouter-subscriber/src/main/resources/docker/Dockerfile @@ -0,0 +1,6 @@ +FROM java:8 +ADD opt /opt/ +ADD startup.sh /startup.sh +RUN chmod 700 /startup.sh +ENTRYPOINT ./startup.sh start +EXPOSE 7070 \ No newline at end of file diff --git a/datarouter-subscriber/src/main/resources/docker/startup.sh b/datarouter-subscriber/src/main/resources/docker/startup.sh new file mode 100644 index 00000000..53b1053d --- /dev/null +++ b/datarouter-subscriber/src/main/resources/docker/startup.sh @@ -0,0 +1,12 @@ +#!/bin/bash +LIB=/opt/app/subscriber/lib +ETC=/opt/app/subscriber/etc +CLASSPATH=$ETC +for FILE in `find $LIB -name *.jar`; do + CLASSPATH=$CLASSPATH:$FILE +done +java -classpath $CLASSPATH org.onap.dmaap.datarouter.subscriber.Subscriber + +runner_file="$LIB/subscriber-jar-with-dependencies.jar" +echo "Starting using" $runner_file +java -Dorg.onap.dmaap.datarouter.subscriber.properties=/opt/app/subscriber/etc/subscriber.properties -jar $runner_file \ No newline at end of file diff --git a/datarouter-subscriber/src/main/resources/log4j.properties b/datarouter-subscriber/src/main/resources/log4j.properties new file mode 100644 index 00000000..bb66ef42 --- /dev/null +++ b/datarouter-subscriber/src/main/resources/log4j.properties @@ -0,0 +1,31 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- + +log4j.rootLogger=info,Root + +log4j.appender.Root=org.apache.log4j.DailyRollingFileAppender +log4j.appender.Root.file=/opt/app/subscriber/logs/subscriber.log +log4j.appender.Root.datePattern='.'yyyyMMdd +log4j.appender.Root.append=true +log4j.appender.Root.layout=org.apache.log4j.PatternLayout +log4j.appender.Root.layout.ConversionPattern=%d %p %t %m%n diff --git a/datarouter-subscriber/src/main/resources/subscriber.properties b/datarouter-subscriber/src/main/resources/subscriber.properties new file mode 100644 index 00000000..771fdd34 --- /dev/null +++ b/datarouter-subscriber/src/main/resources/subscriber.properties @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- + +#Subscriber properties +org.onap.dmaap.datarouter.subscriber.http.port = 7070 +org.onap.dmaap.datarouter.subscriber.https.port = 7443 +org.onap.dmaap.datarouter.subscriber.auth.user = LOGIN +org.onap.dmaap.datarouter.subscriber.auth.password = PASSWORD +org.onap.dmaap.datarouter.subscriber.delivery.dir = /opt/app/subscriber/delivery + +org.onap.dmaap.datarouter.subscriber.https.relaxation = true +org.onap.dmaap.datarouter.subscriber.keystore.type = jks +org.onap.dmaap.datarouter.subscriber.keymanager.password = changeit +org.onap.dmaap.datarouter.subscriber.keystore.path = /opt/app/datartr/self_signed/keystore.jks +org.onap.dmaap.datarouter.subscriber.keystore.password = changeit +org.onap.dmaap.datarouter.subscriber.truststore.path = /opt/app/datartr/self_signed/cacerts.jks +org.onap.dmaap.datarouter.subscriber.truststore.password = changeit + + + diff --git a/docker-compose/database/sql_init_01.sql b/docker-compose/database/sql_init_01.sql new file mode 100644 index 00000000..e01ce3b0 --- /dev/null +++ b/docker-compose/database/sql_init_01.sql @@ -0,0 +1,145 @@ +use datarouter; + +CREATE TABLE FEEDS ( + FEEDID INT UNSIGNED NOT NULL PRIMARY KEY, + GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, + NAME VARCHAR(255) NOT NULL, + VERSION VARCHAR(20) NOT NULL, + DESCRIPTION VARCHAR(1000), + BUSINESS_DESCRIPTION VARCHAR(1000) DEFAULT NULL, + AUTH_CLASS VARCHAR(32) NOT NULL, + PUBLISHER VARCHAR(8) NOT NULL, + SELF_LINK VARCHAR(256), + PUBLISH_LINK VARCHAR(256), + SUBSCRIBE_LINK VARCHAR(256), + LOG_LINK VARCHAR(256), + DELETED BOOLEAN DEFAULT FALSE, + LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + SUSPENDED BOOLEAN DEFAULT FALSE, + CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE FEED_ENDPOINT_IDS ( + FEEDID INT UNSIGNED NOT NULL, + USERID VARCHAR(20) NOT NULL, + PASSWORD VARCHAR(32) NOT NULL +); + +CREATE TABLE FEED_ENDPOINT_ADDRS ( + FEEDID INT UNSIGNED NOT NULL, + ADDR VARCHAR(44) NOT NULL +); + +CREATE TABLE SUBSCRIPTIONS ( + SUBID INT UNSIGNED NOT NULL PRIMARY KEY, + FEEDID INT UNSIGNED NOT NULL, + GROUPID INT(10) UNSIGNED NOT NULL DEFAULT 0, + DELIVERY_URL VARCHAR(256), + DELIVERY_USER VARCHAR(20), + DELIVERY_PASSWORD VARCHAR(32), + DELIVERY_USE100 BOOLEAN DEFAULT FALSE, + METADATA_ONLY BOOLEAN DEFAULT FALSE, + SUBSCRIBER VARCHAR(8) NOT NULL, + SELF_LINK VARCHAR(256), + LOG_LINK VARCHAR(256), + LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + SUSPENDED BOOLEAN DEFAULT FALSE, + CREATED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP + +); + +CREATE TABLE PARAMETERS ( + KEYNAME VARCHAR(32) NOT NULL PRIMARY KEY, + VALUE VARCHAR(4096) NOT NULL +); + +CREATE TABLE LOG_RECORDS ( + TYPE ENUM('pub', 'del', 'exp', 'pbf', 'dlx') NOT NULL, + EVENT_TIME BIGINT NOT NULL, /* time of the publish request */ + PUBLISH_ID VARCHAR(64) NOT NULL, /* unique ID assigned to this publish attempt */ + FEEDID INT UNSIGNED NOT NULL, /* pointer to feed in FEEDS */ + REQURI VARCHAR(256) NOT NULL, /* request URI */ + METHOD ENUM('DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'TRACE') NOT NULL, /* HTTP method */ + CONTENT_TYPE VARCHAR(256) NOT NULL, /* content type of published file */ + CONTENT_LENGTH BIGINT NOT NULL, /* content length of published file */ + + FEED_FILEID VARCHAR(256), /* file ID of published file */ + REMOTE_ADDR VARCHAR(40), /* IP address of publishing endpoint */ + USER VARCHAR(50), /* user name of publishing endpoint */ + STATUS SMALLINT, /* status code returned to delivering agent */ + + DELIVERY_SUBID INT UNSIGNED, /* pointer to subscription in SUBSCRIPTIONS */ + DELIVERY_FILEID VARCHAR(256), /* file ID of file being delivered */ + RESULT SMALLINT, /* result received from subscribing agent */ + + ATTEMPTS INT, /* deliveries attempted */ + REASON ENUM('notRetryable', 'retriesExhausted', 'diskFull', 'other'), + + RECORD_ID BIGINT UNSIGNED NOT NULL PRIMARY KEY, /* unique ID for this record */ + CONTENT_LENGTH_2 BIGINT, + + INDEX (FEEDID) USING BTREE, + INDEX (DELIVERY_SUBID) USING BTREE, + INDEX (RECORD_ID) USING BTREE +) ENGINE = MyISAM; + +CREATE TABLE INGRESS_ROUTES ( + SEQUENCE INT UNSIGNED NOT NULL, + FEEDID INT UNSIGNED NOT NULL, + USERID VARCHAR(20), + SUBNET VARCHAR(44), + NODESET INT UNSIGNED NOT NULL +); + +CREATE TABLE EGRESS_ROUTES ( + SUBID INT UNSIGNED NOT NULL PRIMARY KEY, + NODEID INT UNSIGNED NOT NULL +); + +CREATE TABLE NETWORK_ROUTES ( + FROMNODE INT UNSIGNED NOT NULL, + TONODE INT UNSIGNED NOT NULL, + VIANODE INT UNSIGNED NOT NULL +); + +CREATE TABLE NODESETS ( + SETID INT UNSIGNED NOT NULL, + NODEID INT UNSIGNED NOT NULL +); + +CREATE TABLE NODES ( + NODEID INT UNSIGNED NOT NULL PRIMARY KEY, + NAME VARCHAR(255) NOT NULL, + ACTIVE BOOLEAN DEFAULT TRUE +); + +CREATE TABLE GROUPS ( + GROUPID INT UNSIGNED NOT NULL PRIMARY KEY, + AUTHID VARCHAR(100) NOT NULL, + NAME VARCHAR(50) NOT NULL, + DESCRIPTION VARCHAR(255), + CLASSIFICATION VARCHAR(20) NOT NULL, + MEMBERS TINYTEXT, + LAST_MOD TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +INSERT INTO PARAMETERS VALUES + ('ACTIVE_POD', 'prov.datarouternew.com'), + ('PROV_ACTIVE_NAME', 'prov.datarouternew.com'), + ('STANDBY_POD', ''), + ('PROV_NAME', 'prov.datarouternew.com'), + ('NODES', '172.100.0.1|node.datarouternew.com'), + ('PROV_DOMAIN', 'datarouternew.com'), + ('DELIVERY_INIT_RETRY_INTERVAL', '10'), + ('DELIVERY_MAX_AGE', '86400'), + ('DELIVERY_MAX_RETRY_INTERVAL', '3600'), + ('DELIVERY_RETRY_RATIO', '2'), + ('LOGROLL_INTERVAL', '300'), + ('PROV_AUTH_ADDRESSES', '172.100.0.1|prov.datarouternew.com|node.datarouternew.com'), + ('PROV_AUTH_SUBJECTS', ''), + ('PROV_MAXFEED_COUNT', '10000'), + ('PROV_MAXSUB_COUNT', '100000'), + ('PROV_REQUIRE_CERT', 'false'), + ('PROV_REQUIRE_SECURE', 'false'), + ('_INT_VALUES', 'LOGROLL_INTERVAL|PROV_MAXFEED_COUNT|PROV_MAXSUB_COUNT|DELIVERY_INIT_RETRY_INTERVAL|DELIVERY_MAX_RETRY_INTERVAL|DELIVERY_RETRY_RATIO|DELIVERY_MAX_AGE') + ; diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml new file mode 100644 index 00000000..f8a4d843 --- /dev/null +++ b/docker-compose/docker-compose.yml @@ -0,0 +1,108 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- +version: '2.1' +services: + datarouter-prov: + image: nexus3.onap.org:10003/onap/dmaap/datarouter-prov + container_name: datarouter-prov + hostname: prov.datarouternew.com + ports: + - "8443:8443" + - "8080:8080" + volumes: + - ./prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties + - ./prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt + - ./prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt + depends_on: + mariadb_container: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://prov.datarouternew.com:8080/internal/prov"] + interval: 10s + timeout: 10s + retries: 5 + extra_hosts: + - "node.datarouternew.com:172.100.0.4" + networks: + testing_net: + ipv4_address: 172.100.0.3 + + datarouter-node: + image: nexus3.onap.org:10003/onap/dmaap/datarouter-node + container_name: datarouter-node + hostname: node.datarouternew.com + ports: + - "9443:8443" + - "9090:8080" + volumes: + - ./node_data/node.properties:/opt/app/datartr/etc/node.properties + depends_on: + datarouter-prov: + condition: service_healthy + extra_hosts: + - "prov.datarouternew.com:172.100.0.3" + networks: + testing_net: + ipv4_address: 172.100.0.4 + + datarouter-subscriber: + image: nexus3.onap.org:10003/onap/dmaap/datarouter-subscriber + container_name: subscriber-node + hostname: subscriber.com + ports: + - "7070:7070" + volumes: + - ./subscriber_data/subscriber.properties:/opt/app/subscriber/etc/subscriber.properties + networks: + testing_net: + ipv4_address: 172.100.0.5 + + mariadb_container: + image: mariadb:10.2.14 + container_name: mariadb + ports: + - "3306:3306" +# volumes: +# - ./database/sql_init_01.sql:/docker-entrypoint-initdb.d/sql_init_01.sql + environment: + MYSQL_ROOT_PASSWORD: datarouter + MYSQL_DATABASE: datarouter + MYSQL_USER: datarouter + MYSQL_PASSWORD: datarouter + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"] + interval: 10s + timeout: 30s + retries: 5 + + networks: + testing_net: + ipv4_address: 172.100.0.2 + +networks: + testing_net: + driver: bridge + ipam: + driver: default + config: + - subnet: 172.100.0.0/16 diff --git a/docker-compose/node_data/node.properties b/docker-compose/node_data/node.properties new file mode 100644 index 00000000..20c5af12 --- /dev/null +++ b/docker-compose/node_data/node.properties @@ -0,0 +1,112 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- +# +# Configuration parameters fixed at startup for the DataRouter node +# +# URL to retrieve dynamic configuration +# +#ProvisioningURL: ${DRTR_PROV_INTURL:-https://feeds-drtr.web.att.com/internal/prov} +ProvisioningURL=https://prov.datarouternew.com:8443/internal/prov + +# +# URL to upload PUB/DEL/EXP logs +# +#LogUploadURL: ${DRTR_LOG_URL:-https://feeds-drtr.web.att.com/internal/logs} +LogUploadURL=https://prov.datarouternew.com:8443/internal/logs + +# +# The port number for http as seen within the server +# +#IntHttpPort: ${DRTR_NODE_INTHTTPPORT:-8080} +IntHttpPort=8080 +# +# The port number for https as seen within the server +# +IntHttpsPort=8443 +# +# The external port number for https taking port mapping into account +# +ExtHttpsPort=443 +# +# The minimum interval between fetches of the dynamic configuration +# from the provisioning server +# +MinProvFetchInterval=10000 +# +# The minimum interval between saves of the redirection data file +# +MinRedirSaveInterval=10000 +# +# The path to the directory where log files are stored +# +LogDir=/opt/app/datartr/logs +# +# The retention interval (in days) for log files +# +LogRetention=30 +# +# The path to the directories where data and meta data files are stored +# +SpoolDir=/opt/app/datartr/spool +# +# The path to the redirection data file +# +#RedirectionFile: etc/redirections.dat +# +# The type of keystore for https +# +KeyStoreType: jks +# +# The path to the keystore for https +# +KeyStoreFile:/opt/app/datartr/self_signed/keystore.jks +# +# The password for the https keystore +# +KeyStorePassword=changeit +# +# The password for the private key in the https keystore +# +KeyPassword=changeit +# +# The type of truststore for https +# +TrustStoreType=jks +# +# The path to the truststore for https +# +#TrustStoreFile=/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts +TrustStoreFile=/opt/app/datartr/self_signed/cacerts.jks +# +# The password for the https truststore +# +TrustStorePassword=changeit +# +# The path to the file used to trigger an orderly shutdown +# +QuiesceFile=etc/SHUTDOWN +# +# The key used to generate passwords for node to node transfers +# +NodeAuthKey=Node123! + diff --git a/docker-compose/node_data/self_signed/cacerts.jks b/docker-compose/node_data/self_signed/cacerts.jks new file mode 100644 index 00000000..dfd81433 Binary files /dev/null and b/docker-compose/node_data/self_signed/cacerts.jks differ diff --git a/docker-compose/node_data/self_signed/keystore.jks b/docker-compose/node_data/self_signed/keystore.jks new file mode 100644 index 00000000..e5a4e781 Binary files /dev/null and b/docker-compose/node_data/self_signed/keystore.jks differ diff --git a/docker-compose/node_data/self_signed/mykey.cer b/docker-compose/node_data/self_signed/mykey.cer new file mode 100644 index 00000000..2a5c9d70 Binary files /dev/null and b/docker-compose/node_data/self_signed/mykey.cer differ diff --git a/docker-compose/node_data/self_signed/nodekey.cer b/docker-compose/node_data/self_signed/nodekey.cer new file mode 100644 index 00000000..4cdfdfe3 Binary files /dev/null and b/docker-compose/node_data/self_signed/nodekey.cer differ diff --git a/docker-compose/prov_data/addFeed3.txt b/docker-compose/prov_data/addFeed3.txt new file mode 100644 index 00000000..21000d0a --- /dev/null +++ b/docker-compose/prov_data/addFeed3.txt @@ -0,0 +1,44 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- +{ + "name": "Jettydemo", + "version": "m1.0", + "description": "Jettydemo", + "business_description": "Jettydemo", + "suspend": false, + "deleted": false, + "changeowner": true, + "authorization": { + "classification": "unclassified", + "endpoint_addrs": [ + "172.100.0.3", + ], + "endpoint_ids": [ + { + "password": "rs873m", + "id": "rs873m" + } + ] + }, +} + diff --git a/docker-compose/prov_data/addSubscriber.txt b/docker-compose/prov_data/addSubscriber.txt new file mode 100644 index 00000000..45e12732 --- /dev/null +++ b/docker-compose/prov_data/addSubscriber.txt @@ -0,0 +1,36 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- +{ + "delivery" : + + { + "url" : "http://172.100.0.3:7070/", + "user" : "datarouter", + "password" : "datarouter", + "use100" : true + }, + "metadataOnly" : false, + "suspend" : false, + "groupid" : 29, + "subscriber" : "sg481n" +} diff --git a/docker-compose/prov_data/provserver.properties b/docker-compose/prov_data/provserver.properties new file mode 100644 index 00000000..7758a64d --- /dev/null +++ b/docker-compose/prov_data/provserver.properties @@ -0,0 +1,49 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- + +#Jetty Server properties +org.onap.dmaap.datarouter.provserver.http.port = 8080 +org.onap.dmaap.datarouter.provserver.https.port = 8443 +org.onap.dmaap.datarouter.provserver.https.relaxation = true + +org.onap.dmaap.datarouter.provserver.keystore.type = jks +org.onap.dmaap.datarouter.provserver.keymanager.password = changeit +org.onap.dmaap.datarouter.provserver.keystore.path = /opt/app/datartr/self_signed/keystore.jks +org.onap.dmaap.datarouter.provserver.keystore.password = changeit +org.onap.dmaap.datarouter.provserver.truststore.path = /opt/app/datartr/self_signed/cacerts.jks +org.onap.dmaap.datarouter.provserver.truststore.password = changeit + +org.onap.dmaap.datarouter.provserver.accesslog.dir = /opt/app/datartr/logs +org.onap.dmaap.datarouter.provserver.spooldir = /opt/app/datartr/spool +org.onap.dmaap.datarouter.provserver.dbscripts = /opt/app/datartr/etc/misc +org.onap.dmaap.datarouter.provserver.logretention = 30 + +#DMAAP-597 (Tech Dept) REST request source IP auth +# relaxation to accommodate OOM kubernetes deploy +org.onap.dmaap.datarouter.provserver.isaddressauthenabled = false + +# Database access +org.onap.dmaap.datarouter.db.driver = org.mariadb.jdbc.Driver +org.onap.dmaap.datarouter.db.url = jdbc:mariadb://172.100.0.2:3306/datarouter +org.onap.dmaap.datarouter.db.login = datarouter +org.onap.dmaap.datarouter.db.password = datarouter diff --git a/docker-compose/prov_data/self_signed/cacerts.jks b/docker-compose/prov_data/self_signed/cacerts.jks new file mode 100644 index 00000000..76a480ad Binary files /dev/null and b/docker-compose/prov_data/self_signed/cacerts.jks differ diff --git a/docker-compose/prov_data/self_signed/keystore.jks b/docker-compose/prov_data/self_signed/keystore.jks new file mode 100644 index 00000000..2c22b4ac Binary files /dev/null and b/docker-compose/prov_data/self_signed/keystore.jks differ diff --git a/docker-compose/prov_data/self_signed/mykey.cer b/docker-compose/prov_data/self_signed/mykey.cer new file mode 100644 index 00000000..2a5c9d70 Binary files /dev/null and b/docker-compose/prov_data/self_signed/mykey.cer differ diff --git a/docker-compose/subscriber_data/subscriber.properties b/docker-compose/subscriber_data/subscriber.properties new file mode 100644 index 00000000..771fdd34 --- /dev/null +++ b/docker-compose/subscriber_data/subscriber.properties @@ -0,0 +1,40 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START================================================== +# * org.onap.dmaap +# * =========================================================================== +# * Copyright � 2017 AT&T Intellectual Property. All rights reserved. +# * =========================================================================== +# * 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. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * ============LICENSE_END==================================================== +# * +# * ECOMP is a trademark and service mark of AT&T Intellectual Property. +# * +#------------------------------------------------------------------------------- + +#Subscriber properties +org.onap.dmaap.datarouter.subscriber.http.port = 7070 +org.onap.dmaap.datarouter.subscriber.https.port = 7443 +org.onap.dmaap.datarouter.subscriber.auth.user = LOGIN +org.onap.dmaap.datarouter.subscriber.auth.password = PASSWORD +org.onap.dmaap.datarouter.subscriber.delivery.dir = /opt/app/subscriber/delivery + +org.onap.dmaap.datarouter.subscriber.https.relaxation = true +org.onap.dmaap.datarouter.subscriber.keystore.type = jks +org.onap.dmaap.datarouter.subscriber.keymanager.password = changeit +org.onap.dmaap.datarouter.subscriber.keystore.path = /opt/app/datartr/self_signed/keystore.jks +org.onap.dmaap.datarouter.subscriber.keystore.password = changeit +org.onap.dmaap.datarouter.subscriber.truststore.path = /opt/app/datartr/self_signed/cacerts.jks +org.onap.dmaap.datarouter.subscriber.truststore.password = changeit + + + diff --git a/pom.xml b/pom.xml index d3327ba9..43aeca21 100755 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,7 @@ datarouter-prov datarouter-node + datarouter-subscriber -- cgit 1.2.3-korg