Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cisco Like output #9

Open
p3rtinax opened this issue Nov 26, 2018 · 16 comments
Open

Cisco Like output #9

p3rtinax opened this issue Nov 26, 2018 · 16 comments
Labels
good first issue Good for newcomers

Comments

@p3rtinax
Copy link

Dear Alessandro,
Very useful code,
Following you from https://www.ictshore.com/python/python-ping-tutorial
When you gonna make it, or add Cisco like output flag to it?
It will be very more advanced if you add Cisco like output option,
I look forward to it

Thank you

@alessandromaggio
Copy link
Owner

Hello p3rtinax,

I'd really love to add the Cisco output on pythonping ASAP! Sadly, as I am busy on other projects, this won't happen soon. However, I would love to get other people on board on this project, so if you feel like contributing I'll try to write down some more specific requirements and you can fork me. I'll do my best to be available for any help or question!

Let me know what you think,
And many thanks!

@alessandromaggio alessandromaggio added the good first issue Good for newcomers label Mar 10, 2022
@ecdestro
Copy link

Sorry to bump an old issue, but I'm looking for my first open source project to contribute to, and github's recommended projects listed this one. So, hello!

Is there a good documentation on what the Cisco-like output should look like? Maybe I can take a look at this issue. I don't have really any Cisco terminal experience, but I'm feeling better about my Python experience lately, so let me know if there's anything I can pick up or start learning about.

@alessandromaggio
Copy link
Owner

@ecdestro, thanks for reaching out! In short, the Cisco output is a series of characters that represent the status of the ping. They appear on screen on the same line as soon as we get a result for the ping (either response, timeout, or something else). The line is truncated at 80 characters, so that if you have more than 80 pings they will go onto the next line.

  • ! for a succesful ping that got a reply
  • . timeout
  • U received a destination unreachable message
  • Q source quench, destination too busy (we may skip this in our implementation)
  • M could not fragment
  • ? unknown packet type (we may skip this in our implementation)
  • & TTL expired

You should read the full reference here: https://www.cisco.com/c/en/us/support/docs/ios-nx-os-software/ios-software-releases-121-mainline/12778-ping-traceroute.html

This output is great because it is quicker to understand if you are troubleshooting and do not really care about milliseconds for each packet. Furthermore, as this library is used extensively by network engineers, Cisco-like format is something they are well accustomed to.

@AleksaZatezalo
Copy link
Contributor

Hey @alessandromaggio

Can I take a crack at this issue if it's still open? We have a long weekend in my region this Friday. I want to get started with my first open source contribution... Formatting output should not be to big of an issue 👍

@ecdestro
Copy link

Hey @alessandromaggio

Can I take a crack at this issue if it's still open? We have a long weekend in my region this Friday. I want to get started with my first open source contribution... Formatting output should not be to big of an issue 👍

Sounds great to me! I'm excited to see this in action

@alessandromaggio
Copy link
Owner

Hey @alessandromaggio

Can I take a crack at this issue if it's still open? We have a long weekend in my region this Friday. I want to get started with my first open source contribution... Formatting output should not be to big of an issue 👍

@AleksaZatezalo I think @ecdestro was the first one to spot this issue so he should work on that. You mentioned documentation in another thread. True, we are good on documentation in the code but the README.md is pretty basic and does not fully explain the logic within the application itself. You may work on that, or extent tests to reach 100% coverage (which would be amazing to have a more reliable app).

@ecdestro
Copy link

ecdestro commented Oct 1, 2022

Also getting used to contributing on github, so please pardon my ignorance.

I've created a preliminary function in executor.py to just try some outputs:

class Response:
    ...
    def cisco_repr(self):
        if self.message is None:
            return "."
        elif self.success:
            return "!"
        else:
            return "U"

And have implemented out_format='cisco'

class Response:
    ...
    def __repr__(self):
        ...
        elif self.repr_format == 'cisco':
            return self.cisco_repr()

So I can get outputs of !, ., and U, but currently they are on individual lines. I'm curious about formatting the output to print the info line, then the symbol output line, then the stats line like Cisco's example:

Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/8 ms

I'm searching through the code to find the print statements looped through the count of pings, or the function that outputs results but I kinda end up chasing my own tail lol. I think it's in Response, or something that calls Response and iterates through it.

This is my first time really looking at someone else's code in an environment like this, so again I apologize for my ignorance. If you can point me in the right direction of how to control output messages, I think I have a handle on how to format this Cisco-like output for each message case, I just wanted to see what it might currently look like.

EDIT: I feel like it's somewhere within the append call or the Repeat object, but I don't know which one is telling the responses to enter a newline character.

@AleksaZatezalo
Copy link
Contributor

Hey @alessandromaggio

Thank you!

I will work on the README and help implement test cases :)

Kind Regards,
Aleksa

@batman004
Copy link

Hi @alessandromaggio, is this issue still up for grabs?

@alessandromaggio
Copy link
Owner

Hey folks sorry for late reply.

So, @ecdestro you are on the right path for this, you need to represent the individual response as you are alredy doing. However, in the ResponseList we need to make some tweaks because if we just iterate through responses and print them it wil be in individual lines as you said. So we need to fetch the string value from the response. Then, it is just a matter of printing on the same line as we go, using end="" in the native print() function.

@batman004 feel free to join @ecdestro to work on this.

@batman004
Copy link

Sure @alessandromaggio, thanks

@estaji
Copy link

estaji commented Mar 3, 2023

Hello dear @alessandromaggio , I am a newbie in Open Source. May I contribute to this issue?

estaji added a commit to estaji/pythonping that referenced this issue Mar 3, 2023
Add Cisco like output, related to issue alessandromaggio#9
@FahadYameen
Copy link

Hi @alessandromaggio, I was looking to my first open source contribution and found this issue. Is this still an issue and if no one is working on this so can I start working on this issue? I will appreciate your response in this regard.
Thanks.

@estaji
Copy link

estaji commented Apr 27, 2023

Hi dear @FahadYameen , I added a commit for this issue , but dear @alessandromaggio has not seen my commit yet. I worked on this issue. you can find and review my commit here #101

@ecdestro
Copy link

Sorry for the delay, life has gotten in the way of me working on this, I might have to pull back if someone else has a clearer idea of how to do this, I bow to your expertise.

@FahadYameen
Copy link

Hi @estaji, your changes LGTM. Thanks for the update 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

7 participants