From: Conor Ward Date: Thu, 24 Jan 2019 11:41:55 +0000 (+0000) Subject: Merge "rephrase sentence" X-Git-Tag: 2.0.0~5 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdatarouter.git;a=commitdiff_plain;h=ba460267210f7978a440074fcb46a501bfa0b480;hp=d786e2599e73b3cb1a97c979753c97ddd0090073 Merge "rephrase sentence" --- diff --git a/INFO.yaml b/INFO.yaml new file mode 100644 index 00000000..fb07cf51 --- /dev/null +++ b/INFO.yaml @@ -0,0 +1,42 @@ +--- +project: 'dmaap-datarouter' +project_creation_date: '2017-06-30' +lifecycle_state: 'Incubation' +project_lead: &onap_releng_ptl + name: 'Ram Koya' + email: 'rk541m@att.com' + id: 'rampi_k' + company: 'ATT' + timezone: 'America/Dallas' +primary_contact: *onap_releng_ptl +issue_tracking: + type: 'jira' + url: 'https://jira.onap.org/projects/DMAAP' + key: 'DMAAP' +meetings: + - type: 'zoom' + agenda: '' + url: 'https://wiki.onap.org/pages/viewpage.action?pageId=13599275' + server: 'n/a' + channel: 'n/a' + repeats: 'weekly' + time: '13:00 UTC' +committers: + - <<: *onap_releng_ptl + - name: 'Ramdas Sawant' + email: 'rs873m@att.com' + company: 'ATT' + id: 'rs873m' + timezone: 'America/Dallas' + - name: 'Varun Gudisena' + email: 'vg411h@att.com' + company: 'ATT' + id: 'vg411h' + timezone: 'America/Dallas' +tsc: + approval: 'https://lists.onap.org/pipermail/onap-tsc' + changes: + - type: 'Removal' + name: 'Habib Madani' + name: 'Xinhui Li' + name: 'Jing Wang' diff --git a/datarouter-docker-compose/pom.xml b/datarouter-docker-compose/pom.xml index 1ce98303..05faa5ae 100644 --- a/datarouter-docker-compose/pom.xml +++ b/datarouter-docker-compose/pom.xml @@ -26,7 +26,7 @@ org.onap.dmaap.datarouter parent - 1.0.4-SNAPSHOT + 1.1.0-SNAPSHOT ../pom.xml datarouter-docker-compose diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml index 52afa663..7df19895 100755 --- a/datarouter-node/pom.xml +++ b/datarouter-node/pom.xml @@ -26,7 +26,7 @@ org.onap.dmaap.datarouter parent - 1.0.4-SNAPSHOT + 1.1.0-SNAPSHOT ../pom.xml datarouter-node diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java index b8c06f14..e07642c4 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeMain.java @@ -99,6 +99,7 @@ public class NodeMain { nodeMainLogger.info("NODE0002 I am " + nodeConfigManager.getMyName()); (new WaitForConfig(nodeConfigManager)).waitForConfig(); delivery = new Delivery(nodeConfigManager); + new LogManager(nodeConfigManager); Server server = new Server(); // HTTP configuration HttpConfiguration httpConfiguration = new HttpConfiguration(); diff --git a/datarouter-prov/pom.xml b/datarouter-prov/pom.xml index 75dbb718..95c2de8f 100755 --- a/datarouter-prov/pom.xml +++ b/datarouter-prov/pom.xml @@ -26,7 +26,7 @@ org.onap.dmaap.datarouter parent - 1.0.4-SNAPSHOT + 1.1.0-SNAPSHOT ../pom.xml datarouter-prov diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java index 8229ee5a..3ae63bb2 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/PublishServlet.java @@ -35,10 +35,10 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import org.onap.dmaap.datarouter.provisioning.beans.EventLogRecord; -import org.onap.dmaap.datarouter.provisioning.beans.Feed; import org.onap.dmaap.datarouter.provisioning.beans.IngressRoute; import org.onap.dmaap.datarouter.provisioning.eelf.EelfMsgs; import org.onap.dmaap.datarouter.provisioning.utils.DB; @@ -54,7 +54,7 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; @SuppressWarnings("serial") public class PublishServlet extends BaseServlet { - private int next_node; + private int nextNode; private String provstring; private List irt; //Adding EELF Logger Rally:US664892 @@ -66,35 +66,35 @@ public class PublishServlet extends BaseServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); - next_node = 0; + nextNode = 0; provstring = ""; - irt = new ArrayList(); + irt = new ArrayList<>(); } @Override - public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException { + public void doDelete(HttpServletRequest req, HttpServletResponse resp) { setIpAndFqdnForEelf("doDelete"); eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); redirect(req, resp); } @Override - public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + public void doGet(HttpServletRequest req, HttpServletResponse resp) { setIpAndFqdnForEelf("doGet"); eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); redirect(req, resp); } @Override - public void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException { + public void doPut(HttpServletRequest req, HttpServletResponse resp) { setIpAndFqdnForEelf("doPut"); eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_FEEDID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); redirect(req, resp); } @Override - public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { + public void doPost(HttpServletRequest req, HttpServletResponse resp) { setIpAndFqdnForEelf("doPost"); eelflogger.info(EelfMsgs.MESSAGE_WITH_BEHALF, req.getHeader(BEHALF_HEADER)); redirect(req, resp); @@ -155,7 +155,7 @@ public class PublishServlet extends BaseServlet { provstring = s; JSONObject jo = new JSONObject(new JSONTokener(provstring)); JSONArray ja = jo.getJSONArray("ingress"); - List newlist = new ArrayList(); + List newlist = new ArrayList<>(); for (int i = 0; i < ja.length(); i++) { IngressRoute iroute = new IngressRoute(ja.getJSONObject(i)); newlist.add(iroute); @@ -179,11 +179,11 @@ public class PublishServlet extends BaseServlet { // No IRT rule matches, do round robin of all active nodes String[] nodes = getNodes(); - if (next_node >= nodes.length) // The list of nodes may have grown/shrunk + if (nextNode >= nodes.length) // The list of nodes may have grown/shrunk { - next_node = 0; + nextNode = 0; } - return nodes[next_node++]; + return nodes[nextNode++]; } private int checkPath(HttpServletRequest req) { @@ -198,11 +198,15 @@ public class PublishServlet extends BaseServlet { } try { int feedid = Integer.parseInt(path.substring(0, ix)); - if (!Feed.isFeedValid(feedid)) { - return -1; + String provData = Poker.getPoker().getProvisioningString(); + JSONArray feeds = new JSONObject(provData).getJSONArray("feeds"); + for (int n = 0; n < feeds.length(); ++n) { + if (feeds.getJSONObject(n).getInt("feedid") == feedid) { + return feedid; + } } - return feedid; - } catch (NumberFormatException e) { + return -1; + } catch (NumberFormatException | JSONException e) { return -1; } } diff --git a/datarouter-subscriber/pom.xml b/datarouter-subscriber/pom.xml index ee28395c..b5c149c3 100755 --- a/datarouter-subscriber/pom.xml +++ b/datarouter-subscriber/pom.xml @@ -26,7 +26,7 @@ org.onap.dmaap.datarouter parent - 1.0.4-SNAPSHOT + 1.1.0-SNAPSHOT ../pom.xml datarouter-subscriber diff --git a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java index 38425748..28051285 100644 --- a/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java +++ b/datarouter-subscriber/src/main/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServlet.java @@ -140,9 +140,12 @@ public class SampleSubscriberServlet extends HttpServlet { URLEncoder.encode(fileid, "UTF-8").replaceAll("^\\.", "%2E").replaceAll("\\*", "%2A"); String fullPath = outputDirectory + "/" + filename; String tmpPath = outputDirectory + "/." + filename; + String fullMetaDataPath = outputDirectory + "/" + filename + ".M"; + String tmpMetaDataPath = outputDirectory + "/." + filename + ".M"; try { if (isdelete) { Files.deleteIfExists(Paths.get(fullPath)); + Files.deleteIfExists(Paths.get(fullMetaDataPath)); logger.info( "SampleSubServlet: Received delete for file id " + fileid @@ -154,6 +157,7 @@ public class SampleSubscriberServlet extends HttpServlet { + fullPath); } else { new File(tmpPath).createNewFile(); + new File(tmpMetaDataPath).createNewFile(); try (InputStream is = req.getInputStream(); OutputStream os = new FileOutputStream(tmpPath)) { byte[] buf = new byte[65536]; @@ -163,6 +167,11 @@ public class SampleSubscriberServlet extends HttpServlet { } } Files.move(Paths.get(tmpPath), Paths.get(fullPath), StandardCopyOption.REPLACE_EXISTING); + try (PrintWriter writer = new PrintWriter(new FileOutputStream(tmpMetaDataPath))) { + String metaData = req.getHeader("X-ATT-DR-META"); + writer.print(metaData); + } + Files.move(Paths.get(tmpMetaDataPath), Paths.get(fullMetaDataPath), StandardCopyOption.REPLACE_EXISTING); logger.info( "SampleSubServlet: Received file id " + fileid @@ -177,6 +186,7 @@ public class SampleSubscriberServlet extends HttpServlet { resp.setStatus(HttpServletResponse.SC_NO_CONTENT); } catch (IOException ioe) { Files.deleteIfExists(Paths.get(tmpPath)); + Files.deleteIfExists(Paths.get(tmpMetaDataPath)); logger.info( "SampleSubServlet: Failed to process file " + fullPath diff --git a/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java b/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java index e31b3473..f3700e9f 100755 --- a/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java +++ b/datarouter-subscriber/src/test/java/org/onap/dmaap/datarouter/subscriber/SampleSubscriberServletTest.java @@ -100,6 +100,7 @@ public class SampleSubscriberServletTest { when(request.getHeader("Authorization")).thenReturn("Basic TE9HSU46UEFTU1dPUkQ="); when(request.getPathInfo()).thenReturn("/publish/1/testfile"); when(request.getHeader("X-ATT-DR-PUBLISH-ID")).thenReturn("1"); + when(request.getHeader("X-ATT-DR-META")).thenReturn("{\"Key\":\"Value\"}"); when(request.getQueryString()).thenReturn(null); ServletInputStream inStream = mock(ServletInputStream.class); when(request.getInputStream()).thenReturn(inStream); diff --git a/docs/data-router/data-router.rst b/docs/data-router/data-router.rst index aaee3851..39d61e1c 100755 --- a/docs/data-router/data-router.rst +++ b/docs/data-router/data-router.rst @@ -54,36 +54,36 @@ Create a Feed Sample Request ============== -curl -v -X POST -H "Content-Type: application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addFeed3.txt --post301 --location-trusted -k https:/{host}:{port} +``curl -v -X POST -H "Content-Type: application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addFeed3.txt --post301 --location-trusted -k https:/{host}:{port}`` Request Parameters: =================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| name | Feed name | Body | String | <=20 | Y | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| version | Feed version | Body | String | <=20 | Y | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| description | Feed description | Body | String | | Y | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| business description | Business description | Body | String | | Y | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Authorization | Information for authorizing | Body | Object | | Y | | | -| | publishing requests | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| suspend | Set to true if the feed is in | Body | Boolean | | N | | * true | -| | the suspended state | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| group-id | | Body | Integer | | Y | | | -| | | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| content-type | To specify type of message | Header | String | 20 | N | | application/vnd.att-dr.feed | -| | (feed,subscriber,publisher) | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| X-ATT-DR-ON-BEHALF-OF | User id of owner of feed | Header | String | 1 | N | | username | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+======================================+ +| name | Feed name | Body | String | <=20 | Y | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| version | Feed version | Body | String | <=20 | Y | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| description | Feed description | Body | String | <=256 | Y | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| business description | Business description | Body | String | <=256 | Y | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Authorization | Information for authorizing | Body | Object | | Y | | +| | publishing requests | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| suspend | Set to true if the feed is in | Body | Boolean | | N | * true | +| | the suspended state | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| group-id | | Body | Integer | | Y | | +| | | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| content-type | To specify type of message | Header | String | | Y | application/vnd.att-dr.feed | +| | (feed,subscriber,publisher) | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| X-ATT-DR-ON-BEHALF-OF | User id of owner of feed | Header | String | 8 | Y | username | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ Response/Error Codes ==================== @@ -161,7 +161,7 @@ Sample Body ] }, -} + } Updating a Feed --------------- @@ -171,32 +171,32 @@ Updating a Feed Sample Request ============== -curl -v -X PUT -H "Content-Type: application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addFeed3.txt --location-trusted -k https:/{host}:{port} +``curl -v -X PUT -H "Content-Type: application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addFeed3.txt --location-trusted -k https:/{host}:{port}`` Request Parameters: =================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| description | Feed description | Body | String | | Y | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| business description | Business description | Body | String | | Y | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Authorization | Information for authorizing | Body | Object | | Y | | | -| | publishing requests | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| suspend | Set to true if the feed is in | Body | Boolean | | N | | * true | -| | the suspended state | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| group-id | | Body | Integer | | Y | | | -| | | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| content-type | To specify type of message | Header | String | 20 | N | | application/vnd.att-dr.feed | -| | (feed,subscriber,publisher) | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| X-ATT-DR-ON-BEHALF-OF | User id of owner of feed | Header | String | 1 | N | | username | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+======================================+ +| description | Feed description | Body | String | <=256 | Y | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| business description | Business description | Body | String | <=256 | Y | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Authorization | Information for authorizing | Body | Object | | Y | | +| | publishing requests | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| suspend | Set to true if the feed is in | Body | Boolean | | N | * true | +| | the suspended state | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| group-id | | Body | Integer | | Y | | +| | | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| content-type | To specify type of message | Header | String | | Y | application/vnd.att-dr.feed | +| | (feed,subscriber,publisher) | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| X-ATT-DR-ON-BEHALF-OF | User id of owner of feed | Header | String | 8 | Y | username | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ Response/Error Codes ==================== @@ -274,7 +274,7 @@ Sample Body ] }, -} + } Get a Feed ---------- @@ -291,7 +291,7 @@ http[s]://{host}:{port}/feed/{feedId} Sample Request ============== -curl -v -X GET -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/feed/{feedId} +``curl -v -X GET -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/feed/{feedId}`` Response/Error Codes ==================== @@ -352,7 +352,7 @@ http[s]://{host}:{port}/feed/{feedId} Sample Request ============== -curl -v -X DELETE -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/feed/{feedId} +``curl -v -X DELETE -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/feed/{feedId}`` Response/Error Codes ==================== @@ -412,37 +412,37 @@ http[s]://{host}:{port}/subscribe/{feedId} Sample Request ============== -curl -v -X POST -H "Content-Type: application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addSubscriber.txt --post301 --location-trusted -k https://{host}:{port}/subscribe/{feedId} +``curl -v -X POST -H "Content-Type: application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addSubscriber.txt --post301 --location-trusted -k https://{host}:{port}/subscribe/{feedId}`` Request Parameters: =================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| feedId | ID for the feed you are | Path | String | | Y | | | -| | subscribing to | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| delivery | Address and credentials for | Body | Object | | Y | | | -| | delivery | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| follow_redirect | Set to true if feed redirection | Body | Boolean | | Y | | * true | -| | is expected | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| metadata_only | Set to true if subscription is | Body | Boolean | | Y | | * true | -| | to receive per-file metadata | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| suspend | Set to true if the subscription | Body | Boolean | | N | | * true | -| | is in the suspended state | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| group-id | | Body | Integer | | Y | | | -| | | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| content-type | To specify type of message | Header | String | 20 | N | | application/vnd.att-dr.subscription | -| | (feed,subscriber,publisher) | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| X-ATT-DR-ON-BEHALF-OF | User id of subscriber | Header | String | 1 | N | | username | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+======================================+ +| feedId | ID for the feed you are | Path | String | | Y | | +| | subscribing to | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| delivery | Address and credentials for | Body | Object | | Y | | +| | delivery | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| follow_redirect | Set to true if feed redirection | Body | Boolean | | Y | * true | +| | is expected | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| metadata_only | Set to true if subscription is | Body | Boolean | | Y | * true | +| | to receive per-file metadata | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| suspend | Set to true if the subscription | Body | Boolean | | N | * true | +| | is in the suspended state | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| group-id | | Body | Integer | | Y | | +| | | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| content-type | To specify type of message | Header | String | | Y | application/vnd.att-dr.subscription | +| | (feed,subscriber,publisher) | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| X-ATT-DR-ON-BEHALF-OF | User id of subscriber | Header | String | 8 | Y | username | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ Response/Error Codes ==================== @@ -511,7 +511,7 @@ Sample Body "groupid" : 29, "subscriber" : "subscriber123" -} + } Update subscription ------------------- @@ -526,37 +526,37 @@ http[s]://{host}:{port}/subscribe/{feedId} Sample Request ============== -curl -v -X PUT -H "Content-Type: application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addSubscriber.txt --location-trusted -k https://{host}:{port}/subscribe/{feedId} +``curl -v -X PUT -H "Content-Type: application/vnd.att-dr.subscription" -H "X-ATT-DR-ON-BEHALF-OF: {user}" --data-ascii @/opt/app/datartr/addSubscriber.txt --location-trusted -k https://{host}:{port}/subscribe/{feedId}`` Request Parameters: =================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| feedId | ID for the subscription you are | Path | String | | Y | | | -| | updating | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| delivery | Address and credentials for | Body | Object | | Y | | | -| | delivery | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| follow_redirect | Set to true if feed redirection | Body | Boolean | | Y | | * true | -| | is expected | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| metadata_only | Set to true if subscription is | Body | Boolean | | Y | | * true | -| | to receive per-file metadata | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| suspend | Set to true if the subscription | Body | Boolean | | N | | * true | -| | is in the suspended state | | | | | | * false | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| group-id | | Body | Integer | | Y | | | -| | | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| content-type | To specify type of message | Header | String | 20 | N | | application/vnd.att-dr.subscription | -| | (feed,subscriber,publisher) | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| X-ATT-DR-ON-BEHALF-OF | User id of subscriber | Header | String | 1 | N | | username | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+======================================+ +| feedId | ID for the subscription you are | Path | String | | Y | | +| | updating | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| delivery | Address and credentials for | Body | Object | | Y | | +| | delivery | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| follow_redirect | Set to true if feed redirection | Body | Boolean | | Y | * true | +| | is expected | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| metadata_only | Set to true if subscription is | Body | Boolean | | Y | * true | +| | to receive per-file metadata | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| suspend | Set to true if the subscription | Body | Boolean | | N | * true | +| | is in the suspended state | | | | | * false | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| group-id | | Body | Integer | | Y | | +| | | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| content-type | To specify type of message | Header | String | | Y | application/vnd.att-dr.subscription | +| | (feed,subscriber,publisher) | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| X-ATT-DR-ON-BEHALF-OF | User id of subscriber | Header | String | 8 | Y | username | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ Response/Error Codes ==================== @@ -625,7 +625,7 @@ Sample Body "groupid" : 29, "subscriber" : "subscriber123" -} + } Get a Subscription @@ -643,7 +643,7 @@ http[s]://{host}:{port}/subscribe/{subId} Sample Request ============== -curl -v -X GET -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/subscribe/{subId} +``curl -v -X GET -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/subscribe/{subId}`` Response/Error Codes ==================== @@ -704,7 +704,7 @@ http[s]://{host}:{port}/feed/{feedId} Sample Request ============== -curl -v -X DELETE -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/subscribe/{feedId} +``curl -v -X DELETE -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/subscribe/{feedId}`` Response/Error Codes ==================== @@ -767,18 +767,26 @@ http[s]://{host}:{port}/publish/{feedId}/{fileName} Request parameters ================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| feedId | ID of the feed you are | Path | String | | Y | | | -| | publishing to | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| fileId | Name of the file when it is | Path | String | | Y | | | -| | published to subscribers | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| content-type | To specify type of message | Header | String | 20 | N | | application/octet-stream | -| | format | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+==========================================================================+ +| feedId | ID of the feed you are | Path | String | | Y | | +| | publishing to | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------------------------------------------+ +| fileId | Name of the file when it is | Path | String | | Y | | +| | published to subscribers | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------------------------------------------+ +| content-type | To specify type of message | Header | String | | Y | application/octet-stream | +| | format | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------------------------------------------+ +| X-ATT-DR-META | Metadata for the file. Accepts | Header | String | 4096 | N | '{"compressionType":"gzip","id": 1234, "transferred":true, "size":null}' | +| | only non nested json objects | | | | | | +| | of the following type : | | | | | | +| | -Numbers | | | | | | +| | -Strings | | | | | | +| | -Lowercase boolean | | | | | | +| | -null | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------------------------------------------+ Response/Error Codes ==================== @@ -812,7 +820,7 @@ Response/Error Codes Sample Request ============== -curl -v -X PUT --user {user}:{password} -H "Content-Type: application/octet-stream" --data-binary @/opt/app/datartr/sampleFile.txt --post301 --location-trusted -k https://{host}:{port}/publish/{feedId}/sampleFile.txt +``curl -v -X PUT --user {user}:{password} -H "Content-Type: application/octet-stream" -H X-ATT-DR-META:'{"filetype":"zip"}' --data-binary @/opt/app/datartr/sampleFile.txt --post301 --location-trusted -k https://{host}:{port}/publish/{feedId}/sampleFile.txt`` Delete a Published file ----------------------- @@ -830,7 +838,7 @@ http[s]://{host}:{port}/publish/{feedId}/{fileId} Sample Request ============== -curl -v -X DELETE -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/publish/{feedId}/{fileId} +``curl -v -X DELETE -H "X-ATT-DR-ON-BEHALF-OF: {user}" --location-trusted -k https:/{host}:{port}/publish/{feedId}/{fileId}`` Response/Error Codes ==================== @@ -878,37 +886,37 @@ http[s]://{host}:{port}/feedlog/{feedId}?{queryParameter} Request parameters ================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| feedId | Id of the feed you want | Path | String | | N | | 1 | -| | logs from | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| type | Select records of the | Path | String | | N | | * pub: Publish attempt | -| | specified type | | | | | | * del: Delivery attempt | -| | | | | | | | * exp: Delivery expiry | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| publishId | Select records with specified | Path | String | | N | | | -| | publish id, carried in the | | | | | | | -| | X-ATT-DR-PUBLISH-ID header from | | | | | | | -| | original publish request | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| start | Select records created at or | Path | String | | N | | A date-time expressed in the format | -| | after specified date | | | | | | specified by RFC 3339 | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| end | Select records created at or | Path | String | | N | | A date-time expressed in the format | -| | before specified date | | | | | | specified by RFC 3339 | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| statusCode | Select records with the | Path | String | | N | | An HTTP Integer status code or one | -| | specified statusCode field | | | | | | of the following special values: | -| | | | | | | | | -| | | | | | | | * Success: Any code between 200-299 | -| | | | | | | | * Redirect: Any code between 300-399 | -| | | | | | | | * Failure: Any code > 399 | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| expiryReason | Select records with the | Path | String | | N | | | -| | specified expiry reason | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+======================================+ +| feedId | Id of the feed you want | Path | String | | N | 1 | +| | logs from | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| type | Select records of the | Path | String | | N | * pub: Publish attempt | +| | specified type | | | | | * del: Delivery attempt | +| | | | | | | * exp: Delivery expiry | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| publishId | Select records with specified | Path | String | | N | | +| | publish id, carried in the | | | | | | +| | X-ATT-DR-PUBLISH-ID header from | | | | | | +| | original publish request | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| start | Select records created at or | Path | String | | N | A date-time expressed in the format | +| | after specified date | | | | | specified by RFC 3339 | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| end | Select records created at or | Path | String | | N | A date-time expressed in the format | +| | before specified date | | | | | specified by RFC 3339 | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| statusCode | Select records with the | Path | String | | N | An HTTP Integer status code or one | +| | specified statusCode field | | | | | of the following special values: | +| | | | | | | | +| | | | | | | * Success: Any code between 200-299 | +| | | | | | | * Redirect: Any code between 300-399 | +| | | | | | | * Failure: Any code > 399 | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| expiryReason | Select records with the | Path | String | | N | | +| | specified expiry reason | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ Response Parameters =================== @@ -1009,7 +1017,7 @@ Response/Error Codes Sample Request ============== -curl -v -k https://{host}:{port}/feedlog/{feedId}?statusCode=204 +``curl -v -k https://{host}:{port}/feedlog/{feedId}?statusCode=204`` Subscriber logging ------------------ @@ -1028,38 +1036,38 @@ http[s]://{host}:{port}/sublog/{subId}?{queryParameter} Request parameters ================== -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| Name | Description | Param Type | Data Type | MaxLen | Required | Format | Valid/Example Values | -+========================+=================================+==================+============+==============+=============+=====================+======================================+ -| subId | Id of the feed you want | Path | String | | N | | 1 | -| | logs from | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| type | Select records of the | Path | String | | N | | * pub: Publish attempt | -| | specified type | | | | | | * del: Delivery attempt | -| | | | | | | | * exp: Delivery expiry | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| publishId | Select records with specified | Path | String | | N | | | -| | publish id, carried in the | | | | | | | -| | X-ATT-DR-PUBLISH-ID header from | | | | | | | -| | original publish request | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| start | Select records created at or | Path | String | | N | | A date-time expressed in the format | -| | after specified date | | | | | | specified by RFC 3339 | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| end | Select records created at or | Path | String | | N | | A date-time expressed in the format | -| | before specified date | | | | | | specified by RFC 3339 | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| statusCode | Select records with the | Path | String | | N | | An Http Integer status code or one | -| | specified statusCode field | | | | | | of the following special values: | -| | | | | | | | | -| | | | | | | | * Success: Any code between 200-299 | -| | | | | | | | * Sedirect: Any code between 300-399 | -| | | | | | | | * Sailure: Any code > 399 | -| | | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ -| expiryReason | Select records with the | Path | String | | N | | | -| | specified expiry reason | | | | | | | -+------------------------+---------------------------------+------------------+------------+--------------+-------------+---------------------+--------------------------------------+ ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| Name | Description | Param Type | Data Type | MaxLen | Required | Valid/Example Values | ++========================+=================================+==================+============+==============+=============+======================================+ +| subId | Id of the feed you want | Path | String | | N | 1 | +| | logs from | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| type | Select records of the | Path | String | | N | * pub: Publish attempt | +| | specified type | | | | | * del: Delivery attempt | +| | | | | | | * exp: Delivery expiry | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| publishId | Select records with specified | Path | String | | N | | +| | publish id, carried in the | | | | | | +| | X-ATT-DR-PUBLISH-ID header from | | | | | | +| | original publish request | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| start | Select records created at or | Path | String | | N | A date-time expressed in the format | +| | after specified date | | | | | specified by RFC 3339 | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| end | Select records created at or | Path | String | | N | A date-time expressed in the format | +| | before specified date | | | | | specified by RFC 3339 | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| statusCode | Select records with the | Path | String | | N | An Http Integer status code or one | +| | specified statusCode field | | | | | of the following special values: | +| | | | | | | | +| | | | | | | * Success: Any code between 200-299 | +| | | | | | | * Redirect: Any code between 300-399 | +| | | | | | | * Failure: Any code > 399 | +| | | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ +| expiryReason | Select records with the | Path | String | | N | | +| | specified expiry reason | | | | | | ++------------------------+---------------------------------+------------------+------------+--------------+-------------+--------------------------------------+ Response Parameters =================== @@ -1161,4 +1169,4 @@ Response/Error Codes Sample Request ============== -curl -v -k https://{host}:{port}/sublog/{subscriberId}?statusCode=204 \ No newline at end of file +``curl -v -k https://{host}:{port}/sublog/{subscriberId}?statusCode=204`` diff --git a/docs/data-router/dr_arch.png b/docs/data-router/dr_arch.png index 1655edad..54cd7e8d 100644 Binary files a/docs/data-router/dr_arch.png and b/docs/data-router/dr_arch.png differ diff --git a/docs/data-router/logging.rst b/docs/data-router/logging.rst index ac6aa95c..6ac7a0a3 100644 --- a/docs/data-router/logging.rst +++ b/docs/data-router/logging.rst @@ -15,11 +15,19 @@ Currently Data Router does not have any unique error codes. However the followin could possibly occur in Data Router: OK = 200 : The normal response from a successful update or get of a feed or subscription + CREATED = 201 : the normal response from successfully creating or subscribing to a feed. + NO_CONTENT = 204 : the normal response from a successful publish attempt and on successfully deleting a feed or subscription + MOVED_PERMANENTLY = 301 :the normal redirect response from prov to a publisher + BAD_REQUEST = 400: Usually indicates that either Json object in request body is incorrect in some way, or an Invalid parameter value was included in query string. + UNAUTHORIZED = 401 : Usually indicated either request was missing Authorization header, or indicates incorrect Username/password credentials + FORBIDDEN = 403 : Usually indicates the request originated from an unauthorized IP address, or that a client certificate was not a part of authorized list. + NOT_FOUND = 404 : Usually indicates an incorrect URI + METHOD_NOT_ALLOWED = 405 : Indicates an HTTP method is not accepted for given URI \ No newline at end of file diff --git a/pom.xml b/pom.xml index a615605c..01d8afc2 100755 --- a/pom.xml +++ b/pom.xml @@ -26,13 +26,13 @@ org.onap.dmaap.datarouter parent dmaap-datarouter - 1.0.4-SNAPSHOT + 1.1.0-SNAPSHOT pom https://github.com/att/DMAAP_DATAROUTER org.onap.oparent oparent - 1.2.1 + 1.2.2 UTF-8 @@ -46,7 +46,7 @@ ${project.build.directory}/coverage-reports/jacoco-it.exec true ${project.version} - 9.3.8.RC0 + 9.4.14.v20181114 8.2.0.v20160908 1.5.5 2.1.1 diff --git a/version.properties b/version.properties index 05d01ad2..af11c22b 100644 --- a/version.properties +++ b/version.properties @@ -26,8 +26,8 @@ # because they are used in Jenkins, whose plug-in doesn't support major=1 -minor=0 -patch=4 +minor=1 +patch=0 base_version=${major}.${minor}.${patch}