diff --git a/CHANGELOG b/CHANGELOG index a5c9ceb9..e657f50b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,12 @@ jc changelog +20200803 v1.13.2 +- Add key/value file parser (wrapper for ini parser) +- Add date command parser +- Update traceroute parser to more gracefully handle missing header row +- Update traceroute parser to handle annotations +- Update traceroute parser to only return successful probes + 20200727 v1.13.1 - Add route -6 tests diff --git a/EXAMPLES.md b/EXAMPLES.md index 95c54b51..69b7c509 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -377,6 +377,24 @@ cat homes.csv | jc --csv -p } ] ``` +### date +```bash +date | jc --date -p # or: jc -p date +``` +```json +{ + "year": 2020, + "month_num": 7, + "day": 31, + "hour": 16, + "minute": 48, + "second": 11, + "month": "Jul", + "weekday": "Fri", + "weekday_num": 6, + "timezone": "PDT" +} +``` ### df ```bash df | jc --df -p # or: jc -p df @@ -1005,7 +1023,7 @@ ifconfig | jc --ifconfig -p # or: jc -p ifconfig } ] ``` -### INI and plain key/value pair files +### INI files ```bash cat example.ini ``` @@ -1044,31 +1062,6 @@ cat example.ini | jc --ini -p } } ``` -```bash -cat keyvalue.txt -``` -``` -# this file contains key/value pairs -name = John Doe -address=555 California Drive -age: 34 -; comments can include # or ; -# delimiter can be = or : -# quoted values have quotation marks stripped by default -# but can be preserved with the -r argument -occupation:"Engineer" -``` -```bash -cat keyvalue.txt | jc --ini -p -``` -```json -{ - "name": "John Doe", - "address": "555 California Drive", - "age": "34", - "occupation": "Engineer" -} -``` ### iptables ```bash iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat @@ -1165,6 +1158,32 @@ jobs -l | jc --jobs -p # or: jc -p jobs } ] ``` +### Key/Value files +```bash +cat keyvalue.txt +``` +``` +# this file contains key/value pairs +name = John Doe +address=555 California Drive +age: 34 +; comments can include # or ; +# delimiter can be = or : +# quoted values have quotation marks stripped by default +# but can be preserved with the -r argument +occupation:"Engineer" +``` +```bash +cat keyvalue.txt | jc --kv -p +``` +```json +{ + "name": "John Doe", + "address": "555 California Drive", + "age": "34", + "occupation": "Engineer" +} +``` ### last and lastb ```bash last | jc --last -p # or: jc -p last @@ -2377,15 +2396,7 @@ traceroute -m 3 8.8.8.8 | jc --traceroute -p # or: jc -p traceroute -m }, { "hop": 3, - "probes": [ - { - "annotation": null, - "asn": null, - "ip": null, - "name": null, - "rtt": null - } - ] + "probes": [] } ] } diff --git a/README.md b/README.md index 3162ebe2..9b7d26fe 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,7 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio - `--crontab` enables the `crontab` command and file parser - `--crontab-u` enables the `crontab` file parser with user support - `--csv` enables the `CSV` file parser +- `--date` enables the `date` command parser - `--df` enables the `df` command parser - `--dig` enables the `dig` command parser - `--dmidecode` enables the `dmidecode` command parser @@ -133,9 +134,10 @@ The JSON output can be compact (default) or pretty formatted with the `-p` optio - `--hosts` enables the `/etc/hosts` file parser - `--id` enables the `id` command parser - `--ifconfig` enables the `ifconfig` command parser -- `--ini` enables the `INI` file parser. Also parses files/output containing simple key/value pairs +- `--ini` enables the `INI` file parser - `--iptables` enables the `iptables` command parser - `--jobs` enables the `jobs` command parser +- `--kv` enables the `Key/Value` file parser - `--last` enables the `last` and `lastb` command parser - `--ls` enables the `ls` command parser - `--lsblk` enables the `lsblk` command parser diff --git a/docgen.sh b/docgen.sh index 27f78227..86986db5 100755 --- a/docgen.sh +++ b/docgen.sh @@ -11,6 +11,7 @@ pydocmd simple jc.parsers.blkid+ > ../docs/parsers/blkid.md pydocmd simple jc.parsers.crontab+ > ../docs/parsers/crontab.md pydocmd simple jc.parsers.crontab_u+ > ../docs/parsers/crontab_u.md pydocmd simple jc.parsers.csv+ > ../docs/parsers/csv.md +pydocmd simple jc.parsers.date+ > ../docs/parsers/date.md pydocmd simple jc.parsers.df+ > ../docs/parsers/df.md pydocmd simple jc.parsers.dig+ > ../docs/parsers/dig.md pydocmd simple jc.parsers.dmidecode+ > ../docs/parsers/dmidecode.md @@ -28,6 +29,7 @@ pydocmd simple jc.parsers.ifconfig+ > ../docs/parsers/ifconfig.md pydocmd simple jc.parsers.ini+ > ../docs/parsers/ini.md pydocmd simple jc.parsers.iptables+ > ../docs/parsers/iptables.md pydocmd simple jc.parsers.jobs+ > ../docs/parsers/jobs.md +pydocmd simple jc.parsers.kv+ > ../docs/parsers/kv.md pydocmd simple jc.parsers.last+ > ../docs/parsers/last.md pydocmd simple jc.parsers.ls+ > ../docs/parsers/ls.md pydocmd simple jc.parsers.lsblk+ > ../docs/parsers/lsblk.md diff --git a/docs/parsers/airport.md b/docs/parsers/airport.md index 3735793d..b5022cd0 100644 --- a/docs/parsers/airport.md +++ b/docs/parsers/airport.md @@ -1,3 +1,4 @@ + # jc.parsers.airport jc - JSON CLI output utility airport -I Parser @@ -52,11 +53,13 @@ Examples: "channel": "48,80" } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -90,6 +93,7 @@ Returns: "channel": string } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/airport_s.md b/docs/parsers/airport_s.md index 992fc78d..16fc0db3 100644 --- a/docs/parsers/airport_s.md +++ b/docs/parsers/airport_s.md @@ -1,3 +1,4 @@ + # jc.parsers.airport_s jc - JSON CLI output utility airport -s Parser @@ -84,11 +85,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -117,6 +120,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/arp.md b/docs/parsers/arp.md index 569fdcfd..eba14ac0 100644 --- a/docs/parsers/arp.md +++ b/docs/parsers/arp.md @@ -1,3 +1,4 @@ + # jc.parsers.arp jc - JSON CLI output utility arp Parser @@ -95,11 +96,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -128,6 +131,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/blkid.md b/docs/parsers/blkid.md index ce74297e..a6399714 100644 --- a/docs/parsers/blkid.md +++ b/docs/parsers/blkid.md @@ -1,3 +1,4 @@ + # jc.parsers.blkid jc - JSON CLI output utility blkid Parser @@ -75,11 +76,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -129,6 +132,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/crontab.md b/docs/parsers/crontab.md index c6d63870..03513098 100644 --- a/docs/parsers/crontab.md +++ b/docs/parsers/crontab.md @@ -1,3 +1,4 @@ + # jc.parsers.crontab jc - JSON CLI output utility crontab command and file Parser @@ -128,11 +129,13 @@ Examples: ] } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -178,6 +181,7 @@ Returns: } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/crontab_u.md b/docs/parsers/crontab_u.md index 9dfbbe52..f58c4559 100644 --- a/docs/parsers/crontab_u.md +++ b/docs/parsers/crontab_u.md @@ -1,3 +1,4 @@ + # jc.parsers.crontab_u jc - JSON CLI output utility crontab file Parser @@ -129,11 +130,13 @@ Examples: + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -180,6 +183,7 @@ Returns: } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/csv.md b/docs/parsers/csv.md index 95af2cd9..f1b1dda4 100644 --- a/docs/parsers/csv.md +++ b/docs/parsers/csv.md @@ -1,3 +1,4 @@ + # jc.parsers.csv jc - JSON CLI output utility csv Parser @@ -59,11 +60,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -86,6 +89,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/date.md b/docs/parsers/date.md new file mode 100644 index 00000000..44478068 --- /dev/null +++ b/docs/parsers/date.md @@ -0,0 +1,93 @@ + +# jc.parsers.date +jc - JSON CLI output utility date Parser + +Usage: + + specify --date as the first argument if the piped input is coming from date + +Compatibility: + + 'linux', 'darwin', 'freebsd' + +Examples: + + $ date | jc --date -p + { + "year": 2020, + "month_num": 7, + "day": 31, + "hour": 16, + "minute": 48, + "second": 11, + "month": "Jul", + "weekday": "Fri", + "weekday_num": 6, + "timezone": "PDT" + } + + $ date | jc --date -p -r + { + "year": "2020", + "month": "Jul", + "day": "31", + "weekday": "Fri", + "hour": "16", + "minute": "50", + "second": "01", + "timezone": "PDT" + } + + +## info +```python +info() +``` + + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + Dictionary. Structured data with the following schema: + + { + "year": integer, + "month_num": integer, + "day": integer, + "hour": integer, + "minute": integer, + "second": integer, + "month": string, + "weekday": string, + "weekday_num": integer, + "timezone": string + } + + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + Dictionary. Raw or processed structured data. + diff --git a/docs/parsers/df.md b/docs/parsers/df.md index c990b202..414519c0 100644 --- a/docs/parsers/df.md +++ b/docs/parsers/df.md @@ -1,3 +1,4 @@ + # jc.parsers.df jc - JSON CLI output utility df Parser @@ -69,11 +70,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -106,6 +109,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/dig.md b/docs/parsers/dig.md index 0b6ec4c8..f60c223c 100644 --- a/docs/parsers/dig.md +++ b/docs/parsers/dig.md @@ -1,3 +1,4 @@ + # jc.parsers.dig jc - JSON CLI output utility dig Parser @@ -321,11 +322,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -393,6 +396,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/dmidecode.md b/docs/parsers/dmidecode.md index cd37e567..9e35ca34 100644 --- a/docs/parsers/dmidecode.md +++ b/docs/parsers/dmidecode.md @@ -1,3 +1,4 @@ + # jc.parsers.dmidecode jc - JSON CLI output utility dmidecode Parser @@ -99,11 +100,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -134,6 +137,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/du.md b/docs/parsers/du.md index b4184abe..c470cfab 100644 --- a/docs/parsers/du.md +++ b/docs/parsers/du.md @@ -1,3 +1,4 @@ + # jc.parsers.du jc - JSON CLI output utility du Parser @@ -69,11 +70,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -96,6 +99,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/env.md b/docs/parsers/env.md index 4ce02d0d..91daa51d 100644 --- a/docs/parsers/env.md +++ b/docs/parsers/env.md @@ -1,3 +1,4 @@ + # jc.parsers.env jc - JSON CLI output utility env Parser @@ -49,11 +50,13 @@ Examples: "_": "/usr/bin/env" } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -76,6 +79,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/file.md b/docs/parsers/file.md index f7e4e7b1..cb2db0ff 100644 --- a/docs/parsers/file.md +++ b/docs/parsers/file.md @@ -1,3 +1,4 @@ + # jc.parsers.file jc - JSON CLI output utility file command Parser @@ -44,11 +45,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -71,6 +74,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/free.md b/docs/parsers/free.md index 7f8bcdab..98de23d9 100644 --- a/docs/parsers/free.md +++ b/docs/parsers/free.md @@ -1,3 +1,4 @@ + # jc.parsers.free jc - JSON CLI output utility free Parser @@ -49,11 +50,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -81,6 +84,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/fstab.md b/docs/parsers/fstab.md index 3861b180..9c80c7bd 100644 --- a/docs/parsers/fstab.md +++ b/docs/parsers/fstab.md @@ -1,3 +1,4 @@ + # jc.parsers.fstab jc - JSON CLI output utility fstab Parser @@ -67,11 +68,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -98,6 +101,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/group.md b/docs/parsers/group.md index 9c064b93..6cc45779 100644 --- a/docs/parsers/group.md +++ b/docs/parsers/group.md @@ -1,3 +1,4 @@ + # jc.parsers.group jc - JSON CLI output utility /etc/group file Parser @@ -91,11 +92,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -122,6 +125,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/gshadow.md b/docs/parsers/gshadow.md index bb7db2b1..c21edc38 100644 --- a/docs/parsers/gshadow.md +++ b/docs/parsers/gshadow.md @@ -1,3 +1,4 @@ + # jc.parsers.gshadow jc - JSON CLI output utility /etc/gshadow file Parser @@ -57,11 +58,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -90,6 +93,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/history.md b/docs/parsers/history.md index 5b828431..52de5958 100644 --- a/docs/parsers/history.md +++ b/docs/parsers/history.md @@ -1,3 +1,4 @@ + # jc.parsers.history jc - JSON CLI output utility history Parser @@ -41,11 +42,13 @@ Examples: ... } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -68,6 +71,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/hosts.md b/docs/parsers/hosts.md index c020b863..da0b7540 100644 --- a/docs/parsers/hosts.md +++ b/docs/parsers/hosts.md @@ -1,3 +1,4 @@ + # jc.parsers.hosts jc - JSON CLI output utility hosts Parser @@ -58,11 +59,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -87,6 +90,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/id.md b/docs/parsers/id.md index 66775e46..4615049c 100644 --- a/docs/parsers/id.md +++ b/docs/parsers/id.md @@ -1,3 +1,4 @@ + # jc.parsers.id jc - JSON CLI output utility id Parser @@ -67,11 +68,13 @@ Examples: } } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -114,6 +117,7 @@ Returns: } } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ifconfig.md b/docs/parsers/ifconfig.md index 366cdb41..7e60adc4 100644 --- a/docs/parsers/ifconfig.md +++ b/docs/parsers/ifconfig.md @@ -1,3 +1,4 @@ + # jc.parsers.ifconfig jc - JSON CLI output utility ifconfig Parser @@ -142,19 +143,16 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## IfconfigParser ```python -IfconfigParser(self, console_output) -``` - -## InterfaceNotFound -```python -InterfaceNotFound(self, /, *args, **kwargs) +IfconfigParser(console_output) ``` @@ -206,6 +204,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ini.md b/docs/parsers/ini.md index 4067caca..542cf236 100644 --- a/docs/parsers/ini.md +++ b/docs/parsers/ini.md @@ -1,3 +1,4 @@ + # jc.parsers.ini jc - JSON CLI output utility INI Parser @@ -45,11 +46,13 @@ Examples: } } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -73,6 +76,7 @@ Returns: If you would like to keep the quotation marks, use the -r or raw=True argument. } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/iptables.md b/docs/parsers/iptables.md index 5bc16633..8504b599 100644 --- a/docs/parsers/iptables.md +++ b/docs/parsers/iptables.md @@ -1,3 +1,4 @@ + # jc.parsers.iptables jc - JSON CLI output utility ipables Parser @@ -131,11 +132,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -172,6 +175,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/jobs.md b/docs/parsers/jobs.md index 63d6e568..8332f82a 100644 --- a/docs/parsers/jobs.md +++ b/docs/parsers/jobs.md @@ -1,3 +1,4 @@ + # jc.parsers.jobs jc - JSON CLI output utility jobs Parser @@ -73,11 +74,13 @@ Example: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -103,6 +106,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/kv.md b/docs/parsers/kv.md new file mode 100644 index 00000000..ce75cc0c --- /dev/null +++ b/docs/parsers/kv.md @@ -0,0 +1,61 @@ + +# jc.parsers.kv +jc - JSON CLI output utility Key/Value File Parser + +Usage: + + Specify --kv as the first argument if the piped input is coming from a simple + key/value pair file. Delimiter can be '=' or ':'. Missing values are supported. + Comment prefix can be '#' or ';'. Comments must be on their own line. + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat keyvalue.txt + # this file contains key/value pairs + name = John Doe + address=555 California Drive + age: 34 + ; comments can include # or ; + # delimiter can be = or : + # quoted values have quotation marks stripped by default + # but can be preserved with the -r argument + occupation:"Engineer" + + $ cat keyvalue.txt | jc --ini -p + { + "name": "John Doe", + "address": "555 California Drive", + "age": "34", + "occupation": "Engineer" + } + + +## info +```python +info() +``` + + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + + Note: this is just a wrapper for jc.parsers.ini + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + Dictionary representing the key/value file + diff --git a/docs/parsers/last.md b/docs/parsers/last.md index 3b4fffe9..677c395b 100644 --- a/docs/parsers/last.md +++ b/docs/parsers/last.md @@ -1,3 +1,4 @@ + # jc.parsers.last jc - JSON CLI output utility last Parser @@ -68,11 +69,13 @@ Examples: ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -99,6 +102,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ls.md b/docs/parsers/ls.md index d1f4ba3e..3b24c370 100644 --- a/docs/parsers/ls.md +++ b/docs/parsers/ls.md @@ -1,3 +1,4 @@ + # jc.parsers.ls jc - JSON CLI output utility ls Parser @@ -145,11 +146,13 @@ Examples: "date": "May 3 2019" } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -178,6 +181,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/lsblk.md b/docs/parsers/lsblk.md index 3c68f898..d2df5fa8 100644 --- a/docs/parsers/lsblk.md +++ b/docs/parsers/lsblk.md @@ -1,3 +1,4 @@ + # jc.parsers.lsblk jc - JSON CLI output utility lsblk Parser @@ -212,11 +213,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -277,6 +280,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/lsmod.md b/docs/parsers/lsmod.md index 98bd1fed..eb9753fc 100644 --- a/docs/parsers/lsmod.md +++ b/docs/parsers/lsmod.md @@ -1,3 +1,4 @@ + # jc.parsers.lsmod jc - JSON CLI output utility lsmod Parser @@ -103,11 +104,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -134,6 +137,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/lsof.md b/docs/parsers/lsof.md index 5b188e6d..8ffe8704 100644 --- a/docs/parsers/lsof.md +++ b/docs/parsers/lsof.md @@ -1,3 +1,4 @@ + # jc.parsers.lsof jc - JSON CLI output utility lsof Parser @@ -93,11 +94,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -128,6 +131,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/mount.md b/docs/parsers/mount.md index 50c388aa..0f0dd30b 100644 --- a/docs/parsers/mount.md +++ b/docs/parsers/mount.md @@ -1,3 +1,4 @@ + # jc.parsers.mount jc - JSON CLI output utility mount Parser @@ -53,11 +54,13 @@ Example: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -84,6 +87,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/netstat.md b/docs/parsers/netstat.md index e2bbdad4..7068f4ce 100644 --- a/docs/parsers/netstat.md +++ b/docs/parsers/netstat.md @@ -1,3 +1,4 @@ + # jc.parsers.netstat jc - JSON CLI output utility netstat Parser @@ -245,11 +246,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -364,6 +367,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ntpq.md b/docs/parsers/ntpq.md index 9d31742a..b5ce9725 100644 --- a/docs/parsers/ntpq.md +++ b/docs/parsers/ntpq.md @@ -1,3 +1,4 @@ + # jc.parsers.ntpq jc - JSON CLI output utility ntpq Parser @@ -179,11 +180,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -216,6 +219,7 @@ Returns: ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/passwd.md b/docs/parsers/passwd.md index d1acfd64..78d9f103 100644 --- a/docs/parsers/passwd.md +++ b/docs/parsers/passwd.md @@ -1,3 +1,4 @@ + # jc.parsers.passwd jc - JSON CLI output utility /etc/passwd file Parser @@ -75,11 +76,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -107,6 +110,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ping.md b/docs/parsers/ping.md index 59e2e50a..e9a102f5 100644 --- a/docs/parsers/ping.md +++ b/docs/parsers/ping.md @@ -1,3 +1,4 @@ + # jc.parsers.ping jc - JSON CLI output utility ping Parser @@ -104,11 +105,13 @@ Examples: ] } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -152,6 +155,7 @@ Returns: ] } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/pip_list.md b/docs/parsers/pip_list.md index ba21588c..e450f7a0 100644 --- a/docs/parsers/pip_list.md +++ b/docs/parsers/pip_list.md @@ -1,3 +1,4 @@ + # jc.parsers.pip_list jc - JSON CLI output utility pip-list Parser @@ -28,11 +29,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -56,6 +59,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/pip_show.md b/docs/parsers/pip_show.md index 95234ae1..222db7ad 100644 --- a/docs/parsers/pip_show.md +++ b/docs/parsers/pip_show.md @@ -1,3 +1,4 @@ + # jc.parsers.pip_show jc - JSON CLI output utility pip-show Parser @@ -39,11 +40,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -75,6 +78,7 @@ Returns: ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ps.md b/docs/parsers/ps.md index 64f77454..61648b0f 100644 --- a/docs/parsers/ps.md +++ b/docs/parsers/ps.md @@ -1,3 +1,4 @@ + # jc.parsers.ps jc - JSON CLI output utility ps Parser @@ -173,11 +174,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -215,6 +218,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/route.md b/docs/parsers/route.md index d2206f81..bdad5dd1 100644 --- a/docs/parsers/route.md +++ b/docs/parsers/route.md @@ -1,3 +1,4 @@ + # jc.parsers.route jc - JSON CLI output utility route Parser @@ -80,11 +81,13 @@ Examples: ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -119,6 +122,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/shadow.md b/docs/parsers/shadow.md index 93efff94..5dd3ba2d 100644 --- a/docs/parsers/shadow.md +++ b/docs/parsers/shadow.md @@ -1,3 +1,4 @@ + # jc.parsers.shadow jc - JSON CLI output utility /etc/shadow file Parser @@ -81,11 +82,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -114,6 +117,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/ss.md b/docs/parsers/ss.md index 2f97142f..ad82eb79 100644 --- a/docs/parsers/ss.md +++ b/docs/parsers/ss.md @@ -1,3 +1,4 @@ + # jc.parsers.ss jc - JSON CLI output utility ss Parser @@ -247,11 +248,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -289,6 +292,7 @@ Returns: Information from https://www.cyberciti.biz/files/ss.html used to define field names + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/stat.md b/docs/parsers/stat.md index 20b6f3b1..98c9debf 100644 --- a/docs/parsers/stat.md +++ b/docs/parsers/stat.md @@ -1,3 +1,4 @@ + # jc.parsers.stat jc - JSON CLI output utility stat Parser @@ -101,11 +102,13 @@ Examples: .. ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -149,6 +152,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/sysctl.md b/docs/parsers/sysctl.md index a511d69e..316713b9 100644 --- a/docs/parsers/sysctl.md +++ b/docs/parsers/sysctl.md @@ -1,3 +1,4 @@ + # jc.parsers.sysctl jc - JSON CLI output utility sysctl -a Parser @@ -39,11 +40,13 @@ Examples: ... } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -65,6 +68,7 @@ Returns: "baz": string/integer/float } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/systemctl.md b/docs/parsers/systemctl.md index 013cbcf0..1b6ae7ad 100644 --- a/docs/parsers/systemctl.md +++ b/docs/parsers/systemctl.md @@ -1,3 +1,4 @@ + # jc.parsers.systemctl jc - JSON CLI output utility systemctl Parser @@ -37,11 +38,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -67,6 +70,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/systemctl_lj.md b/docs/parsers/systemctl_lj.md index 52bd510d..c98c5033 100644 --- a/docs/parsers/systemctl_lj.md +++ b/docs/parsers/systemctl_lj.md @@ -1,3 +1,4 @@ + # jc.parsers.systemctl_lj jc - JSON CLI output utility systemctl-lj Parser @@ -56,11 +57,13 @@ Examples: ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -85,6 +88,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/systemctl_ls.md b/docs/parsers/systemctl_ls.md index 181f38ef..d40adce2 100644 --- a/docs/parsers/systemctl_ls.md +++ b/docs/parsers/systemctl_ls.md @@ -1,3 +1,4 @@ + # jc.parsers.systemctl_ls jc - JSON CLI output utility systemctl-ls Parser @@ -31,11 +32,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -59,6 +62,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/systemctl_luf.md b/docs/parsers/systemctl_luf.md index 59a1b5a7..0a09dc17 100644 --- a/docs/parsers/systemctl_luf.md +++ b/docs/parsers/systemctl_luf.md @@ -1,3 +1,4 @@ + # jc.parsers.systemctl_luf jc - JSON CLI output utility systemctl-luf Parser @@ -28,11 +29,13 @@ Examples: ... ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -55,6 +58,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/timedatectl.md b/docs/parsers/timedatectl.md index 1f7f86b2..1e927c90 100644 --- a/docs/parsers/timedatectl.md +++ b/docs/parsers/timedatectl.md @@ -1,3 +1,4 @@ + # jc.parsers.timedatectl jc - JSON CLI output utility timedatectl Parser @@ -35,11 +36,13 @@ Examples: "dst_active": "yes" } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -68,6 +71,7 @@ Returns: "dst_active": boolean } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/tracepath.md b/docs/parsers/tracepath.md index 16bffe7d..935cbfb9 100644 --- a/docs/parsers/tracepath.md +++ b/docs/parsers/tracepath.md @@ -1,3 +1,4 @@ + # jc.parsers.tracepath jc - JSON CLI output utility tracepath Parser @@ -102,11 +103,13 @@ Examples: } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -139,6 +142,7 @@ Returns: ] } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/traceroute.md b/docs/parsers/traceroute.md index 4c6a2f5b..bcc68803 100644 --- a/docs/parsers/traceroute.md +++ b/docs/parsers/traceroute.md @@ -1,3 +1,4 @@ + # jc.parsers.traceroute jc - JSON CLI output utility traceroute Parser @@ -5,7 +6,10 @@ Usage: specify --traceroute as the first argument if the piped input is coming from traceroute - Note: on OSX and FreeBSD be sure to redirect STDERR to STDOUT since the header line is sent to STDERR + Note: On some operating systems you will need to redirect STDERR to STDOUT for destination + info since the header line is sent to STDERR. A warning message will be printed to + STDERR if the header row is not found. + e.g. $ traceroute 8.8.8.8 2>&1 | jc --traceroute Compatibility: @@ -84,16 +88,19 @@ Examples: ] } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## Hop ```python -Hop(self, idx) +Hop(idx) ``` + ## process ```python process(proc_data) @@ -128,6 +135,7 @@ Returns: ] } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/uname.md b/docs/parsers/uname.md index 51de96d1..b91e5c60 100644 --- a/docs/parsers/uname.md +++ b/docs/parsers/uname.md @@ -1,3 +1,4 @@ + # jc.parsers.uname jc - JSON CLI output utility uname Parser @@ -27,11 +28,13 @@ Example: "kernel_version": "#74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019" } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -58,6 +61,7 @@ Returns: "kernel_version": string } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/uptime.md b/docs/parsers/uptime.md index 3a86f301..31a44f91 100644 --- a/docs/parsers/uptime.md +++ b/docs/parsers/uptime.md @@ -1,3 +1,4 @@ + # jc.parsers.uptime jc - JSON CLI output utility uptime Parser @@ -31,11 +32,13 @@ Example: "load_15m": "0.05" } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -60,6 +63,7 @@ Returns: "load_15m": float } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/w.md b/docs/parsers/w.md index 5427d7cd..1c765bcd 100644 --- a/docs/parsers/w.md +++ b/docs/parsers/w.md @@ -1,3 +1,4 @@ + # jc.parsers.w jc - JSON CLI output utility w Parser @@ -79,11 +80,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -112,6 +115,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/who.md b/docs/parsers/who.md index 8c2d7545..97011315 100644 --- a/docs/parsers/who.md +++ b/docs/parsers/who.md @@ -1,3 +1,4 @@ + # jc.parsers.who jc - JSON CLI output utility who Parser @@ -99,11 +100,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -133,6 +136,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/xml.md b/docs/parsers/xml.md index 96044cf1..9189f932 100644 --- a/docs/parsers/xml.md +++ b/docs/parsers/xml.md @@ -1,3 +1,4 @@ + # jc.parsers.xml jc - JSON CLI output utility XML Parser @@ -55,11 +56,13 @@ Examples: ... } + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -80,6 +83,7 @@ Returns: See https://github.com/martinblech/xmltodict for details } + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/parsers/yaml.md b/docs/parsers/yaml.md index 92a2eb16..f63843c3 100644 --- a/docs/parsers/yaml.md +++ b/docs/parsers/yaml.md @@ -1,3 +1,4 @@ + # jc.parsers.yaml jc - JSON CLI output utility YAML Parser @@ -67,11 +68,13 @@ Examples: } ] + ## info ```python -info(self, /, *args, **kwargs) +info() ``` + ## process ```python process(proc_data) @@ -94,6 +97,7 @@ Returns: } ] + ## parse ```python parse(data, raw=False, quiet=False) diff --git a/docs/readme.md b/docs/readme.md index 57faa5e9..c5d7401d 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,3 +1,4 @@ + # jc JC - JSON CLI output utility diff --git a/docs/utils.md b/docs/utils.md index 9e8cb633..8fe5f7a9 100644 --- a/docs/utils.md +++ b/docs/utils.md @@ -1,5 +1,7 @@ + # utils jc - JSON CLI output utility utils + ## warning_message ```python warning_message(message) @@ -15,6 +17,7 @@ Returns: no return, just prints output to STDERR + ## error_message ```python error_message(message) @@ -30,6 +33,7 @@ Returns: no return, just prints output to STDERR + ## compatibility ```python compatibility(mod_name, compatible) @@ -48,6 +52,7 @@ Returns: no return, just prints output to STDERR + ## has_data ```python has_data(data) diff --git a/jc/cli.py b/jc/cli.py index 7eeeba24..5ae412cb 100644 --- a/jc/cli.py +++ b/jc/cli.py @@ -21,7 +21,7 @@ import jc.appdirs as appdirs class info(): - version = '1.13.1' + version = '1.13.2' description = 'JSON CLI output utility' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -37,6 +37,7 @@ parsers = [ 'crontab', 'crontab-u', 'csv', + 'date', 'df', 'dig', 'dmidecode', @@ -54,6 +55,7 @@ parsers = [ 'ini', 'iptables', 'jobs', + 'kv', 'last', 'ls', 'lsblk', diff --git a/jc/parsers/date.py b/jc/parsers/date.py new file mode 100644 index 00000000..d0541905 --- /dev/null +++ b/jc/parsers/date.py @@ -0,0 +1,160 @@ +"""jc - JSON CLI output utility date Parser + +Usage: + + specify --date as the first argument if the piped input is coming from date + +Compatibility: + + 'linux', 'darwin', 'freebsd' + +Examples: + + $ date | jc --date -p + { + "year": 2020, + "month_num": 7, + "day": 31, + "hour": 16, + "minute": 48, + "second": 11, + "month": "Jul", + "weekday": "Fri", + "weekday_num": 6, + "timezone": "PDT" + } + + $ date | jc --date -p -r + { + "year": "2020", + "month": "Jul", + "day": "31", + "weekday": "Fri", + "hour": "16", + "minute": "50", + "second": "01", + "timezone": "PDT" + } +""" +import jc.utils + + +class info(): + version = '1.0' + description = 'date command parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'freebsd'] + magic_commands = ['date'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + Dictionary. Structured data with the following schema: + + { + "year": integer, + "month_num": integer, + "day": integer, + "hour": integer, + "minute": integer, + "second": integer, + "month": string, + "weekday": string, + "weekday_num": integer, + "timezone": string + } + """ + month_map = { + "Jan": 1, + "Feb": 2, + "Mar": 3, + "Apr": 4, + "May": 5, + "Jun": 6, + "Jul": 7, + "Aug": 8, + "Sep": 9, + "Oct": 10, + "Nov": 11, + "Dec": 12 + } + + weekday_map = { + "Sun": 1, + "Mon": 2, + "Tue": 3, + "Wed": 4, + "Thu": 5, + "Fri": 6, + "Sat": 7 + } + + if proc_data: + return { + "year": int(proc_data['year']), + 'month_num': month_map[proc_data['month']], + "day": int(proc_data['day']), + "hour": int(proc_data['hour']), + "minute": int(proc_data['minute']), + "second": int(proc_data['second']), + "month": proc_data['month'], + "weekday": proc_data['weekday'], + "weekday_num": weekday_map[proc_data['weekday']], + "timezone": proc_data['timezone'] + } + else: + return {} + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + Dictionary. Raw or processed structured data. + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + raw_output = {} + + if jc.utils.has_data(data): + data = data.replace(':', ' ') + split_data = data.split() + + raw_output = { + "year": split_data[7], + "month": split_data[1], + "day": split_data[2], + "weekday": split_data[0], + "hour": split_data[3], + "minute": split_data[4], + "second": split_data[5], + "timezone": split_data[6] + } + + if raw: + return raw_output + else: + return process(raw_output) diff --git a/jc/parsers/ifconfig.py b/jc/parsers/ifconfig.py index 3f4e575e..e91cf3c4 100644 --- a/jc/parsers/ifconfig.py +++ b/jc/parsers/ifconfig.py @@ -372,8 +372,6 @@ class IfconfigParser(object): class InterfaceNotFound(Exception): - """ - """ pass diff --git a/jc/parsers/ini.py b/jc/parsers/ini.py index 0ff13746..86ae76d4 100644 --- a/jc/parsers/ini.py +++ b/jc/parsers/ini.py @@ -49,8 +49,8 @@ import configparser class info(): - version = '1.2' - description = 'INI file parser. Also parses files/output containing simple key/value pairs' + version = '1.3' + description = 'INI file parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' details = 'Using configparser from the standard library' diff --git a/jc/parsers/kv.py b/jc/parsers/kv.py new file mode 100644 index 00000000..88a21e15 --- /dev/null +++ b/jc/parsers/kv.py @@ -0,0 +1,67 @@ +"""jc - JSON CLI output utility Key/Value File Parser + +Usage: + + Specify --kv as the first argument if the piped input is coming from a simple + key/value pair file. Delimiter can be '=' or ':'. Missing values are supported. + Comment prefix can be '#' or ';'. Comments must be on their own line. + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat keyvalue.txt + # this file contains key/value pairs + name = John Doe + address=555 California Drive + age: 34 + ; comments can include # or ; + # delimiter can be = or : + # quoted values have quotation marks stripped by default + # but can be preserved with the -r argument + occupation:"Engineer" + + $ cat keyvalue.txt | jc --ini -p + { + "name": "John Doe", + "address": "555 California Drive", + "age": "34", + "occupation": "Engineer" + } +""" + + +class info(): + version = '1.0' + description = 'Key/Value file parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + details = 'This is a wrapper for the INI parser' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + + +__version__ = info.version + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Note: this is just a wrapper for jc.parsers.ini + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + Dictionary representing the key/value file + """ + import jc.parsers.ini + return jc.parsers.ini.parse(data, raw=raw, quiet=quiet) diff --git a/jc/parsers/traceroute.py b/jc/parsers/traceroute.py index ed4c89c9..00f695da 100644 --- a/jc/parsers/traceroute.py +++ b/jc/parsers/traceroute.py @@ -4,7 +4,10 @@ Usage: specify --traceroute as the first argument if the piped input is coming from traceroute - Note: on OSX and FreeBSD be sure to redirect STDERR to STDOUT since the header line is sent to STDERR + Note: On some operating systems you will need to redirect STDERR to STDOUT for destination + info since the header line is sent to STDERR. A warning message will be printed to + STDERR if the header row is not found. + e.g. $ traceroute 8.8.8.8 2>&1 | jc --traceroute Compatibility: @@ -89,7 +92,7 @@ import jc.utils class info(): - version = '1.0' + version = '1.1' description = 'traceroute command parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -136,7 +139,7 @@ RE_PROBE_NAME_IP = re.compile(r'(\S+)\s+\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[0 RE_PROBE_BSD_IPV6 = re.compile(r'\b(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\b') RE_HOP = re.compile(r'^\s*(\d+)?\s+(.+)$') RE_PROBE_ASN = re.compile(r'\[AS(\d+)\]') -RE_PROBE_RTT_ANNOTATION = re.compile(r'(\d+\.?\d+)?\s+ms|(\s+\*\s+)\s*(!\S*)?') +RE_PROBE_RTT_ANNOTATION = re.compile(r'(?:(\d+(?:\.?\d+)?)\s+ms|(\s+\*\s+))\s*(!\S*)?') class Traceroute(object): @@ -209,8 +212,10 @@ def loads(data): # Get headers match_dest = RE_HEADER.search(lines[0]) - dest_name = match_dest.group(1) - dest_ip = match_dest.group(2) + dest_name, dest_ip = None, None + if match_dest: + dest_name = match_dest.group(1) + dest_ip = match_dest.group(2) # The Traceroute node is the root of the tree traceroute = Traceroute(dest_name, dest_ip) @@ -272,7 +277,10 @@ def loads(data): rtt=probe_rtt, annotation=probe_annotation ) - hop.add_probe(probe) + + # only add probe if there is data + if any([probe_name, probe_ip, probe_asn, probe_rtt, probe_annotation]): + hop.add_probe(probe) return traceroute @@ -380,11 +388,16 @@ def parse(data, raw=False, quiet=False): new_data.append(data_line) else: continue - data = '\n'.join(new_data) - # check if header row exists, otherwise raise exception - if not data.splitlines()[0].startswith('traceroute to ') and not data.splitlines()[0].startswith('traceroute6 to '): - raise ParseError('Traceroute header line not found. Be sure to redirect STDERR to STDOUT on some operating systems.') + # check if header row exists, otherwise add a dummy header + if not new_data[0].startswith('traceroute to ') and not new_data[0].startswith('traceroute6 to '): + new_data[:0] = ['traceroute to <<_>> (<<_>>), 30 hops max, 60 byte packets'] + + # print warning to STDERR + if not quiet: + jc.utils.warning_message('No header row found. For destination info redirect STDERR to STDOUT') + + data = '\n'.join(new_data) tr = loads(data) hops = tr.hops diff --git a/man/jc.1 b/man/jc.1 index 16f346f5..5091605c 100644 --- a/man/jc.1 +++ b/man/jc.1 @@ -1,4 +1,4 @@ -.TH jc 1 2020-07-12 1.13.0 "JSON CLI output utility" +.TH jc 1 2020-07-31 1.13.2 "JSON CLI output utility" .SH NAME jc \- JSONifies the output of many CLI tools and file-types .SH SYNOPSIS @@ -44,6 +44,10 @@ crontab file parser with user support CSV file parser .TP .B +\fB--date\fP +date command parser +.TP +.B \fB--df\fP df command parser .TP @@ -101,7 +105,7 @@ ifconfig command parser .TP .B \fB--ini\fP -INI file parser. Also parses files/output containing simple key/value pairs +INI file parser .TP .B \fB--iptables\fP @@ -112,6 +116,10 @@ iptables command parser jobs command parser .TP .B +\fB--kv\fP +Key/Value file parser +.TP +.B \fB--last\fP last and lastb command parser .TP diff --git a/setup.py b/setup.py index 903dc6dc..74c716de 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open('README.md', 'r') as f: setuptools.setup( name='jc', - version='1.13.1', + version='1.13.2', author='Kelly Brazil', author_email='kellyjonbrazil@gmail.com', description='Converts the output of popular command-line tools and file-types to JSON.', diff --git a/tests/fixtures/centos-7.7/traceroute.json b/tests/fixtures/centos-7.7/traceroute.json index 1946407f..4ef1dfa8 100644 --- a/tests/fixtures/centos-7.7/traceroute.json +++ b/tests/fixtures/centos-7.7/traceroute.json @@ -1 +1 @@ -{"destination_ip": "151.101.197.67", "destination_name": "www.cnn.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 4.024}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 3.683}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 3.706}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 24.038}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 23.911}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 23.724}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 42.273}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 42.213}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 42.083}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "12.122.2.77", "name": "12.122.2.77", "rtt": 36.789}, {"annotation": null, "asn": null, "ip": "12.122.2.77", "name": "12.122.2.77", "rtt": 43.691}, {"annotation": null, "asn": null, "ip": "12.122.2.77", "name": "12.122.2.77", "rtt": 36.597}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "12.122.2.94", "name": "sd2ca21crs.ip.att.net", "rtt": 41.587}, {"annotation": null, "asn": null, "ip": "12.122.2.94", "name": "sd2ca21crs.ip.att.net", "rtt": 40.24}, {"annotation": null, "asn": null, "ip": "12.122.2.94", "name": "sd2ca21crs.ip.att.net", "rtt": 44.659}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "12.123.215.161", "name": "12.123.215.161", "rtt": 37.858}, {"annotation": null, "asn": null, "ip": "12.123.215.161", "name": "12.123.215.161", "rtt": 37.321}, {"annotation": null, "asn": null, "ip": "12.123.215.161", "name": "12.123.215.161", "rtt": 37.092}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 13, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 14, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 15, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 16, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 17, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 18, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 19, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 20, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 21, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 22, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 23, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 24, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 25, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 26, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 27, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 28, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 29, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 30, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "151.101.197.67", "destination_name": "www.cnn.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 4.024}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 3.683}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 3.706}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 24.038}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 23.911}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 23.724}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 42.273}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 42.213}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 42.083}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "12.122.2.77", "name": "12.122.2.77", "rtt": 36.789}, {"annotation": null, "asn": null, "ip": "12.122.2.77", "name": "12.122.2.77", "rtt": 43.691}, {"annotation": null, "asn": null, "ip": "12.122.2.77", "name": "12.122.2.77", "rtt": 36.597}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "12.122.2.94", "name": "sd2ca21crs.ip.att.net", "rtt": 41.587}, {"annotation": null, "asn": null, "ip": "12.122.2.94", "name": "sd2ca21crs.ip.att.net", "rtt": 40.24}, {"annotation": null, "asn": null, "ip": "12.122.2.94", "name": "sd2ca21crs.ip.att.net", "rtt": 44.659}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "12.123.215.161", "name": "12.123.215.161", "rtt": 37.858}, {"annotation": null, "asn": null, "ip": "12.123.215.161", "name": "12.123.215.161", "rtt": 37.321}, {"annotation": null, "asn": null, "ip": "12.123.215.161", "name": "12.123.215.161", "rtt": 37.092}]}, {"hop": 8, "probes": []}, {"hop": 9, "probes": []}, {"hop": 10, "probes": []}, {"hop": 11, "probes": []}, {"hop": 12, "probes": []}, {"hop": 13, "probes": []}, {"hop": 14, "probes": []}, {"hop": 15, "probes": []}, {"hop": 16, "probes": []}, {"hop": 17, "probes": []}, {"hop": 18, "probes": []}, {"hop": 19, "probes": []}, {"hop": 20, "probes": []}, {"hop": 21, "probes": []}, {"hop": 22, "probes": []}, {"hop": 23, "probes": []}, {"hop": 24, "probes": []}, {"hop": 25, "probes": []}, {"hop": 26, "probes": []}, {"hop": 27, "probes": []}, {"hop": 28, "probes": []}, {"hop": 29, "probes": []}, {"hop": 30, "probes": []}]} diff --git a/tests/fixtures/freebsd12/traceroute.json b/tests/fixtures/freebsd12/traceroute.json index f776d28d..a1932dcc 100644 --- a/tests/fixtures/freebsd12/traceroute.json +++ b/tests/fixtures/freebsd12/traceroute.json @@ -1 +1 @@ -{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 3.263}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 4.146}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 4.273}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.839}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 23.434}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 22.032}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 33.17}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 26.593}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 32.851}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 26.045}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 29.235}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 28.28}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 25.3}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 24.156}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 24.849}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "12.255.10.226", "name": "12.255.10.226", "rtt": 25.375}, {"annotation": null, "asn": null, "ip": "12.255.10.224", "name": "12.255.10.224", "rtt": 24.011}, {"annotation": null, "asn": null, "ip": "12.255.10.224", "name": "12.255.10.224", "rtt": 25.322}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "108.170.243.1", "name": "108.170.243.1", "rtt": 29.376}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 23.228}, {"annotation": null, "asn": null, "ip": "209.85.252.251", "name": "209.85.252.251", "rtt": 24.548}, {"annotation": null, "asn": null, "ip": "108.170.237.23", "name": "108.170.237.23", "rtt": 24.332}]}]} +{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 3.263}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 4.146}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice.attlocal.net", "rtt": 4.273}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.839}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 23.434}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 22.032}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 33.17}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 26.593}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 32.851}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 26.045}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 29.235}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 28.28}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 25.3}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 24.156}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 24.849}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "12.255.10.226", "name": "12.255.10.226", "rtt": 25.375}, {"annotation": null, "asn": null, "ip": "12.255.10.224", "name": "12.255.10.224", "rtt": 24.011}, {"annotation": null, "asn": null, "ip": "12.255.10.224", "name": "12.255.10.224", "rtt": 25.322}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "108.170.243.1", "name": "108.170.243.1", "rtt": 29.376}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 23.228}, {"annotation": null, "asn": null, "ip": "209.85.252.251", "name": "209.85.252.251", "rtt": 24.548}, {"annotation": null, "asn": null, "ip": "108.170.237.23", "name": "108.170.237.23", "rtt": 24.332}]}]} diff --git a/tests/fixtures/freebsd12/traceroute6.json b/tests/fixtures/freebsd12/traceroute6.json index f8864ad2..ef90b988 100644 --- a/tests/fixtures/freebsd12/traceroute6.json +++ b/tests/fixtures/freebsd12/traceroute6.json @@ -1 +1 @@ -{"destination_ip": "2a04:4e42::323", "destination_name": "turner-tls.map.fastly.net", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 27.603}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 28.659}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 33.235}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 36.731}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 28.875}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 28.959}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 13, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 14, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 15, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 16, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 17, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 18, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 19, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 20, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 21, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 22, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 23, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 24, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 25, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 26, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 27, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 28, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 29, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 30, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 31, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "2a04:4e42::323", "destination_name": "turner-tls.map.fastly.net", "hops": [{"hop": 1, "probes": []}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 27.603}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 28.659}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 33.235}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 36.731}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 28.875}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 28.959}]}, {"hop": 5, "probes": []}, {"hop": 6, "probes": []}, {"hop": 7, "probes": []}, {"hop": 8, "probes": []}, {"hop": 9, "probes": []}, {"hop": 10, "probes": []}, {"hop": 11, "probes": []}, {"hop": 12, "probes": []}, {"hop": 13, "probes": []}, {"hop": 14, "probes": []}, {"hop": 15, "probes": []}, {"hop": 16, "probes": []}, {"hop": 17, "probes": []}, {"hop": 18, "probes": []}, {"hop": 19, "probes": []}, {"hop": 20, "probes": []}, {"hop": 21, "probes": []}, {"hop": 22, "probes": []}, {"hop": 23, "probes": []}, {"hop": 24, "probes": []}, {"hop": 25, "probes": []}, {"hop": 26, "probes": []}, {"hop": 27, "probes": []}, {"hop": 28, "probes": []}, {"hop": 29, "probes": []}, {"hop": 30, "probes": []}, {"hop": 31, "probes": []}]} diff --git a/tests/fixtures/generic/date.json b/tests/fixtures/generic/date.json new file mode 100644 index 00000000..5e5057ca --- /dev/null +++ b/tests/fixtures/generic/date.json @@ -0,0 +1 @@ +{"year": 2020, "month_num": 8, "day": 3, "hour": 9, "minute": 12, "second": 51, "month": "Aug", "weekday": "Mon", "weekday_num": 2, "timezone": "PDT"} diff --git a/tests/fixtures/generic/date.out b/tests/fixtures/generic/date.out new file mode 100644 index 00000000..f1758f38 --- /dev/null +++ b/tests/fixtures/generic/date.out @@ -0,0 +1 @@ +Mon Aug 3 09:12:51 PDT 2020 diff --git a/tests/fixtures/generic/traceroute1.json b/tests/fixtures/generic/traceroute1.json index 27b88891..11f0bc25 100644 --- a/tests/fixtures/generic/traceroute1.json +++ b/tests/fixtures/generic/traceroute1.json @@ -1 +1 @@ -{"destination_ip": "173.207.22.152", "destination_name": "http://google.es", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": 1739, "ip": "131.240.100.12", "name": "131.240.100.12", "rtt": 0.676}, {"annotation": null, "asn": 1739, "ip": "131.240.100.12", "name": "131.240.100.12", "rtt": 0.763}, {"annotation": null, "asn": 1739, "ip": "131.240.100.12", "name": "131.240.100.12", "rtt": 0.91}]}, {"hop": 2, "probes": [{"annotation": null, "asn": 1739, "ip": "131.232.1.26", "name": "http://tut1-fw-vlan558.av.tut.fi", "rtt": 0.266}, {"annotation": null, "asn": 1739, "ip": "131.232.1.26", "name": "http://tut1-fw-vlan558.av.tut.fi", "rtt": 0.404}, {"annotation": null, "asn": 1739, "ip": "131.232.1.26", "name": "http://tut1-fw-vlan558.av.tut.fi", "rtt": 0.493}]}, {"hop": 3, "probes": [{"annotation": null, "asn": 1739, "ip": "131.232.1.20", "name": "http://surf-gw-vlan557.av.tut.fi", "rtt": 0.967}, {"annotation": null, "asn": 1739, "ip": "131.232.1.20", "name": "http://surf-gw-vlan557.av.tut.fi", "rtt": 0.961}, {"annotation": null, "asn": 1739, "ip": "131.232.1.20", "name": "http://surf-gw-vlan557.av.tut.fi", "rtt": 1.085}]}, {"hop": 4, "probes": [{"annotation": null, "asn": 1739, "ip": "130.230.1.237", "name": "http://funet-tut6-rtr-xe-0-0-0.cc.tut.fi", "rtt": 1.096}, {"annotation": null, "asn": 1739, "ip": "130.230.1.237", "name": "http://funet-tut6-rtr-xe-0-0-0.cc.tut.fi", "rtt": 1.086}, {"annotation": null, "asn": 1739, "ip": "130.230.1.237", "name": "http://funet-tut6-rtr-xe-0-0-0.cc.tut.fi", "rtt": 1.049}]}, {"hop": 5, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.220", "name": "http://hameenlinna2-et-0-0-0-1.ip.funet.fi", "rtt": 3.81}, {"annotation": null, "asn": 1741, "ip": "86.50.255.220", "name": "http://hameenlinna2-et-0-0-0-1.ip.funet.fi", "rtt": 3.845}, {"annotation": null, "asn": 1741, "ip": "86.50.255.220", "name": "http://hameenlinna2-et-0-0-0-1.ip.funet.fi", "rtt": 3.82}]}, {"hop": 6, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.224", "name": "http://hameenlinna1-et-0-0-1-1.ip.funet.fi", "rtt": 29.055}, {"annotation": null, "asn": 1741, "ip": "86.50.255.224", "name": "http://hameenlinna1-et-0-0-1-1.ip.funet.fi", "rtt": 29.013}, {"annotation": null, "asn": 1741, "ip": "86.50.255.224", "name": "http://hameenlinna1-et-0-0-1-1.ip.funet.fi", "rtt": 28.977}]}, {"hop": 7, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.223", "name": "http://espoo2-et-0-1-2-1.ip.funet.fi", "rtt": 3.468}, {"annotation": null, "asn": 1741, "ip": "86.50.255.223", "name": "http://espoo2-et-0-1-2-1.ip.funet.fi", "rtt": 8.007}, {"annotation": null, "asn": 1741, "ip": "86.50.255.223", "name": "http://espoo2-et-0-1-2-1.ip.funet.fi", "rtt": 7.89}]}, {"hop": 8, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.232", "name": "http://espoo1-et-0-1-7-1.ip.funet.fi", "rtt": 13.498}, {"annotation": null, "asn": 1741, "ip": "86.50.255.232", "name": "http://espoo1-et-0-1-7-1.ip.funet.fi", "rtt": 13.307}, {"annotation": null, "asn": 1741, "ip": "86.50.255.232", "name": "http://espoo1-et-0-1-7-1.ip.funet.fi", "rtt": 13.399}]}, {"hop": 9, "probes": [{"annotation": null, "asn": 2603, "ip": "109.105.102.168", "name": "http://fi-csc2.nordu.net", "rtt": 3.25}, {"annotation": null, "asn": 2603, "ip": "109.105.102.168", "name": "http://fi-csc2.nordu.net", "rtt": 3.268}, {"annotation": null, "asn": 2603, "ip": "109.105.102.168", "name": "http://fi-csc2.nordu.net", "rtt": 3.236}]}, {"hop": 10, "probes": [{"annotation": null, "asn": 2603, "ip": "109.105.97.93", "name": "http://se-fre.nordu.net", "rtt": 9.418}, {"annotation": null, "asn": 2603, "ip": "109.105.97.93", "name": "http://se-fre.nordu.net", "rtt": 9.41}, {"annotation": null, "asn": 2603, "ip": "109.105.97.93", "name": "http://se-fre.nordu.net", "rtt": 9.369}]}, {"hop": 11, "probes": [{"annotation": null, "asn": 2603, "ip": "109.105.97.27", "name": "http://se-kst2.nordu.net", "rtt": 9.617}, {"annotation": null, "asn": 2603, "ip": "109.105.97.27", "name": "http://se-kst2.nordu.net", "rtt": 9.594}, {"annotation": null, "asn": 2603, "ip": "109.105.97.27", "name": "http://se-kst2.nordu.net", "rtt": 9.603}]}, {"hop": 12, "probes": [{"annotation": null, "asn": 15169, "ip": "192.121.80.47", "name": "http://as15169-10g-sk1.sthix.net", "rtt": 10.01}, {"annotation": null, "asn": 15169, "ip": "192.121.80.47", "name": "http://as15169-10g-sk1.sthix.net", "rtt": 9.182}, {"annotation": null, "asn": 15169, "ip": "192.121.80.47", "name": "http://as15169-10g-sk1.sthix.net", "rtt": 44.983}]}, {"hop": 13, "probes": [{"annotation": null, "asn": 15169, "ip": "108.170.254.49", "name": "108.170.254.49", "rtt": 10.852}, {"annotation": null, "asn": 15169, "ip": "108.170.254.49", "name": "108.170.254.49", "rtt": 11.185}, {"annotation": null, "asn": 15169, "ip": "108.170.254.49", "name": "108.170.254.49", "rtt": 10.876}]}, {"hop": 14, "probes": [{"annotation": null, "asn": 15169, "ip": "209.85.242.11", "name": "209.85.242.11", "rtt": 10.192}, {"annotation": null, "asn": 15169, "ip": "209.85.242.11", "name": "209.85.242.11", "rtt": 10.471}, {"annotation": null, "asn": 15169, "ip": "209.85.242.11", "name": "209.85.242.11", "rtt": 10.502}]}, {"hop": 15, "probes": [{"annotation": null, "asn": 15169, "ip": "172.217.21.163", "name": "http://arn11s03-in-f3.1e100.net", "rtt": 9.652}, {"annotation": null, "asn": 15169, "ip": "172.217.21.163", "name": "http://arn11s03-in-f3.1e100.net", "rtt": 9.664}, {"annotation": null, "asn": 15169, "ip": "172.217.21.163", "name": "http://arn11s03-in-f3.1e100.net", "rtt": 9.777}]}]} +{"destination_ip": "173.207.22.152", "destination_name": "http://google.es", "hops": [{"hop": 1, "probes": [{"annotation": "!P", "asn": 1739, "ip": "131.240.100.12", "name": "131.240.100.12", "rtt": 0.676}, {"annotation": "!", "asn": 1739, "ip": "131.240.100.12", "name": "131.240.100.12", "rtt": 0.763}, {"annotation": "!<500>", "asn": 1739, "ip": "131.240.100.12", "name": "131.240.100.12", "rtt": 0.91}]}, {"hop": 2, "probes": [{"annotation": null, "asn": 1739, "ip": "131.232.1.26", "name": "http://tut1-fw-vlan558.av.tut.fi", "rtt": 0.266}, {"annotation": null, "asn": 1739, "ip": "131.232.1.26", "name": "http://tut1-fw-vlan558.av.tut.fi", "rtt": 0.404}, {"annotation": null, "asn": 1739, "ip": "131.232.1.26", "name": "http://tut1-fw-vlan558.av.tut.fi", "rtt": 0.493}]}, {"hop": 3, "probes": [{"annotation": null, "asn": 1739, "ip": "131.232.1.20", "name": "http://surf-gw-vlan557.av.tut.fi", "rtt": 0.967}, {"annotation": null, "asn": 1739, "ip": "131.232.1.20", "name": "http://surf-gw-vlan557.av.tut.fi", "rtt": 0.961}, {"annotation": null, "asn": 1739, "ip": "131.232.1.20", "name": "http://surf-gw-vlan557.av.tut.fi", "rtt": 1.085}]}, {"hop": 4, "probes": [{"annotation": null, "asn": 1739, "ip": "130.230.1.237", "name": "http://funet-tut6-rtr-xe-0-0-0.cc.tut.fi", "rtt": 1.096}, {"annotation": null, "asn": 1739, "ip": "130.230.1.237", "name": "http://funet-tut6-rtr-xe-0-0-0.cc.tut.fi", "rtt": 1.086}, {"annotation": null, "asn": 1739, "ip": "130.230.1.237", "name": "http://funet-tut6-rtr-xe-0-0-0.cc.tut.fi", "rtt": 1.049}]}, {"hop": 5, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.220", "name": "http://hameenlinna2-et-0-0-0-1.ip.funet.fi", "rtt": 3.81}, {"annotation": null, "asn": 1741, "ip": "86.50.255.220", "name": "http://hameenlinna2-et-0-0-0-1.ip.funet.fi", "rtt": 3.845}, {"annotation": null, "asn": 1741, "ip": "86.50.255.220", "name": "http://hameenlinna2-et-0-0-0-1.ip.funet.fi", "rtt": 3.82}]}, {"hop": 6, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.224", "name": "http://hameenlinna1-et-0-0-1-1.ip.funet.fi", "rtt": 29.055}, {"annotation": null, "asn": 1741, "ip": "86.50.255.224", "name": "http://hameenlinna1-et-0-0-1-1.ip.funet.fi", "rtt": 29.013}, {"annotation": null, "asn": 1741, "ip": "86.50.255.224", "name": "http://hameenlinna1-et-0-0-1-1.ip.funet.fi", "rtt": 28.977}]}, {"hop": 7, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.223", "name": "http://espoo2-et-0-1-2-1.ip.funet.fi", "rtt": 3.468}, {"annotation": null, "asn": 1741, "ip": "86.50.255.223", "name": "http://espoo2-et-0-1-2-1.ip.funet.fi", "rtt": 8.007}, {"annotation": null, "asn": 1741, "ip": "86.50.255.223", "name": "http://espoo2-et-0-1-2-1.ip.funet.fi", "rtt": 7.89}]}, {"hop": 8, "probes": [{"annotation": null, "asn": 1741, "ip": "86.50.255.232", "name": "http://espoo1-et-0-1-7-1.ip.funet.fi", "rtt": 13.498}, {"annotation": null, "asn": 1741, "ip": "86.50.255.232", "name": "http://espoo1-et-0-1-7-1.ip.funet.fi", "rtt": 13.307}, {"annotation": null, "asn": 1741, "ip": "86.50.255.232", "name": "http://espoo1-et-0-1-7-1.ip.funet.fi", "rtt": 13.399}]}, {"hop": 9, "probes": [{"annotation": null, "asn": 2603, "ip": "109.105.102.168", "name": "http://fi-csc2.nordu.net", "rtt": 3.25}, {"annotation": null, "asn": 2603, "ip": "109.105.102.168", "name": "http://fi-csc2.nordu.net", "rtt": 3.268}, {"annotation": null, "asn": 2603, "ip": "109.105.102.168", "name": "http://fi-csc2.nordu.net", "rtt": 3.236}]}, {"hop": 10, "probes": [{"annotation": null, "asn": 2603, "ip": "109.105.97.93", "name": "http://se-fre.nordu.net", "rtt": 9.418}, {"annotation": null, "asn": 2603, "ip": "109.105.97.93", "name": "http://se-fre.nordu.net", "rtt": 9.41}, {"annotation": null, "asn": 2603, "ip": "109.105.97.93", "name": "http://se-fre.nordu.net", "rtt": 9.369}]}, {"hop": 11, "probes": [{"annotation": null, "asn": 2603, "ip": "109.105.97.27", "name": "http://se-kst2.nordu.net", "rtt": 9.617}, {"annotation": null, "asn": 2603, "ip": "109.105.97.27", "name": "http://se-kst2.nordu.net", "rtt": 9.594}, {"annotation": null, "asn": 2603, "ip": "109.105.97.27", "name": "http://se-kst2.nordu.net", "rtt": 9.603}]}, {"hop": 12, "probes": [{"annotation": null, "asn": 15169, "ip": "192.121.80.47", "name": "http://as15169-10g-sk1.sthix.net", "rtt": 10.01}, {"annotation": null, "asn": 15169, "ip": "192.121.80.47", "name": "http://as15169-10g-sk1.sthix.net", "rtt": 9.182}, {"annotation": null, "asn": 15169, "ip": "192.121.80.47", "name": "http://as15169-10g-sk1.sthix.net", "rtt": 44.983}]}, {"hop": 13, "probes": [{"annotation": null, "asn": 15169, "ip": "108.170.254.49", "name": "108.170.254.49", "rtt": 10.852}, {"annotation": null, "asn": 15169, "ip": "108.170.254.49", "name": "108.170.254.49", "rtt": 11.185}, {"annotation": null, "asn": 15169, "ip": "108.170.254.49", "name": "108.170.254.49", "rtt": 10.876}]}, {"hop": 14, "probes": [{"annotation": null, "asn": 15169, "ip": "209.85.242.11", "name": "209.85.242.11", "rtt": 10.192}, {"annotation": null, "asn": 15169, "ip": "209.85.242.11", "name": "209.85.242.11", "rtt": 10.471}, {"annotation": null, "asn": 15169, "ip": "209.85.242.11", "name": "209.85.242.11", "rtt": 10.502}]}, {"hop": 15, "probes": [{"annotation": null, "asn": 15169, "ip": "172.217.21.163", "name": "http://arn11s03-in-f3.1e100.net", "rtt": 9.652}, {"annotation": null, "asn": 15169, "ip": "172.217.21.163", "name": "http://arn11s03-in-f3.1e100.net", "rtt": 9.664}, {"annotation": null, "asn": 15169, "ip": "172.217.21.163", "name": "http://arn11s03-in-f3.1e100.net", "rtt": 9.777}]}]} diff --git a/tests/fixtures/generic/traceroute2.json b/tests/fixtures/generic/traceroute2.json index acd85297..f32ef928 100644 --- a/tests/fixtures/generic/traceroute2.json +++ b/tests/fixtures/generic/traceroute2.json @@ -1 +1 @@ -{"destination_ip": "216.58.194.46", "destination_name": "google.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "216.230.231.141", "name": "216-230-231-141.static.houston.tx.oplink.net", "rtt": 198.574}, {"annotation": null, "asn": null, "ip": "216.230.231.141", "name": "216-230-231-141.static.houston.tx.oplink.net", "rtt": null}, {"annotation": null, "asn": null, "ip": "216.230.231.141", "name": "216-230-231-141.static.houston.tx.oplink.net", "rtt": 198.65}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "72.14.242.34", "name": "72.14.242.34", "rtt": 4.932}, {"annotation": null, "asn": null, "ip": "72.14.242.34", "name": "72.14.242.34", "rtt": 4.945}, {"annotation": null, "asn": null, "ip": "72.14.242.34", "name": "72.14.242.34", "rtt": 4.951}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "108.170.230.116", "name": "108.170.230.116", "rtt": 4.687}, {"annotation": null, "asn": null, "ip": "108.170.230.116", "name": "108.170.230.116", "rtt": 4.798}, {"annotation": null, "asn": null, "ip": "108.170.230.116", "name": "108.170.230.116", "rtt": 4.688}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "108.170.252.130", "name": "108.170.252.130", "rtt": 4.825}, {"annotation": null, "asn": null, "ip": "108.170.252.130", "name": "108.170.252.130", "rtt": 4.844}, {"annotation": null, "asn": null, "ip": "108.170.252.130", "name": "108.170.252.130", "rtt": 4.797}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "108.170.233.117", "name": "108.170.233.117", "rtt": 5.386}, {"annotation": null, "asn": null, "ip": "108.170.233.117", "name": "108.170.233.117", "rtt": 5.288}, {"annotation": null, "asn": null, "ip": "108.170.233.117", "name": "108.170.233.117", "rtt": 5.324}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "216.239.63.250", "name": "216.239.63.250", "rtt": 5.305}, {"annotation": null, "asn": null, "ip": "216.239.63.250", "name": "216.239.63.250", "rtt": 5.369}, {"annotation": null, "asn": null, "ip": "216.239.63.250", "name": "216.239.63.250", "rtt": 5.406}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": "108.170.240.129", "name": "108.170.240.129", "rtt": 6.005}, {"annotation": null, "asn": null, "ip": "108.170.240.129", "name": "108.170.240.129", "rtt": 5.93}, {"annotation": null, "asn": null, "ip": "108.170.240.129", "name": "108.170.240.129", "rtt": 5.983}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": "209.85.242.53", "name": "209.85.242.53", "rtt": 4.973}, {"annotation": null, "asn": null, "ip": "209.85.242.53", "name": "209.85.242.53", "rtt": 4.973}, {"annotation": null, "asn": null, "ip": "209.85.242.53", "name": "209.85.242.53", "rtt": 4.979}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": "216.58.194.46", "name": "dfw25s12-in-f46.1e100.net", "rtt": 4.871}, {"annotation": null, "asn": null, "ip": "216.58.194.46", "name": "dfw25s12-in-f46.1e100.net", "rtt": 4.884}, {"annotation": null, "asn": null, "ip": "216.58.194.46", "name": "dfw25s12-in-f46.1e100.net", "rtt": 4.863}]}]} +{"destination_ip": "216.58.194.46", "destination_name": "google.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "216.230.231.141", "name": "216-230-231-141.static.houston.tx.oplink.net", "rtt": 198.574}, {"annotation": null, "asn": null, "ip": "216.230.231.141", "name": "216-230-231-141.static.houston.tx.oplink.net", "rtt": 198.65}]}, {"hop": 2, "probes": []}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "72.14.242.34", "name": "72.14.242.34", "rtt": 4.932}, {"annotation": null, "asn": null, "ip": "72.14.242.34", "name": "72.14.242.34", "rtt": 4.945}, {"annotation": null, "asn": null, "ip": "72.14.242.34", "name": "72.14.242.34", "rtt": 4.951}]}, {"hop": 5, "probes": []}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "108.170.230.116", "name": "108.170.230.116", "rtt": 4.687}, {"annotation": null, "asn": null, "ip": "108.170.230.116", "name": "108.170.230.116", "rtt": 4.798}, {"annotation": null, "asn": null, "ip": "108.170.230.116", "name": "108.170.230.116", "rtt": 4.688}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "108.170.252.130", "name": "108.170.252.130", "rtt": 4.825}, {"annotation": null, "asn": null, "ip": "108.170.252.130", "name": "108.170.252.130", "rtt": 4.844}, {"annotation": null, "asn": null, "ip": "108.170.252.130", "name": "108.170.252.130", "rtt": 4.797}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "108.170.233.117", "name": "108.170.233.117", "rtt": 5.386}, {"annotation": null, "asn": null, "ip": "108.170.233.117", "name": "108.170.233.117", "rtt": 5.288}, {"annotation": null, "asn": null, "ip": "108.170.233.117", "name": "108.170.233.117", "rtt": 5.324}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "216.239.63.250", "name": "216.239.63.250", "rtt": 5.305}, {"annotation": null, "asn": null, "ip": "216.239.63.250", "name": "216.239.63.250", "rtt": 5.369}, {"annotation": null, "asn": null, "ip": "216.239.63.250", "name": "216.239.63.250", "rtt": 5.406}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": "108.170.240.129", "name": "108.170.240.129", "rtt": 6.005}, {"annotation": null, "asn": null, "ip": "108.170.240.129", "name": "108.170.240.129", "rtt": 5.93}, {"annotation": null, "asn": null, "ip": "108.170.240.129", "name": "108.170.240.129", "rtt": 5.983}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": "209.85.242.53", "name": "209.85.242.53", "rtt": 4.973}, {"annotation": null, "asn": null, "ip": "209.85.242.53", "name": "209.85.242.53", "rtt": 4.973}, {"annotation": null, "asn": null, "ip": "209.85.242.53", "name": "209.85.242.53", "rtt": 4.979}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": "216.58.194.46", "name": "dfw25s12-in-f46.1e100.net", "rtt": 4.871}, {"annotation": null, "asn": null, "ip": "216.58.194.46", "name": "dfw25s12-in-f46.1e100.net", "rtt": 4.884}, {"annotation": null, "asn": null, "ip": "216.58.194.46", "name": "dfw25s12-in-f46.1e100.net", "rtt": 4.863}]}]} diff --git a/tests/fixtures/generic/traceroute3.json b/tests/fixtures/generic/traceroute3.json index a7f26646..ea8e9f48 100644 --- a/tests/fixtures/generic/traceroute3.json +++ b/tests/fixtures/generic/traceroute3.json @@ -1 +1 @@ -{"destination_ip": "31.13.82.36", "destination_name": "facebook.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "175.41.192.133", "name": "ec2-175-41-192-133.ap-northeast-1.compute.amazonaws.com", "rtt": 1.002}, {"annotation": null, "asn": null, "ip": "175.41.192.133", "name": "ec2-175-41-192-133.ap-northeast-1.compute.amazonaws.com", "rtt": null}, {"annotation": null, "asn": null, "ip": "175.41.192.133", "name": "ec2-175-41-192-133.ap-northeast-1.compute.amazonaws.com", "rtt": 1.006}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "100.65.10.33", "name": "100.65.10.33", "rtt": 0.269}, {"annotation": null, "asn": null, "ip": "100.65.10.33", "name": "100.65.10.33", "rtt": 0.282}, {"annotation": null, "asn": null, "ip": "100.65.10.33", "name": "100.65.10.33", "rtt": 0.32}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "54.239.52.186", "name": "54.239.52.186", "rtt": 1.411}, {"annotation": null, "asn": null, "ip": "54.239.52.186", "name": "54.239.52.186", "rtt": 1.431}, {"annotation": null, "asn": null, "ip": "54.239.52.186", "name": "54.239.52.186", "rtt": 1.433}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "52.95.31.89", "name": "52.95.31.89", "rtt": 2.612}, {"annotation": null, "asn": null, "ip": "52.95.31.89", "name": "52.95.31.89", "rtt": 2.634}, {"annotation": null, "asn": null, "ip": "52.95.31.89", "name": "52.95.31.89", "rtt": 2.659}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": "52.95.31.56", "name": "52.95.31.56", "rtt": 1.017}, {"annotation": null, "asn": null, "ip": "52.95.31.56", "name": "52.95.31.56", "rtt": 1.028}, {"annotation": null, "asn": null, "ip": "52.95.31.56", "name": "52.95.31.56", "rtt": 1.048}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": "52.95.31.149", "name": "52.95.31.149", "rtt": 7.042}, {"annotation": null, "asn": null, "ip": "52.95.31.149", "name": "52.95.31.149", "rtt": 7.057}, {"annotation": null, "asn": null, "ip": "52.95.31.149", "name": "52.95.31.149", "rtt": 7.06}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": "54.239.53.66", "name": "54.239.53.66", "rtt": 7.828}, {"annotation": null, "asn": null, "ip": "54.239.53.66", "name": "54.239.53.66", "rtt": 7.81}, {"annotation": null, "asn": null, "ip": "54.239.53.66", "name": "54.239.53.66", "rtt": 7.997}]}, {"hop": 13, "probes": [{"annotation": null, "asn": null, "ip": "54.239.53.82", "name": "54.239.53.82", "rtt": 7.12}, {"annotation": null, "asn": null, "ip": "54.239.53.82", "name": "54.239.53.82", "rtt": 7.126}, {"annotation": null, "asn": null, "ip": "54.239.53.82", "name": "54.239.53.82", "rtt": 7.178}]}, {"hop": 14, "probes": [{"annotation": null, "asn": null, "ip": "63.222.51.9", "name": "63-222-51-9.static.pccwglobal.net", "rtt": 7.657}, {"annotation": null, "asn": null, "ip": "63.222.51.9", "name": "63-222-51-9.static.pccwglobal.net", "rtt": 7.611}, {"annotation": null, "asn": null, "ip": "63.222.51.9", "name": "63-222-51-9.static.pccwglobal.net", "rtt": 7.669}]}, {"hop": 15, "probes": [{"annotation": null, "asn": null, "ip": "63.218.250.169", "name": "HundredGE0-4-0-3.br02.tok02.pccwbtn.net", "rtt": 8.13}, {"annotation": null, "asn": null, "ip": "63.218.250.169", "name": "HundredGE0-4-0-3.br02.tok02.pccwbtn.net", "rtt": 8.368}, {"annotation": null, "asn": null, "ip": "63.218.250.169", "name": "HundredGE0-4-0-3.br02.tok02.pccwbtn.net", "rtt": 8.402}]}, {"hop": 16, "probes": [{"annotation": null, "asn": null, "ip": "63.218.251.118", "name": "63-218-251-118.static.pccwglobal.net", "rtt": 30.511}, {"annotation": null, "asn": null, "ip": "63.218.251.118", "name": "63-218-251-118.static.pccwglobal.net", "rtt": 20.379}, {"annotation": null, "asn": null, "ip": "63.218.251.118", "name": "63-218-251-118.static.pccwglobal.net", "rtt": 20.352}]}, {"hop": 17, "probes": [{"annotation": null, "asn": null, "ip": "157.240.40.9", "name": "po104.psw04.nrt1.tfbnw.net", "rtt": 8.341}, {"annotation": null, "asn": null, "ip": "157.240.40.9", "name": "po104.psw04.nrt1.tfbnw.net", "rtt": 8.303}, {"annotation": null, "asn": null, "ip": "157.240.40.9", "name": "po104.psw04.nrt1.tfbnw.net", "rtt": 8.312}]}, {"hop": 18, "probes": [{"annotation": null, "asn": null, "ip": "173.252.67.191", "name": "173.252.67.191", "rtt": 8.298}, {"annotation": null, "asn": null, "ip": "173.252.67.191", "name": "173.252.67.191", "rtt": 8.328}, {"annotation": null, "asn": null, "ip": "173.252.67.191", "name": "173.252.67.191", "rtt": 8.359}]}, {"hop": 19, "probes": [{"annotation": null, "asn": null, "ip": "31.13.82.36", "name": "edge-star-mini-shv-01-nrt1.facebook.com", "rtt": 8.214}, {"annotation": null, "asn": null, "ip": "31.13.82.36", "name": "edge-star-mini-shv-01-nrt1.facebook.com", "rtt": 8.198}, {"annotation": null, "asn": null, "ip": "31.13.82.36", "name": "edge-star-mini-shv-01-nrt1.facebook.com", "rtt": 8.192}]}]} +{"destination_ip": "31.13.82.36", "destination_name": "facebook.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "175.41.192.133", "name": "ec2-175-41-192-133.ap-northeast-1.compute.amazonaws.com", "rtt": 1.002}, {"annotation": null, "asn": null, "ip": "175.41.192.133", "name": "ec2-175-41-192-133.ap-northeast-1.compute.amazonaws.com", "rtt": 1.006}]}, {"hop": 2, "probes": []}, {"hop": 3, "probes": []}, {"hop": 4, "probes": []}, {"hop": 5, "probes": []}, {"hop": 6, "probes": []}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "100.65.10.33", "name": "100.65.10.33", "rtt": 0.269}, {"annotation": null, "asn": null, "ip": "100.65.10.33", "name": "100.65.10.33", "rtt": 0.282}, {"annotation": null, "asn": null, "ip": "100.65.10.33", "name": "100.65.10.33", "rtt": 0.32}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "54.239.52.186", "name": "54.239.52.186", "rtt": 1.411}, {"annotation": null, "asn": null, "ip": "54.239.52.186", "name": "54.239.52.186", "rtt": 1.431}, {"annotation": null, "asn": null, "ip": "54.239.52.186", "name": "54.239.52.186", "rtt": 1.433}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "52.95.31.89", "name": "52.95.31.89", "rtt": 2.612}, {"annotation": null, "asn": null, "ip": "52.95.31.89", "name": "52.95.31.89", "rtt": 2.634}, {"annotation": null, "asn": null, "ip": "52.95.31.89", "name": "52.95.31.89", "rtt": 2.659}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": "52.95.31.56", "name": "52.95.31.56", "rtt": 1.017}, {"annotation": null, "asn": null, "ip": "52.95.31.56", "name": "52.95.31.56", "rtt": 1.028}, {"annotation": null, "asn": null, "ip": "52.95.31.56", "name": "52.95.31.56", "rtt": 1.048}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": "52.95.31.149", "name": "52.95.31.149", "rtt": 7.042}, {"annotation": null, "asn": null, "ip": "52.95.31.149", "name": "52.95.31.149", "rtt": 7.057}, {"annotation": null, "asn": null, "ip": "52.95.31.149", "name": "52.95.31.149", "rtt": 7.06}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": "54.239.53.66", "name": "54.239.53.66", "rtt": 7.828}, {"annotation": null, "asn": null, "ip": "54.239.53.66", "name": "54.239.53.66", "rtt": 7.81}, {"annotation": null, "asn": null, "ip": "54.239.53.66", "name": "54.239.53.66", "rtt": 7.997}]}, {"hop": 13, "probes": [{"annotation": null, "asn": null, "ip": "54.239.53.82", "name": "54.239.53.82", "rtt": 7.12}, {"annotation": null, "asn": null, "ip": "54.239.53.82", "name": "54.239.53.82", "rtt": 7.126}, {"annotation": null, "asn": null, "ip": "54.239.53.82", "name": "54.239.53.82", "rtt": 7.178}]}, {"hop": 14, "probes": [{"annotation": null, "asn": null, "ip": "63.222.51.9", "name": "63-222-51-9.static.pccwglobal.net", "rtt": 7.657}, {"annotation": null, "asn": null, "ip": "63.222.51.9", "name": "63-222-51-9.static.pccwglobal.net", "rtt": 7.611}, {"annotation": null, "asn": null, "ip": "63.222.51.9", "name": "63-222-51-9.static.pccwglobal.net", "rtt": 7.669}]}, {"hop": 15, "probes": [{"annotation": null, "asn": null, "ip": "63.218.250.169", "name": "HundredGE0-4-0-3.br02.tok02.pccwbtn.net", "rtt": 8.13}, {"annotation": null, "asn": null, "ip": "63.218.250.169", "name": "HundredGE0-4-0-3.br02.tok02.pccwbtn.net", "rtt": 8.368}, {"annotation": null, "asn": null, "ip": "63.218.250.169", "name": "HundredGE0-4-0-3.br02.tok02.pccwbtn.net", "rtt": 8.402}]}, {"hop": 16, "probes": [{"annotation": null, "asn": null, "ip": "63.218.251.118", "name": "63-218-251-118.static.pccwglobal.net", "rtt": 30.511}, {"annotation": null, "asn": null, "ip": "63.218.251.118", "name": "63-218-251-118.static.pccwglobal.net", "rtt": 20.379}, {"annotation": null, "asn": null, "ip": "63.218.251.118", "name": "63-218-251-118.static.pccwglobal.net", "rtt": 20.352}]}, {"hop": 17, "probes": [{"annotation": null, "asn": null, "ip": "157.240.40.9", "name": "po104.psw04.nrt1.tfbnw.net", "rtt": 8.341}, {"annotation": null, "asn": null, "ip": "157.240.40.9", "name": "po104.psw04.nrt1.tfbnw.net", "rtt": 8.303}, {"annotation": null, "asn": null, "ip": "157.240.40.9", "name": "po104.psw04.nrt1.tfbnw.net", "rtt": 8.312}]}, {"hop": 18, "probes": [{"annotation": null, "asn": null, "ip": "173.252.67.191", "name": "173.252.67.191", "rtt": 8.298}, {"annotation": null, "asn": null, "ip": "173.252.67.191", "name": "173.252.67.191", "rtt": 8.328}, {"annotation": null, "asn": null, "ip": "173.252.67.191", "name": "173.252.67.191", "rtt": 8.359}]}, {"hop": 19, "probes": [{"annotation": null, "asn": null, "ip": "31.13.82.36", "name": "edge-star-mini-shv-01-nrt1.facebook.com", "rtt": 8.214}, {"annotation": null, "asn": null, "ip": "31.13.82.36", "name": "edge-star-mini-shv-01-nrt1.facebook.com", "rtt": 8.198}, {"annotation": null, "asn": null, "ip": "31.13.82.36", "name": "edge-star-mini-shv-01-nrt1.facebook.com", "rtt": 8.192}]}]} diff --git a/tests/fixtures/generic/traceroute5.json b/tests/fixtures/generic/traceroute5.json index d5d9b79c..302f883d 100644 --- a/tests/fixtures/generic/traceroute5.json +++ b/tests/fixtures/generic/traceroute5.json @@ -1 +1 @@ -{"destination_ip": "104.18.42.178", "destination_name": "10xhostings.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": 0.894}, {"annotation": null, "asn": null, "ip": null, "name": null, "rtt": 0.89}, {"annotation": null, "asn": null, "ip": null, "name": null, "rtt": 0.876}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": "204.141.42.25", "name": "204.141.42.25", "rtt": 2.818}, {"annotation": null, "asn": null, "ip": "204.141.42.25", "name": "204.141.42.25", "rtt": 2.825}, {"annotation": null, "asn": null, "ip": "204.141.42.25", "name": "204.141.42.25", "rtt": 2.825}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "204.141.42.9", "name": "204.141.42.9", "rtt": 1.014}, {"annotation": null, "asn": null, "ip": "204.141.42.9", "name": "204.141.42.9", "rtt": 1.017}, {"annotation": null, "asn": null, "ip": "204.141.42.9", "name": "204.141.42.9", "rtt": 1.082}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "128.241.1.145", "name": "xe-0-0-46-2.a00.sttlwa01.us.bb.gin.ntt.net", "rtt": 30.105}, {"annotation": null, "asn": null, "ip": "128.241.1.145", "name": "xe-0-0-46-2.a00.sttlwa01.us.bb.gin.ntt.net", "rtt": 30.125}, {"annotation": null, "asn": null, "ip": "128.241.1.145", "name": "xe-0-0-46-2.a00.sttlwa01.us.bb.gin.ntt.net", "rtt": 30.125}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "129.250.5.117", "name": "ae-9.r04.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.346}, {"annotation": null, "asn": null, "ip": "129.250.5.117", "name": "ae-9.r04.sttlwa01.us.bb.gin.ntt.net", "rtt": 31.946}, {"annotation": null, "asn": null, "ip": "129.250.5.117", "name": "ae-9.r04.sttlwa01.us.bb.gin.ntt.net", "rtt": 31.96}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "129.250.5.86", "name": "ae-0.a01.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.836}, {"annotation": null, "asn": null, "ip": "129.250.5.86", "name": "ae-0.a01.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.749}, {"annotation": null, "asn": null, "ip": "129.250.5.86", "name": "ae-0.a01.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.743}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "131.103.117.86", "name": "ae-0.cloudflare.sttlwa01.us.bb.gin.ntt.net", "rtt": 44.601}, {"annotation": null, "asn": null, "ip": "131.103.117.86", "name": "ae-0.cloudflare.sttlwa01.us.bb.gin.ntt.net", "rtt": 42.886}, {"annotation": null, "asn": null, "ip": "131.103.117.86", "name": "ae-0.cloudflare.sttlwa01.us.bb.gin.ntt.net", "rtt": 42.874}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "104.18.42.178", "name": "104.18.42.178", "rtt": 29.614}, {"annotation": null, "asn": null, "ip": "104.18.42.178", "name": "104.18.42.178", "rtt": 29.69}, {"annotation": null, "asn": null, "ip": "104.18.42.178", "name": "104.18.42.178", "rtt": 30.461}]}]} +{"destination_ip": "104.18.42.178", "destination_name": "10xhostings.com", "hops": [{"hop": 1, "probes": []}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": 0.894}, {"annotation": null, "asn": null, "ip": null, "name": null, "rtt": 0.89}, {"annotation": null, "asn": null, "ip": null, "name": null, "rtt": 0.876}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": "204.141.42.25", "name": "204.141.42.25", "rtt": 2.818}, {"annotation": null, "asn": null, "ip": "204.141.42.25", "name": "204.141.42.25", "rtt": 2.825}, {"annotation": null, "asn": null, "ip": "204.141.42.25", "name": "204.141.42.25", "rtt": 2.825}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "204.141.42.9", "name": "204.141.42.9", "rtt": 1.014}, {"annotation": null, "asn": null, "ip": "204.141.42.9", "name": "204.141.42.9", "rtt": 1.017}, {"annotation": null, "asn": null, "ip": "204.141.42.9", "name": "204.141.42.9", "rtt": 1.082}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "128.241.1.145", "name": "xe-0-0-46-2.a00.sttlwa01.us.bb.gin.ntt.net", "rtt": 30.105}, {"annotation": null, "asn": null, "ip": "128.241.1.145", "name": "xe-0-0-46-2.a00.sttlwa01.us.bb.gin.ntt.net", "rtt": 30.125}, {"annotation": null, "asn": null, "ip": "128.241.1.145", "name": "xe-0-0-46-2.a00.sttlwa01.us.bb.gin.ntt.net", "rtt": 30.125}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "129.250.5.117", "name": "ae-9.r04.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.346}, {"annotation": null, "asn": null, "ip": "129.250.5.117", "name": "ae-9.r04.sttlwa01.us.bb.gin.ntt.net", "rtt": 31.946}, {"annotation": null, "asn": null, "ip": "129.250.5.117", "name": "ae-9.r04.sttlwa01.us.bb.gin.ntt.net", "rtt": 31.96}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "129.250.5.86", "name": "ae-0.a01.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.836}, {"annotation": null, "asn": null, "ip": "129.250.5.86", "name": "ae-0.a01.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.749}, {"annotation": null, "asn": null, "ip": "129.250.5.86", "name": "ae-0.a01.sttlwa01.us.bb.gin.ntt.net", "rtt": 32.743}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "131.103.117.86", "name": "ae-0.cloudflare.sttlwa01.us.bb.gin.ntt.net", "rtt": 44.601}, {"annotation": null, "asn": null, "ip": "131.103.117.86", "name": "ae-0.cloudflare.sttlwa01.us.bb.gin.ntt.net", "rtt": 42.886}, {"annotation": null, "asn": null, "ip": "131.103.117.86", "name": "ae-0.cloudflare.sttlwa01.us.bb.gin.ntt.net", "rtt": 42.874}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "104.18.42.178", "name": "104.18.42.178", "rtt": 29.614}, {"annotation": null, "asn": null, "ip": "104.18.42.178", "name": "104.18.42.178", "rtt": 29.69}, {"annotation": null, "asn": null, "ip": "104.18.42.178", "name": "104.18.42.178", "rtt": 30.461}]}]} diff --git a/tests/fixtures/generic/traceroute6.json b/tests/fixtures/generic/traceroute6.json index acaf6e6b..c163564a 100644 --- a/tests/fixtures/generic/traceroute6.json +++ b/tests/fixtures/generic/traceroute6.json @@ -1 +1 @@ -{"destination_ip": "52.22.122.82", "destination_name": "alexa.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "130.185.80.253", "name": "130.185.80.253", "rtt": 0.374}, {"annotation": null, "asn": null, "ip": "130.185.80.253", "name": "130.185.80.253", "rtt": null}, {"annotation": null, "asn": null, "ip": "130.185.80.253", "name": "130.185.80.253", "rtt": 0.474}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "94.46.128.26", "name": "94.46.128.26", "rtt": 0.44}, {"annotation": null, "asn": null, "ip": "94.46.128.26", "name": "94.46.128.26", "rtt": 0.457}, {"annotation": null, "asn": null, "ip": "94.46.128.26", "name": "94.46.128.26", "rtt": 0.459}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": "80.231.158.49", "name": "ix-xe-1-3-0-0.tcore1.pv9-lisbon.as6453.net", "rtt": 0.436}, {"annotation": null, "asn": null, "ip": "80.231.158.49", "name": "ix-xe-1-3-0-0.tcore1.pv9-lisbon.as6453.net", "rtt": 0.436}, {"annotation": null, "asn": null, "ip": "80.231.158.49", "name": "ix-xe-1-3-0-0.tcore1.pv9-lisbon.as6453.net", "rtt": 0.446}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "80.231.158.30", "name": "if-ae-1-3.tcore1.sv8-highbridge.as6453.net", "rtt": 100.3}, {"annotation": null, "asn": null, "ip": "80.231.158.30", "name": "if-ae-1-3.tcore1.sv8-highbridge.as6453.net", "rtt": 100.346}, {"annotation": null, "asn": null, "ip": "80.231.158.30", "name": "if-ae-1-3.tcore1.sv8-highbridge.as6453.net", "rtt": 100.362}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "80.231.139.1", "name": "if-ae-2-2.tcore2.sv8-highbridge.as6453.net", "rtt": 100.737}, {"annotation": null, "asn": null, "ip": "80.231.139.1", "name": "if-ae-2-2.tcore2.sv8-highbridge.as6453.net", "rtt": 100.787}, {"annotation": null, "asn": null, "ip": "80.231.139.1", "name": "if-ae-2-2.tcore2.sv8-highbridge.as6453.net", "rtt": 100.863}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "80.231.139.42", "name": "if-ae-11-2.tcore1.l78-london.as6453.net", "rtt": 94.576}, {"annotation": null, "asn": null, "ip": "80.231.139.42", "name": "if-ae-11-2.tcore1.l78-london.as6453.net", "rtt": 94.647}, {"annotation": null, "asn": null, "ip": "80.231.139.42", "name": "if-ae-11-2.tcore1.l78-london.as6453.net", "rtt": 94.631}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "80.231.130.106", "name": "if-ae-66-2.tcore2.nto-new-york.as6453.net", "rtt": 104.775}, {"annotation": null, "asn": null, "ip": "80.231.130.106", "name": "if-ae-66-2.tcore2.nto-new-york.as6453.net", "rtt": 105.059}, {"annotation": null, "asn": null, "ip": "80.231.130.106", "name": "if-ae-66-2.tcore2.nto-new-york.as6453.net", "rtt": 105.146}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "66.110.96.5", "name": "if-ae-12-2.tcore1.n75-new-york.as6453.net", "rtt": 100.043}, {"annotation": null, "asn": null, "ip": "66.110.96.5", "name": "if-ae-12-2.tcore1.n75-new-york.as6453.net", "rtt": 100.096}, {"annotation": null, "asn": null, "ip": "66.110.96.5", "name": "if-ae-12-2.tcore1.n75-new-york.as6453.net", "rtt": 100.089}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "66.110.96.157", "name": "66.110.96.157", "rtt": 101.514}, {"annotation": null, "asn": null, "ip": "66.110.96.157", "name": "66.110.96.157", "rtt": 101.055}, {"annotation": null, "asn": null, "ip": "66.110.96.157", "name": "66.110.96.157", "rtt": 101.058}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": "52.93.31.33", "name": "52.93.31.33", "rtt": 100.489}, {"annotation": null, "asn": null, "ip": "52.93.31.33", "name": "52.93.31.33", "rtt": 100.113}, {"annotation": null, "asn": null, "ip": "52.93.31.33", "name": "52.93.31.33", "rtt": 100.065}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": "52.93.4.0", "name": "52.93.4.0", "rtt": 93.575}, {"annotation": null, "asn": null, "ip": "52.93.4.0", "name": "52.93.4.0", "rtt": 93.473}, {"annotation": null, "asn": null, "ip": "52.93.4.0", "name": "52.93.4.0", "rtt": 93.491}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 13, "probes": [{"annotation": null, "asn": null, "ip": "54.240.229.143", "name": "54.240.229.143", "rtt": 94.307}, {"annotation": null, "asn": null, "ip": "54.240.229.143", "name": "54.240.229.143", "rtt": 94.732}, {"annotation": null, "asn": null, "ip": "54.240.229.143", "name": "54.240.229.143", "rtt": 94.683}]}, {"hop": 14, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 15, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 16, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 17, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 18, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 19, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 20, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 21, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 22, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 23, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 24, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 25, "probes": [{"annotation": null, "asn": null, "ip": "52.93.28.172", "name": "52.93.28.172", "rtt": 94.27}, {"annotation": null, "asn": null, "ip": "52.93.28.172", "name": "52.93.28.172", "rtt": 94.296}, {"annotation": null, "asn": null, "ip": "52.93.28.172", "name": "52.93.28.172", "rtt": 94.294}]}, {"hop": 26, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 27, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 28, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 29, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 30, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "52.22.122.82", "destination_name": "alexa.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "130.185.80.253", "name": "130.185.80.253", "rtt": 0.374}, {"annotation": null, "asn": null, "ip": "130.185.80.253", "name": "130.185.80.253", "rtt": 0.474}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "94.46.128.26", "name": "94.46.128.26", "rtt": 0.44}, {"annotation": null, "asn": null, "ip": "94.46.128.26", "name": "94.46.128.26", "rtt": 0.457}, {"annotation": null, "asn": null, "ip": "94.46.128.26", "name": "94.46.128.26", "rtt": 0.459}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": "80.231.158.49", "name": "ix-xe-1-3-0-0.tcore1.pv9-lisbon.as6453.net", "rtt": 0.436}, {"annotation": null, "asn": null, "ip": "80.231.158.49", "name": "ix-xe-1-3-0-0.tcore1.pv9-lisbon.as6453.net", "rtt": 0.436}, {"annotation": null, "asn": null, "ip": "80.231.158.49", "name": "ix-xe-1-3-0-0.tcore1.pv9-lisbon.as6453.net", "rtt": 0.446}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "80.231.158.30", "name": "if-ae-1-3.tcore1.sv8-highbridge.as6453.net", "rtt": 100.3}, {"annotation": null, "asn": null, "ip": "80.231.158.30", "name": "if-ae-1-3.tcore1.sv8-highbridge.as6453.net", "rtt": 100.346}, {"annotation": null, "asn": null, "ip": "80.231.158.30", "name": "if-ae-1-3.tcore1.sv8-highbridge.as6453.net", "rtt": 100.362}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "80.231.139.1", "name": "if-ae-2-2.tcore2.sv8-highbridge.as6453.net", "rtt": 100.737}, {"annotation": null, "asn": null, "ip": "80.231.139.1", "name": "if-ae-2-2.tcore2.sv8-highbridge.as6453.net", "rtt": 100.787}, {"annotation": null, "asn": null, "ip": "80.231.139.1", "name": "if-ae-2-2.tcore2.sv8-highbridge.as6453.net", "rtt": 100.863}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "80.231.139.42", "name": "if-ae-11-2.tcore1.l78-london.as6453.net", "rtt": 94.576}, {"annotation": null, "asn": null, "ip": "80.231.139.42", "name": "if-ae-11-2.tcore1.l78-london.as6453.net", "rtt": 94.647}, {"annotation": null, "asn": null, "ip": "80.231.139.42", "name": "if-ae-11-2.tcore1.l78-london.as6453.net", "rtt": 94.631}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "80.231.130.106", "name": "if-ae-66-2.tcore2.nto-new-york.as6453.net", "rtt": 104.775}, {"annotation": null, "asn": null, "ip": "80.231.130.106", "name": "if-ae-66-2.tcore2.nto-new-york.as6453.net", "rtt": 105.059}, {"annotation": null, "asn": null, "ip": "80.231.130.106", "name": "if-ae-66-2.tcore2.nto-new-york.as6453.net", "rtt": 105.146}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": "66.110.96.5", "name": "if-ae-12-2.tcore1.n75-new-york.as6453.net", "rtt": 100.043}, {"annotation": null, "asn": null, "ip": "66.110.96.5", "name": "if-ae-12-2.tcore1.n75-new-york.as6453.net", "rtt": 100.096}, {"annotation": null, "asn": null, "ip": "66.110.96.5", "name": "if-ae-12-2.tcore1.n75-new-york.as6453.net", "rtt": 100.089}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "66.110.96.157", "name": "66.110.96.157", "rtt": 101.514}, {"annotation": null, "asn": null, "ip": "66.110.96.157", "name": "66.110.96.157", "rtt": 101.055}, {"annotation": null, "asn": null, "ip": "66.110.96.157", "name": "66.110.96.157", "rtt": 101.058}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": "52.93.31.33", "name": "52.93.31.33", "rtt": 100.489}, {"annotation": null, "asn": null, "ip": "52.93.31.33", "name": "52.93.31.33", "rtt": 100.113}, {"annotation": null, "asn": null, "ip": "52.93.31.33", "name": "52.93.31.33", "rtt": 100.065}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": "52.93.4.0", "name": "52.93.4.0", "rtt": 93.575}, {"annotation": null, "asn": null, "ip": "52.93.4.0", "name": "52.93.4.0", "rtt": 93.473}, {"annotation": null, "asn": null, "ip": "52.93.4.0", "name": "52.93.4.0", "rtt": 93.491}]}, {"hop": 12, "probes": []}, {"hop": 13, "probes": [{"annotation": null, "asn": null, "ip": "54.240.229.143", "name": "54.240.229.143", "rtt": 94.307}, {"annotation": null, "asn": null, "ip": "54.240.229.143", "name": "54.240.229.143", "rtt": 94.732}, {"annotation": null, "asn": null, "ip": "54.240.229.143", "name": "54.240.229.143", "rtt": 94.683}]}, {"hop": 14, "probes": []}, {"hop": 15, "probes": []}, {"hop": 16, "probes": []}, {"hop": 17, "probes": []}, {"hop": 18, "probes": []}, {"hop": 19, "probes": []}, {"hop": 20, "probes": []}, {"hop": 21, "probes": []}, {"hop": 22, "probes": []}, {"hop": 23, "probes": []}, {"hop": 24, "probes": []}, {"hop": 25, "probes": [{"annotation": null, "asn": null, "ip": "52.93.28.172", "name": "52.93.28.172", "rtt": 94.27}, {"annotation": null, "asn": null, "ip": "52.93.28.172", "name": "52.93.28.172", "rtt": 94.296}, {"annotation": null, "asn": null, "ip": "52.93.28.172", "name": "52.93.28.172", "rtt": 94.294}]}, {"hop": 26, "probes": []}, {"hop": 27, "probes": []}, {"hop": 28, "probes": []}, {"hop": 29, "probes": []}, {"hop": 30, "probes": []}]} diff --git a/tests/fixtures/generic/traceroute7.json b/tests/fixtures/generic/traceroute7.json index 0bdfb92c..e0423079 100644 --- a/tests/fixtures/generic/traceroute7.json +++ b/tests/fixtures/generic/traceroute7.json @@ -1 +1 @@ -{"destination_ip": "181.40.91.83", "destination_name": "paraguay.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": 128742, "ip": "192.168.0.1", "name": "192.168.0.1", "rtt": 9.173}, {"annotation": null, "asn": 128742, "ip": "192.168.0.1", "name": "192.168.0.1", "rtt": 5.49}, {"annotation": null, "asn": 128742, "ip": "192.168.0.1", "name": "192.168.0.1", "rtt": 5.197}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 3, "probes": [{"annotation": null, "asn": 0, "ip": "192.168.117.58", "name": "192.168.117.58", "rtt": 26.768}, {"annotation": null, "asn": 0, "ip": "192.168.117.58", "name": "192.168.117.58", "rtt": 17.878}, {"annotation": null, "asn": 0, "ip": "192.168.117.58", "name": "192.168.117.58", "rtt": 16.443}]}, {"hop": 4, "probes": [{"annotation": null, "asn": 0, "ip": "192.168.15.1", "name": "192.168.15.1", "rtt": 16.229}, {"annotation": null, "asn": 0, "ip": "192.168.15.1", "name": "192.168.15.1", "rtt": 23.514}, {"annotation": null, "asn": 0, "ip": "192.168.15.1", "name": "192.168.15.1", "rtt": 16.878}]}, {"hop": 5, "probes": [{"annotation": null, "asn": 0, "ip": "91.122.105.27", "name": "91.122.105.27", "rtt": 17.825}, {"annotation": null, "asn": 0, "ip": "91.122.105.27", "name": "91.122.105.27", "rtt": 22.906}, {"annotation": null, "asn": 0, "ip": "91.122.105.27", "name": "91.122.105.27", "rtt": 29.003}]}, {"hop": 6, "probes": [{"annotation": null, "asn": 0, "ip": "94.142.122.45", "name": "94.142.122.45", "rtt": 42.79}, {"annotation": null, "asn": 0, "ip": "94.142.122.45", "name": "94.142.122.45", "rtt": 46.352}, {"annotation": null, "asn": 0, "ip": "94.142.122.44", "name": "94.142.122.44", "rtt": 41.479}]}, {"hop": 7, "probes": [{"annotation": null, "asn": 0, "ip": "94.142.124.46", "name": "94.142.124.46", "rtt": 62.692}, {"annotation": null, "asn": 0, "ip": "94.142.124.46", "name": "94.142.124.46", "rtt": 44.691}, {"annotation": null, "asn": 0, "ip": "5.53.0.153", "name": "5.53.0.153", "rtt": 61.049}]}, {"hop": 8, "probes": [{"annotation": null, "asn": 0, "ip": "181.40.42.30", "name": "pool-30-42-40-181.telecel.com.py", "rtt": 65.148}, {"annotation": null, "asn": 0, "ip": "5.53.0.155", "name": "5.53.0.155", "rtt": 65.096}, {"annotation": null, "asn": 0, "ip": "181.40.42.30", "name": "pool-30-42-40-181.telecel.com.py", "rtt": 65.157}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 10, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 11, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 12, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "181.40.91.83", "destination_name": "paraguay.com", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": 128742, "ip": "192.168.0.1", "name": "192.168.0.1", "rtt": 9.173}, {"annotation": null, "asn": 128742, "ip": "192.168.0.1", "name": "192.168.0.1", "rtt": 5.49}, {"annotation": null, "asn": 128742, "ip": "192.168.0.1", "name": "192.168.0.1", "rtt": 5.197}]}, {"hop": 2, "probes": []}, {"hop": 3, "probes": [{"annotation": null, "asn": 0, "ip": "192.168.117.58", "name": "192.168.117.58", "rtt": 26.768}, {"annotation": null, "asn": 0, "ip": "192.168.117.58", "name": "192.168.117.58", "rtt": 17.878}, {"annotation": null, "asn": 0, "ip": "192.168.117.58", "name": "192.168.117.58", "rtt": 16.443}]}, {"hop": 4, "probes": [{"annotation": null, "asn": 0, "ip": "192.168.15.1", "name": "192.168.15.1", "rtt": 16.229}, {"annotation": null, "asn": 0, "ip": "192.168.15.1", "name": "192.168.15.1", "rtt": 23.514}, {"annotation": null, "asn": 0, "ip": "192.168.15.1", "name": "192.168.15.1", "rtt": 16.878}]}, {"hop": 5, "probes": [{"annotation": null, "asn": 0, "ip": "91.122.105.27", "name": "91.122.105.27", "rtt": 17.825}, {"annotation": null, "asn": 0, "ip": "91.122.105.27", "name": "91.122.105.27", "rtt": 22.906}, {"annotation": null, "asn": 0, "ip": "91.122.105.27", "name": "91.122.105.27", "rtt": 29.003}]}, {"hop": 6, "probes": [{"annotation": null, "asn": 0, "ip": "94.142.122.45", "name": "94.142.122.45", "rtt": 42.79}, {"annotation": null, "asn": 0, "ip": "94.142.122.45", "name": "94.142.122.45", "rtt": 46.352}, {"annotation": null, "asn": 0, "ip": "94.142.122.44", "name": "94.142.122.44", "rtt": 41.479}]}, {"hop": 7, "probes": [{"annotation": null, "asn": 0, "ip": "94.142.124.46", "name": "94.142.124.46", "rtt": 62.692}, {"annotation": null, "asn": 0, "ip": "94.142.124.46", "name": "94.142.124.46", "rtt": 44.691}, {"annotation": null, "asn": 0, "ip": "5.53.0.153", "name": "5.53.0.153", "rtt": 61.049}]}, {"hop": 8, "probes": [{"annotation": null, "asn": 0, "ip": "181.40.42.30", "name": "pool-30-42-40-181.telecel.com.py", "rtt": 65.148}, {"annotation": null, "asn": 0, "ip": "5.53.0.155", "name": "5.53.0.155", "rtt": 65.096}, {"annotation": null, "asn": 0, "ip": "181.40.42.30", "name": "pool-30-42-40-181.telecel.com.py", "rtt": 65.157}]}, {"hop": 9, "probes": []}, {"hop": 10, "probes": []}, {"hop": 11, "probes": []}, {"hop": 12, "probes": []}]} diff --git a/tests/fixtures/osx-10.14.6/traceroute-asn.json b/tests/fixtures/osx-10.14.6/traceroute-asn.json index 5ae90f6e..ef634d5a 100644 --- a/tests/fixtures/osx-10.14.6/traceroute-asn.json +++ b/tests/fixtures/osx-10.14.6/traceroute-asn.json @@ -1 +1 @@ -{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": 198949, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 6.07}, {"annotation": null, "asn": 198949, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 5.721}, {"annotation": null, "asn": 198949, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 5.269}]}, {"hop": 2, "probes": [{"annotation": null, "asn": 0, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 160.025}, {"annotation": null, "asn": 0, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 178.69}, {"annotation": null, "asn": 0, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 33.759}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": 7018, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 37.783}, {"annotation": null, "asn": 7018, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 23.782}, {"annotation": null, "asn": 7018, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 24.958}]}]} +{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": 198949, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 6.07}, {"annotation": null, "asn": 198949, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 5.721}, {"annotation": null, "asn": 198949, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 5.269}]}, {"hop": 2, "probes": [{"annotation": null, "asn": 0, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 160.025}, {"annotation": null, "asn": 0, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 178.69}, {"annotation": null, "asn": 0, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 33.759}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": 7018, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 37.783}, {"annotation": null, "asn": 7018, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 23.782}, {"annotation": null, "asn": 7018, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 24.958}]}]} diff --git a/tests/fixtures/osx-10.14.6/traceroute-no-header.json b/tests/fixtures/osx-10.14.6/traceroute-no-header.json new file mode 100644 index 00000000..812aac72 --- /dev/null +++ b/tests/fixtures/osx-10.14.6/traceroute-no-header.json @@ -0,0 +1 @@ +{"destination_ip": null, "destination_name": null, "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 11.415}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 3.934}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 3.286}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 24.174}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.817}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 27.771}]}, {"hop": 3, "probes": []}]} diff --git a/tests/fixtures/osx-10.14.6/traceroute-q.json b/tests/fixtures/osx-10.14.6/traceroute-q.json index 75e23ca5..8fbcba74 100644 --- a/tests/fixtures/osx-10.14.6/traceroute-q.json +++ b/tests/fixtures/osx-10.14.6/traceroute-q.json @@ -1 +1 @@ -{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 3.317}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 6.373}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 6.967}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 5.299}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 4.605}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 28.829}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.073}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 26.238}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 22.052}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 22.519}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}, {"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 3.317}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 6.373}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 6.967}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 5.299}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 4.605}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 28.829}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.073}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 26.238}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 22.052}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 22.519}]}, {"hop": 3, "probes": []}]} diff --git a/tests/fixtures/osx-10.14.6/traceroute.json b/tests/fixtures/osx-10.14.6/traceroute.json index 19ac25c1..c21a7778 100644 --- a/tests/fixtures/osx-10.14.6/traceroute.json +++ b/tests/fixtures/osx-10.14.6/traceroute.json @@ -1 +1 @@ -{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 12.07}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 4.328}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 4.167}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.595}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 26.13}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 28.555}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 149.663}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 27.761}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 160.709}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 27.131}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 160.459}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 32.274}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 143.143}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 27.034}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 152.676}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "12.255.10.234", "name": "12.255.10.234", "rtt": 24.912}, {"annotation": null, "asn": null, "ip": "12.255.10.234", "name": "12.255.10.234", "rtt": 23.802}, {"annotation": null, "asn": null, "ip": "12.255.10.234", "name": "12.255.10.234", "rtt": 157.338}]}, {"hop": 8, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 30.84}, {"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 22.503}, {"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 23.538}]}]} +{"destination_ip": "8.8.8.8", "destination_name": "8.8.8.8", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 12.07}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 4.328}, {"annotation": null, "asn": null, "ip": "192.168.1.254", "name": "dsldevice", "rtt": 4.167}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 20.595}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 26.13}, {"annotation": null, "asn": null, "ip": "76.220.24.1", "name": "76-220-24-1.lightspeed.sntcca.sbcglobal.net", "rtt": 28.555}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 149.663}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 27.761}, {"annotation": null, "asn": null, "ip": "12.122.149.186", "name": "12.122.149.186", "rtt": 160.709}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 27.131}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 160.459}, {"annotation": null, "asn": null, "ip": "12.122.3.70", "name": "sffca22crs.ip.att.net", "rtt": 32.274}]}, {"hop": 6, "probes": [{"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 143.143}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 27.034}, {"annotation": null, "asn": null, "ip": "12.122.163.61", "name": "12.122.163.61", "rtt": 152.676}]}, {"hop": 7, "probes": [{"annotation": null, "asn": null, "ip": "12.255.10.234", "name": "12.255.10.234", "rtt": 24.912}, {"annotation": null, "asn": null, "ip": "12.255.10.234", "name": "12.255.10.234", "rtt": 23.802}, {"annotation": null, "asn": null, "ip": "12.255.10.234", "name": "12.255.10.234", "rtt": 157.338}]}, {"hop": 8, "probes": []}, {"hop": 9, "probes": [{"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 30.84}, {"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 22.503}, {"annotation": null, "asn": null, "ip": "8.8.8.8", "name": "dns.google", "rtt": 23.538}]}]} diff --git a/tests/fixtures/osx-10.14.6/traceroute6-mult-addresses.json b/tests/fixtures/osx-10.14.6/traceroute6-mult-addresses.json index badd27b3..d7b9bfe1 100644 --- a/tests/fixtures/osx-10.14.6/traceroute6-mult-addresses.json +++ b/tests/fixtures/osx-10.14.6/traceroute6-mult-addresses.json @@ -1 +1 @@ -{"destination_ip": "2a04:4e42:200::323", "destination_name": "turner-tls.map.fastly.net", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 27.635}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 20.383}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 23.438}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.118}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.327}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 21.213}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "2a04:4e42:200::323", "destination_name": "turner-tls.map.fastly.net", "hops": [{"hop": 1, "probes": []}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 27.635}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 20.383}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 23.438}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.118}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.327}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 21.213}]}, {"hop": 5, "probes": []}]} diff --git a/tests/fixtures/osx-10.14.6/traceroute6.json b/tests/fixtures/osx-10.14.6/traceroute6.json index badd27b3..d7b9bfe1 100644 --- a/tests/fixtures/osx-10.14.6/traceroute6.json +++ b/tests/fixtures/osx-10.14.6/traceroute6.json @@ -1 +1 @@ -{"destination_ip": "2a04:4e42:200::323", "destination_name": "turner-tls.map.fastly.net", "hops": [{"hop": 1, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 27.635}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 20.383}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 23.438}]}, {"hop": 3, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.118}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.327}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 21.213}]}, {"hop": 5, "probes": [{"annotation": null, "asn": null, "ip": null, "name": null, "rtt": null}]}]} +{"destination_ip": "2a04:4e42:200::323", "destination_name": "turner-tls.map.fastly.net", "hops": [{"hop": 1, "probes": []}, {"hop": 2, "probes": [{"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 27.635}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 20.383}, {"annotation": null, "asn": null, "ip": "2001:506:6000:11b:71:156:212:143", "name": null, "rtt": 23.438}]}, {"hop": 3, "probes": []}, {"hop": 4, "probes": [{"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.118}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 20.327}, {"annotation": null, "asn": null, "ip": "2001:1890:ff:ff08:12:242:117:16", "name": null, "rtt": 21.213}]}, {"hop": 5, "probes": []}]} diff --git a/tests/test_date.py b/tests/test_date.py new file mode 100644 index 00000000..3274a1fd --- /dev/null +++ b/tests/test_date.py @@ -0,0 +1,34 @@ +import os +import json +import unittest +import jc.parsers.date + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/date.out'), 'r', encoding='utf-8') as f: + self.generic_date = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/date.json'), 'r', encoding='utf-8') as f: + self.generic_date_json = json.loads(f.read()) + + def test_date_nodata(self): + """ + Test 'date' with no data + """ + self.assertEqual(jc.parsers.date.parse('', quiet=True), {}) + + def test_date(self): + """ + Test 'date' + """ + self.assertEqual(jc.parsers.date.parse(self.generic_date, quiet=True), self.generic_date_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_ini.py b/tests/test_ini.py index c3f83714..977886e1 100644 --- a/tests/test_ini.py +++ b/tests/test_ini.py @@ -16,12 +16,6 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-iptelserver.ini'), 'r', encoding='utf-8') as f: self.generic_ini_iptelserver = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue.txt'), 'r', encoding='utf-8') as f: - self.generic_ini_keyvalue = f.read() - - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue-ifcfg.txt'), 'r', encoding='utf-8') as f: - self.generic_ini_keyvalue_ifcfg = f.read() - # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-test.json'), 'r', encoding='utf-8') as f: self.generic_ini_test_json = json.loads(f.read()) @@ -29,12 +23,6 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-iptelserver.json'), 'r', encoding='utf-8') as f: self.generic_ini_iptelserver_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue.json'), 'r', encoding='utf-8') as f: - self.generic_ini_keyvalue_json = json.loads(f.read()) - - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue-ifcfg.json'), 'r', encoding='utf-8') as f: - self.generic_ini_keyvalue_ifcfg_json = json.loads(f.read()) - def test_ini_nodata(self): """ Test the test ini file with no data @@ -53,18 +41,6 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.ini.parse(self.generic_ini_iptelserver, quiet=True), self.generic_ini_iptelserver_json) - def test_ini_keyvalue(self): - """ - Test a file that only includes key/value lines - """ - self.assertEqual(jc.parsers.ini.parse(self.generic_ini_keyvalue, quiet=True), self.generic_ini_keyvalue_json) - - def test_ini_keyvalue_ifcfg(self): - """ - Test a sample ifcfg key/value file that has quotation marks in the values - """ - self.assertEqual(jc.parsers.ini.parse(self.generic_ini_keyvalue_ifcfg, quiet=True), self.generic_ini_keyvalue_ifcfg_json) - if __name__ == '__main__': unittest.main() diff --git a/tests/test_kv.py b/tests/test_kv.py new file mode 100644 index 00000000..301aa60c --- /dev/null +++ b/tests/test_kv.py @@ -0,0 +1,46 @@ +import os +import unittest +import json +import jc.parsers.kv + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue.txt'), 'r', encoding='utf-8') as f: + self.generic_ini_keyvalue = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue-ifcfg.txt'), 'r', encoding='utf-8') as f: + self.generic_ini_keyvalue_ifcfg = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue.json'), 'r', encoding='utf-8') as f: + self.generic_ini_keyvalue_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/keyvalue-ifcfg.json'), 'r', encoding='utf-8') as f: + self.generic_ini_keyvalue_ifcfg_json = json.loads(f.read()) + + def test_kv_nodata(self): + """ + Test the test kv file with no data + """ + self.assertEqual(jc.parsers.kv.parse('', quiet=True), {}) + + def test_kv_keyvalue(self): + """ + Test a file that only includes key/value lines + """ + self.assertEqual(jc.parsers.kv.parse(self.generic_ini_keyvalue, quiet=True), self.generic_ini_keyvalue_json) + + def test_kv_keyvalue_ifcfg(self): + """ + Test a sample ifcfg key/value file that has quotation marks in the values + """ + self.assertEqual(jc.parsers.kv.parse(self.generic_ini_keyvalue_ifcfg, quiet=True), self.generic_ini_keyvalue_ifcfg_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_traceroute.py b/tests/test_traceroute.py index 31bfdfcd..bb0872e6 100644 --- a/tests/test_traceroute.py +++ b/tests/test_traceroute.py @@ -65,6 +65,9 @@ class MyTests(unittest.TestCase): self.generic_traceroute8 = f.read() # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/traceroute-no-header.json'), 'r', encoding='utf-8') as f: + self.osx_10_14_6_traceroute_no_header_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/traceroute.json'), 'r', encoding='utf-8') as f: self.centos_7_7_traceroute_json = json.loads(f.read()) @@ -124,9 +127,9 @@ class MyTests(unittest.TestCase): def test_traceroute_noheader(self): """ - Test 'traceroute' with missing header row. Should generate a ParseError exception + Test 'traceroute' with missing header row """ - self.assertRaises(jc.parsers.traceroute.ParseError, jc.parsers.traceroute.parse, self.osx_10_14_6_traceroute_noheader) + self.assertEqual(jc.parsers.traceroute.parse(self.osx_10_14_6_traceroute_noheader, quiet=True), self.osx_10_14_6_traceroute_no_header_json) def test_traceroute_centos_7_7(self): """