[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-27 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16593619#comment-16593619
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user asfgit closed the pull request at:

https://github.com/apache/metron/pull/1172


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-24 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16591798#comment-16591798
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on the issue:

https://github.com/apache/metron/pull/1172
  
I verified that bug is fixed now.  Nice job +1.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-24 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16591751#comment-16591751
 ] 

ASF GitHub Bot commented on METRON-1724:


GitHub user tiborm reopened a pull request:

https://github.com/apache/metron/pull/1172

METRON-1724: Date/time validation missing in PCAP query

## Contributor Comments
This PR contains date range validation. We added validation messages with 
hints also, to help the user correct a particular input problem.

https://user-images.githubusercontent.com/2437400/44151039-9f5ced76-a0a1-11e8-9655-c11765987b28.png;>

As a part of this changeset, we refactored pcap-filter.component to make it 
more aligned with some Angular best practices. We introduced 
ReactiveFormsModule to make form handling similar to other observable based 
solutions in Angular.
ReactiveFormsModule also helped us to remove validation logic from the HTML 
template, make it part of component.ts and handle more complex validations like 
in case of the date range.

For more details please check the following Jira ticket: 
https://issues.apache.org/jira/browse/METRON-1724

## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 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:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
- [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?


### For code changes:
- [x] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
- [x] Have you included steps or a guide to how the change may be verified 
and tested manually?
- [x] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via:
  ```
  mvn -q clean integration-test install && 
dev-utilities/build-utils/verify_licenses.sh 
  ```

- [x] Have you written or updated unit tests and or integration tests to 
verify your changes?
- [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] 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:
- [x] 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`:

  ```
  cd site-book
  mvn site
  ```

 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](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/tiborm/metron METRON-1724

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/1172.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1172


commit 79b327fa96d6be8aea0f9bcf07f3f58ccd699581
Author: tiborm 
Date:   2018-08-22T10:17:12Z

making date picker compatible with ReactiveFormsModule

commit 89310c608ba1c2354aea74c946aa94c9f15b4978
Author: tiborm 
Date:   2018-08-22T10:18:01Z

fixing tslint warnings

commit cf3b1a7e802aaa803efe97b3df239f539c9d44e9
Author: tiborm 
Date:   2018-08-22T10:27:24Z

merging udpPort handlig and tslint fixes togheter

commit 3394575f4ec110c884b0ef825bed8c5a70a47749
Author: tiborm 
Date:   2018-08-22T10:27:46Z

adding ReactiveFormsModule

commit 

[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-24 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16591750#comment-16591750
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm closed the pull request at:

https://github.com/apache/metron/pull/1172


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-24 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16591592#comment-16591592
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on the issue:

https://github.com/apache/metron/pull/1172
  
It's not just simply about sharing the same validator function. It's more 
complicated than that. Here's a possible fix for that: 
https://github.com/tiborm/metron/pull/11


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-24 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16591249#comment-16591249
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on the issue:

https://github.com/apache/metron/pull/1172
  
I think the problem is that we use the same validator function for both the 
start and the end date. 

So after putting it into an invalid state (step 2), however you add a valid 
time to the start date, the validator function will complain because the end 
time is still in an invalid state. That's why the start time is still marked in 
red.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590564#comment-16590564
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on the issue:

https://github.com/apache/metron/pull/1172
  
I found one small bug.  Here's how to reproduce:

1. Set the FROM date to be greater than the TO date.  A validation message 
should appear as expected.
2. Set the TO date to be in the future.  Validation message still displays 
as expected and both inputs are marked with red.
3. Change the FROM date to be less than the TO date and not in the future.  
The FROM date is still marked in red when it should not be.
4. Change the TO date to not be in the future but greater than the FROM 
date.  The TO data is no longer marked in red but the validation message is 
still displayed.  At this point there should be no validation messages.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590532#comment-16590532
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on the issue:

https://github.com/apache/metron/pull/1172
  
As a result of the followup discussion about the placing of the transform 
functions, I moved them back to the filter component.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590529#comment-16590529
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212383664
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
 ---
@@ -179,19 +172,6 @@ describe('PcapFiltersComponent', () => {
 component.onSubmit();
   });
 
-  it('Port fields should be removed from request when set to empty', () => 
{
--- End diff --

It was intentional. We changed back the port type to string so this 
behavior not needed anymore.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590434#comment-16590434
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212369764
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-packet-line/pcap-packet-line.component.spec.ts
 ---
@@ -143,38 +132,4 @@ describe('PcapPacketLineComponent', () => {
   "protos": null 
 });
   });
-
-  it('should extract UDP ipSrcPort fields', () => {
--- End diff --

Merge issue. I checked these and the related code change too. Got no idea 
how could I missed these. Fixing.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590341#comment-16590341
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212342518
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-packet-line/pcap-packet-line.component.spec.ts
 ---
@@ -143,38 +132,4 @@ describe('PcapPacketLineComponent', () => {
   "protos": null 
 });
   });
-
-  it('should extract UDP ipSrcPort fields', () => {
--- End diff --

Why were these tests removed?


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590339#comment-16590339
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212341861
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
 ---
@@ -179,19 +172,6 @@ describe('PcapFiltersComponent', () => {
 component.onSubmit();
   });
 
-  it('Port fields should be removed from request when set to empty', () => 
{
--- End diff --

Why was this test removed?


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16590192#comment-16590192
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on the issue:

https://github.com/apache/metron/pull/1172
  
@sardell @ruffle1986 I made the following changes based on your feedback:

- default values for the timestamps removed
- DEFAULT_START_TIME and DEFAULT_END_TIME moved to constants.ts 
(theoretically these values are reusable)
- transform functions moved to utils.ts to make the filter component cleaner

I think this is cleaner and more aligned with the other parts of the code.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16589824#comment-16589824
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212205588
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

Yes, probably that would be the best because somehow, this request related 
stuff doesn't want to fit in with the filter component :D


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16589819#comment-16589819
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212205052
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
--- End diff --

but, again. it's the type of the request which is fine. we don't have to 
use the same values to set the state of the filter ui component. it can be a 
totally different type. When it comes to sending the request to the server (or 
getting a response from it), this is the proper place where we're supposed to 
deal with request types.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16589817#comment-16589817
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212204263
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
--- End diff --

It's not necessary to set these values here but I'm afraid the server 
relies on it as default values. So it might crash if we send it undefined 
values instead of magic numbers.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16589767#comment-16589767
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212196734
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

@sardell @ruffle1986  I'll refactor out the whole PcapRequest related code 
from the filter. It was part of the original implementation but I think it does 
not belongs to here. Filter component should produce a filter output instead of 
a request object. 


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16589067#comment-16589067
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user sardell commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r212012726
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

Agreed with @tiborm on renaming those constants. In fact, the Angular Style 
Guide [prefers to use lower camel case (though it also suggests tolerating 
existing upper snake case) for 
constants.](https://angular.io/guide/styleguide#constants) I also prefer not to 
worry about an imagined future, but I do think we should move some of this out 
to separate files if it doesn't belong in the class to make the file more 
readable, if anything.



> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588988#comment-16588988
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211990573
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
--- End diff --

I think it would be better to leave them undefined here and let this file 
to be a simple type definition. 


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588985#comment-16588985
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211989622
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
--- End diff --

I agree. These default values should be fixed. Do we needs to assign value 
to the dates here?


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588930#comment-16588930
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211979831
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

I think the DEFAULT_START_TIME and DEFAULT_END_TIME as all uppercase 
variables are a bit miss leading. These are not static finals like in java. 
These are actually private constants. I suggest to rename them to normal 
camelCase. DEFAULT_END_TIME might be reusable somewhere else but 
DEFAULT_START_TIME in its current form really belongs to the filtering. I think 
the same true to the validator and the transform functions too. Validator might 
be reusable if we turn our other forms reactive too in the future. For me, the 
question is how much we like to prepare our current code to an imagined future. 
And how much it supports the understanding of the existing functionality. I 
would leave it as it is right now but opened to refactor it if we see value in 
it.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588909#comment-16588909
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211972645
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

They belong to the file's scope.

They could collide with others but we can import them in this way:

```
import { DEFAULT_END_TIME as DEFAULT_PCAP_FILTER_END_TIME } from 
'./pcap-filter.component';
```

But I can hardly imagine that we would use them somewhere else out of this 
scope.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588904#comment-16588904
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211970078
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
--- End diff --

Why the magic number?

We use this value to produce a formatted date string by using the Date 
constructor. But

```js
new Date(15) // -> Invalid Date
```

so we have to do extra checks to avoid showing "Invalid Date" in the date 
range selector:

https://github.com/tiborm/metron/blob/METRON-1724/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts#L59

which makes it hard to understand and maintain the code.

Using magic numbers is a bad practice because it's hard to understand their 
meaning. We should add a hint as a code comment at least. Or use another, more 
straightforward value. 
My first thought was `Date.now()` but it would introduce side effects so I 
let it go.

What do you think?


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=1657#comment-1657
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user simonellistonball commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211964997
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

These names do look like they are likely to collide with other potential 
areas of functionality though, so if they are genuinely global concerns, then 
fine, otherwise they should probably belong to some form of scope related to 
the relevant component.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588867#comment-16588867
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user ruffle1986 commented on a diff in the pull request:

https://github.com/apache/metron/pull/1172#discussion_r211960374
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
 ---
@@ -15,63 +15,116 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, Input, Output, EventEmitter, OnInit, OnChanges, 
SimpleChanges} from '@angular/core';
+import {Component, Input, Output, EventEmitter, OnChanges, SimpleChanges} 
from '@angular/core';
+import { FormGroup, FormControl, Validators, ValidationErrors } from 
'@angular/forms';
+
 import * as moment from 'moment/moment';
 import { DEFAULT_TIMESTAMP_FORMAT } from '../../utils/constants';
 
 import { PcapRequest } from '../model/pcap.request';
 
+const DEFAULT_END_TIME = new Date();
--- End diff --

For the record, in this case, it would be ok to put these things inside the 
class definition because they're connected to the pcap filter so they would be 
hardly reused by other components, but who knows. It's hard to predict.

I'm not sure about how these kind of things work in Java or other OOP heavy 
programming languages but Javascript (NodeJS) doesn't enforce us to put 
constants and static functions inside a class. 

The functions are static pure functions. They have nothing to do with the 
class' instance (this) so they should not be a private or a public class 
methods. they could be a static functions (a property of the class object 
itself). From testing perspective, I would keep it as is but export them of 
course so we wouldn't have to create a new instance of the component to test 
them. The best would be if they were replaced into a separate file in the 
appropriate folder based on whether it's shared across other components.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16588706#comment-16588706
 ] 

ASF GitHub Bot commented on METRON-1724:


GitHub user tiborm opened a pull request:

https://github.com/apache/metron/pull/1172

METRON-1724: Date/time validation missing in PCAP query

## Contributor Comments
This PR contains date range validation. We added validation messages with 
hints also, to help the user correct a particular input problem.

https://user-images.githubusercontent.com/2437400/44151039-9f5ced76-a0a1-11e8-9655-c11765987b28.png;>

As a part of this changeset, we refactored pcap-filter.component to make it 
more aligned with some Angular best practices. We introduced 
ReactiveFormsModule to make form handling similar to other observable based 
solutions in Angular.
ReactiveFormsModule also helped us to remove validation logic from the HTML 
template, make it part of component logic and handle more complex validations 
like in case of the date range.

For more details please check the following Jira ticket: 
https://issues.apache.org/jira/browse/METRON-1724

## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 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:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
- [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?


### For code changes:
- [x] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
- [x] Have you included steps or a guide to how the change may be verified 
and tested manually?
- [x] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via:
  ```
  mvn -q clean integration-test install && 
dev-utilities/build-utils/verify_licenses.sh 
  ```

- [x] Have you written or updated unit tests and or integration tests to 
verify your changes?
- [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] 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:
- [x] 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`:

  ```
  cd site-book
  mvn site
  ```

 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](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/tiborm/metron METRON-1724

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/1172.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1172


commit 79b327fa96d6be8aea0f9bcf07f3f58ccd699581
Author: tiborm 
Date:   2018-08-22T10:17:12Z

making date picker compatible with ReactiveFormsModule

commit 89310c608ba1c2354aea74c946aa94c9f15b4978
Author: tiborm 
Date:   2018-08-22T10:18:01Z

fixing tslint warnings

commit cf3b1a7e802aaa803efe97b3df239f539c9d44e9
Author: tiborm 
Date:   2018-08-22T10:27:24Z

merging udpPort handlig and tslint fixes togheter

commit 3394575f4ec110c884b0ef825bed8c5a70a47749
Author: tiborm 
Date:   2018-08-22T10:27:46Z

adding ReactiveFormsModule

commit 

[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581550#comment-16581550
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm closed the pull request at:

https://github.com/apache/metron/pull/1165


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581549#comment-16581549
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on the issue:

https://github.com/apache/metron/pull/1165
  
Thank you guys for the reivew! It seems there is too many issue with the 
PR. I'm going to close it and open a new one after we fixed the merge issues 
etc.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581510#comment-16581510
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on a diff in the pull request:

https://github.com/apache/metron/pull/1165#discussion_r210379924
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
+  ipSrcAddr = '';
+  ipSrcPort = 0;
--- End diff --

These default values was part of the handovered implementation. It haven't 
caused issues till now. Anyway these defaults makes no sense to me eigther. 
I'll fix it retest against the latest full dev.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581417#comment-16581417
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user mmiklavc commented on the issue:

https://github.com/apache/metron/pull/1165
  
@tiborm - I'm a little uneasy about the merge conflicts and commit history, 
as pointed out by @merrimanr. The number of changes *seems* relatively small, 
but per Ryan's review it looks like we had some previously-fixed regressions 
sneak back in. Also, there are merge conflicts showing in PcapCliTest, which 
I'm 100% certain you will not have modified in any way. Can you close/modify 
this PR by applying these changes on top of a fresh feature branch pull and 
then re-submitting? That should eliminate some ambiguity with the merge. 


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581230#comment-16581230
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1165#discussion_r210306554
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
 ---
@@ -179,19 +171,6 @@ describe('PcapFiltersComponent', () => {
 component.onSubmit();
   });
 
-  it('Port fields should be removed from request when set to empty', () => 
{
--- End diff --

Why was this test removed?  This was added to catch a regression introduced 
in a previous PR.  Now this test is gone and the regression is back!


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581228#comment-16581228
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1165#discussion_r210306465
  
--- Diff: 
metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
 ---
@@ -263,10 +230,10 @@ describe('PcapFiltersComponent', () => {
   model: new SimpleChange(null, newModel, false)
 });
 
-expect(component.startTimeStr).toBe(startTimeStr);
-expect(component.endTimeStr).toBe(endTimeStr);
-expect(component.ipSrcPort).toBe('');
-expect(component.ipDstPort).toBe('');
+
expect(component.filterForm.controls.startTime.value).toBe(startTimeStr);
+expect(component.filterForm.controls.endTime.value).toBe(endTimeStr);
+expect(component.filterForm.controls.ipSrcPort.value).toBe(0);
--- End diff --

Why would we want the ports to be 0 here?  This query is incorrect.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581175#comment-16581175
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on the issue:

https://github.com/apache/metron/pull/1165
  
I tested this in full dev and it is not working.  The From date is 
`1969-12-31 18:00:00` and the To date says `Invalid date`.  The Src and Dst 
port fields are also populated with 0.

It also looks like there were significant changes introduced to 
PcapFiltersComponent and a new DatePickerComponent.  Can you briefly describe 
what you changed and why?  It would also be helpful if we have some testing 
instructions.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581138#comment-16581138
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1165#discussion_r210285682
  
--- Diff: metron-interface/metron-alerts/src/app/pcap/model/pcap.request.ts 
---
@@ -17,13 +17,13 @@
  */
 
 export class PcapRequest {
-  startTimeMs: number = 0;
-  endTimeMs: number = 15;
-  ipSrcAddr: string = '';
-  ipSrcPort: number;
-  ipDstAddr: string = '';
-  ipDstPort: number;
-  protocol: string = '';
-  packetFilter: string = '';
-  includeReverse: boolean = false;
+  startTimeMs = 0;
+  endTimeMs = 15;
+  ipSrcAddr = '';
+  ipSrcPort = 0;
--- End diff --

Why are we defaulting these ports to 0?  A similar change was introduced in 
https://github.com/apache/metron/pull/1142 that caused a regression because 
queries were filtering ports with a value of 0 by default.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581135#comment-16581135
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1165#discussion_r210284527
  
--- Diff: 
metron-platform/metron-pcap-backend/src/test/java/org/apache/metron/pcap/query/PcapCliTest.java
 ---
@@ -172,7 +172,8 @@ public void 
runs_fixed_pcap_filter_job_with_full_argument_list_and_default_datef
 "-protocol", "6",
 "-include_reverse",
 "-num_reducers", "10",
-"-records_per_file", "1000"
+"-records_per_file", "1000",
--- End diff --

This looks like a bad merge.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581134#comment-16581134
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user merrimanr commented on a diff in the pull request:

https://github.com/apache/metron/pull/1165#discussion_r210284388
  
--- Diff: 
metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/mr/PcapJob.java
 ---
@@ -494,6 +494,10 @@ protected void setMrJob(Job mrJob) {
 }
   }
 
+  public void monitorJob() throws IOException, InterruptedException {
--- End diff --

This looks like a bad merge.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581080#comment-16581080
 ] 

ASF GitHub Bot commented on METRON-1724:


Github user tiborm commented on the issue:

https://github.com/apache/metron/pull/1165
  
Thanks for reviewing! Please test this PR carefully becasue of the large 
amount of merge conflicts we solved part of this. We tested manually too, but 
it would be great to double check. 

All the unit tests are green.


> Date/time validation missing in PCAP query
> --
>
> Key: METRON-1724
> URL: https://issues.apache.org/jira/browse/METRON-1724
> Project: Metron
>  Issue Type: Bug
>Reporter: Tibor Meller
>Priority: Major
>
> Validation formula should be the following: 
>  From < To < current date/time
>  
> Validation messages:
> Selected date range is invalid. The "To" date must be later than the "From" 
> date and the "To" date cannot be in the future.
> Source IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Source port is invalid. Port number must be within the range of 0-65535.
> Destination IP address format is invalid. Use valid v4IP format, for example, 
> [192.168.0.1|http://192.168.0.1/].
> Destination port is invalid. Port number must be within the range of 0-65535.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16581077#comment-16581077
 ] 

ASF GitHub Bot commented on METRON-1724:


GitHub user tiborm opened a pull request:

https://github.com/apache/metron/pull/1165

METRON-1724: Date/time validation missing in PCAP query

## Contributor Comments
This PR contains date range validation. We also added validation messages 
with hints for the user how to correct a particular input problem.

https://user-images.githubusercontent.com/2437400/44151039-9f5ced76-a0a1-11e8-9655-c11765987b28.png;>

For more details please check the following Jira ticket: 
https://issues.apache.org/jira/browse/METRON-1724

## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 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:
- [ ] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [ ] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?


### 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:
  ```
  mvn -q clean integration-test install && 
dev-utilities/build-utils/verify_licenses.sh 
  ```

- [ ] 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](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] 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`:

  ```
  cd site-book
  mvn site
  ```

 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](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/tiborm/metron METRON-1724

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/1165.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1165


commit 872d1b1ee13e358c18956945d71d3667d19fca8a
Author: merrimanr 
Date:   2018-04-12T14:57:48Z

Merge branch 'pcap-front' of https://github.com/simonellistonball/metron 
into pcaprest

Conflicts:
metron-interface/metron-alerts/src/app/app.module.ts

commit b1b6a7dabea1a1d0d132482c8d97af29c0ac2683
Author: merrimanr 
Date:   2018-04-13T15:00:15Z

initial commit

 Conflicts:

metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestApplication.java

metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/PcapQueryController.java

metron-interface/metron-rest/src/main/java/org/apache/metron/rest/util/pcapQueryThread.java

commit 55cf2d945a4fcff1e7e2e47a234037ed6f394b2e
Author: merrimanr 
Date:   2018-04-18T15:52:56Z

added license headers

commit 70696d047c6ef4b8ce5fcda03588474ff5b2c506
Author: tiborm 
Date:   2018-07-11T14:58:56Z

METRON-1662: adding download button to pcap tab

commit 

[jira] [Commented] (METRON-1724) Date/time validation missing in PCAP query

2018-08-07 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/METRON-1724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16571847#comment-16571847
 ] 

ASF GitHub Bot commented on METRON-1724:


GitHub user tiborm opened a pull request:

https://github.com/apache/metron/pull/1142

Metron-1712: Input validation

## Contributor Comments
This PR contains the input validation for ipSrcAdr, ipSrcPort, ipDestAdr, 
ipDestPort fiels.

Please find the details in the 
https://issues.apache.org/jira/browse/METRON-1724 ticket.

There is a followup ticket on this:
Date rage validation https://issues.apache.org/jira/browse/METRON-1724
We'll open a separated PR when it's done.


## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 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:
- [ ] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [ ] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?


### 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:
  ```
  mvn -q clean integration-test install && 
dev-utilities/build-utils/verify_licenses.sh 
  ```

- [ ] 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](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] 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`:

  ```
  cd site-book
  mvn site
  ```

 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](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/tiborm/metron METRON-1712-input-validation

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/metron/pull/1142.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1142


commit 872d1b1ee13e358c18956945d71d3667d19fca8a
Author: merrimanr 
Date:   2018-04-12T14:57:48Z

Merge branch 'pcap-front' of https://github.com/simonellistonball/metron 
into pcaprest

Conflicts:
metron-interface/metron-alerts/src/app/app.module.ts

commit b1b6a7dabea1a1d0d132482c8d97af29c0ac2683
Author: merrimanr 
Date:   2018-04-13T15:00:15Z

initial commit

 Conflicts:

metron-interface/metron-rest/src/main/java/org/apache/metron/rest/MetronRestApplication.java

metron-interface/metron-rest/src/main/java/org/apache/metron/rest/controller/PcapQueryController.java

metron-interface/metron-rest/src/main/java/org/apache/metron/rest/util/pcapQueryThread.java

commit 55cf2d945a4fcff1e7e2e47a234037ed6f394b2e
Author: merrimanr 
Date:   2018-04-18T15:52:56Z

added license headers

commit 70696d047c6ef4b8ce5fcda03588474ff5b2c506
Author: tiborm 
Date:   2018-07-11T14:58:56Z

METRON-1662: adding download button to pcap tab

commit 4a83d46259736d8c721fb9f640b6ad522f91a559