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

AsyncOS prompt not always matching #3327

Open
YoucefYousfi opened this issue Nov 26, 2024 · 6 comments
Open

AsyncOS prompt not always matching #3327

YoucefYousfi opened this issue Nov 26, 2024 · 6 comments
Assignees
Milestone

Comments

@YoucefYousfi
Copy link

YoucefYousfi commented Nov 26, 2024

In our company, we have ESA devices running AsyncOS 14.X.
We have made two changes to adapt asyncos.rb to our devices :

  • prompt is in the format "(Machine hostname) " so we use this regex : prompt /^\r*([(]?[\w.- ]+[)]?[#>]\s*)$/ (I believe this is due to the devices running in cluster mode)
  • there is no third option for passphrase, only 1 or 2. We opt for 2 so we changed "send1\n" to "send2\n"

Apart from these changes, the script is identical. However, there is something wrong with the behavior that I could not understand : The prompt is correctly detected and handled until the end of the showconfig command, the prompt reappears and is identical as expected, but Oxidized does not run the pre_logout command "exit" to end the session. Instead, it hangs until the timeout is raised, failing the backup.

I could not identify the cause of this, any idea on how to fix this?

robertcheramy added a commit that referenced this issue Nov 29, 2024
- The prompt specified in issue #3327 works
- Creating a cmdset in order to get a YAML simulation file
@robertcheramy
Copy link
Collaborator

The prompt you specified ("(Machine hostname) ") works in Version 0.31.0 without changing the model.
Could you provide a [YAML Simulation file}(https://github.com/ytti/oxidized/blob/master/docs/Issues.md#sumbit-a-yaml-simulation-file) ?

The needed script command line is `./device2yaml.rb user@devicename -c cmdsets/asyncos -o yaml/asyncos.yaml

You will have to press space and 3 + return when asked to, the script does not know how to interact to the device.

@YoucefYousfi
Copy link
Author

The file generated is rather big with 55809 lines due to the big configuration. The prompt is exactly in this format : "(Machine xx-xx-x1xx1-xxxx-xxxx.xxxx.xxxxx.example.xxx)> ". It does not match with default prompt due to this character '-'. That is how I generated the file but it contains sensitive configuration. However I can share the ssh logs so that you can see (it hangs at the end of showconfig command, when the prompt appears) :

        </capture_destinations>
        <capture_custom_filter></capture_custom_filter>
      </capture_filter>
    </system_packet_trace>
</config>

</machine>
</cluster_config>

(Machine xx-xx-x1xx1-xxxx-xxxx.xxxx.xxxxx.example.xxx)> 

@robertcheramy
Copy link
Collaborator

robertcheramy commented Dec 5, 2024

My mistake (unit tests should end with _spec ...). I can reproduce.

@robertcheramy robertcheramy added this to the 0.32 milestone Dec 5, 2024
@robertcheramy robertcheramy self-assigned this Dec 5, 2024
@YoucefYousfi
Copy link
Author

YoucefYousfi commented Dec 6, 2024

@robertcheramy Your change does work, but it still hangs on the last prompt after showconfig, as if it doesn't detect it. It could be due to the configuration size. The output I sent still stands.
After a while, the session times out by the AsyncOS device, resulting in this output :

(Machine xx-xx-x1xx1-xxxx-xxxx.xxxx.xxxxx.xxxx.xx)> Session closed due to idle timeout.

The actual built-in Oxidized timeout doesn't seem to trigger (mine is set to 60 seconds, asyncOS one is after 30 minutes) and the configuration remains in "never" status for a while until it eventually turns red "no_connection".

@robertcheramy robertcheramy reopened this Dec 7, 2024
@robertcheramy
Copy link
Collaborator

Sorry, I forgot the second part of the issue.

@robertcheramy
Copy link
Collaborator

robertcheramy commented Dec 8, 2024

Could you provide a YAML Simulation file ?

The needed script command line is `./device2yaml.rb user@devicename -c cmdsets/asyncos -o yaml/asyncos.yaml

You will have to press space and 3 + return when asked to, the script does not know how to interact to the device.

Please provide a YAML Simulation file, I can't see where the problem could be without it.

The needed script command line is ./device2yaml.rb user@devicename -c cmdsets/asyncos -o yaml/asyncos.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants