METRON-1638: Retrieve Pcap results in pdml format#1120
METRON-1638: Retrieve Pcap results in pdml format#1120merrimanr wants to merge 57 commits intoapache:feature/METRON-1554-pcap-query-panelfrom
Conversation
Pcap job manager generics from cestella
…r for synchronicity. Kill remnants of the job service.
…into pcap-job-manager
Get PcapTopologyIntegrationTest working
# Conflicts: # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestConstants.java # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/PcapController.java # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/PcapService.java # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/PcapServiceImpl.java # metron-interface/metron-rest/src/main/resources/application.yml # metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/PcapServiceImplTest.java
# Conflicts: # metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/PcapServiceImplTest.java
…r cestella request.
…into pcap-job-manager
# Conflicts: # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/PcapServiceImpl.java
…anel' into METRON-1638
| <description>Interfaces for Metron</description> | ||
| <url>https://metron.apache.org/</url> | ||
| <properties> | ||
| <jackson.version>2.9.5</jackson.version> |
There was a problem hiding this comment.
It's used in both metron-rest and metron-rest-client. We are using several different jackson libraries.
There was a problem hiding this comment.
Ok, do me a favor, when you test this out in full-dev, make sure that you can continue to use the REST endponts backing the management UI. We often have issues with classpath issues around newer versions of Jackson. Should we exclude the other jackson dependencies coming in transitively in metron-rest and metron-rest-client?
There was a problem hiding this comment.
I tested the other endpoints and everything seems to still be functioning. I also inspected the mvn dependency tree and it looks like the jackson version is consistent across dependencies.
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| tshark -i - -T pdml |
There was a problem hiding this comment.
Can we make sure to add to the docs as part of this PR that we now rely on tshark being installed?
There was a problem hiding this comment.
Working on that now.
|
Latest commit documents wireshark dependency and gives instructions for possibly extending the |
|
+1 by inspection, this looks good. |
| %dir %{metron_home}/lib | ||
| %{metron_home}/config/rest_application.yml | ||
| %{metron_home}/bin/metron-rest.sh | ||
| %{metron_home}/bin/pcap_to_pdml.sh |
There was a problem hiding this comment.
Is there anything to be done for the ubuntu debs?
There was a problem hiding this comment.
I tested this by building the ubuntu debs with mvn clean package -Pbuild-debs. I did not encounter any issues.
|
Couple comments
Could you take a look into the Swagger issue and see if we can suss out what that might be? Assuming we can get that fixed (or at least diagnosed and ticketed if it's unrelated, so we can make sure to fix it before it goes into master), I'm good with this PR. |
|
I checked in Safari, and the problem appears to be limited to just my Chrome and just those endpoints. @merrimanr if you've tried this in Chrome, I'm inclined to assume it's a problem with my machine and call this good to go. |
|
After chatting with @merrimanr offline, I'm pretty sure it's my problem. It's not reproducible on his machine, and I can copy out chrome's actual request as a curl and run it with it working. +1, thanks for the contribution. |
…anel' into METRON-1638 # Conflicts: # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/PcapController.java # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/PcapService.java # metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/PcapServiceImpl.java # metron-interface/metron-rest/src/test/java/org/apache/metron/rest/controller/PcapControllerIntegrationTest.java # metron-interface/metron-rest/src/test/java/org/apache/metron/rest/service/impl/PcapServiceImplTest.java
Contributor Comments
This PR adds a REST endpoint that returns pcap query results for the specified page in PDML format (serialized as json instead of xml). This will allow us to display pcap information in the Alerts UI.
A new getPdml method was added to the PcapService. This function gets a HDFS input stream given a path that's looked up by username, job id and page number. A Java Process object calls out to a
pcap_to_pdml.shscript that wraps a simple tshark command. The HDFS inputs stream is connected to standard in of the script and PDML results are read from the process output stream. Jackson is then used to convert the output xml to json and returned.Changes Included
pcap_to_pdml.shscript that wraps a simple tshark command and can be extended as neededTesting
This has been tested in full dev. Testing instructions are as follows:
/apps/metron/pcap/inputYou should get an error message that clearly states wireshark is missing:
yum -y install wireshark. This time PDML should be returned:I'm still working on adding some documentation to the script and endpoint. Otherwise this PR is ready for review. Expect another doc commit shortly.
Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our Development Guidelines for the complete guide to follow for contributions.
Please refer also to our Build Verification Guidelines for complete smoke testing guides.
In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:
For all changes:
For code changes:
Have you included steps to reproduce the behavior or problem that is being changed or addressed?
Have you included steps or a guide to how the change may be verified and tested manually?
Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:
Have you written or updated unit tests and or integration tests to verify your changes?
If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
For documentation related changes:
Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via
site-book/target/site/index.html:Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
It is also recommended that travis-ci is set up for your personal repository such that your branches are built there before submitting a pull request.