Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

What is a personality?

A personality tells opConfig (or more precisely, the lower-level module Net::Appliance::Session) how to interact with a device, how to know when the connection is ready for the username or password, how to enter privileged mode, what state the current connection is in, and so on.

Personalities are defined by phrasebooks, the name of the folder containing the phrasebook defines the name of the personality.

What is a phrasebook?

A phrasebook is a file named "pb" that contains a list of prompts and macros, and the name of the directory the phrasebook resides in will be its personality name. Phrasebooks may be built up hierarchically from data in multiple subdirectories; e.g. a phrasebook "deeper down" in the  hierarchy has the ability to override settings loaded from the parent other directories "higher up".

...

Macro 
macro begin_privilegedcommands to send to enter privileged mode, followed by the prompt to expect
macro end_privileged

commands to send to exit privileged mode, followed by the prompt to expect

macro disconnectcommands to send to end the terminal session
macro pagingcommands to change the pager

 Creating a new phrasebook

To create a new phrasebook, make a new directory in the phrasebooks directory hierarchy located at /usr/local/omk/conf/phrasebooks, and place a text file named pb inside of it.  You now have a new personality/phrasebook with the name of the new directory that was created. If the directory was created at the base of the hierarchy the pb is truly empty and defines nothing, if it was in a subdirectory then the pb currently has the contents of the base directories pb.

The next step is to determine what should be in the phrasebook, this is the difficult part. 

Here Below is an algorithm to solve the problem.

Add First - Create a node to opConfig, set in opConfig.

Node creation in opConfig is documented HERE: opConfig adding nodes and credentials#AddingorModifyingNodes

Second - Set the personality to the new personality created, set .

To do this navigate to menu -> System -> Edit Nodes. Select the desired node from the list. In the settings menu on the left of the page select "Connection". There is a drop down menu next to personality, from here select the newly created personality from the list as shown in the image below.

Image Added

Third - Set the transport and credentials to be correct.

While not working do Ensure you have access to a device and are able to manually SSH or telnet to it and that you are authorized to do so. This is done by selecting the Transport drop down menu and selecting SSH or Telnet. Your credential set created for the device is also shown in the drop down menu next to "Credential Set" shown in the image above. This is documented more extensively HERE: Adding a new device to be supported by opConfig

If this is not working follow these steps:

  1. Attempt a test_connect to the node in question (debug=9 is important here)
    1. /usr/local/omk/bin/opconfig-cli.pl act=test_connect node=NODE_NAME debug=9
  2. Inspect the debug output, (it may work best to pipe the output to a file for inspection)
  3. the bottom line may give you information about the problem, eg:
    1. Error, connection test returned "Authentication Error", error message "login failed to remote host - prompt does not match"
  4. Look top down, attempting to figure out how far the terminal session got
    1. Look for lines like, they indicate prompts working and macros being run: 
      1. [   3.095807] pr  hit, matches prompt pass
      2. [   3.994504] pr  hit, matches prompt generic
      3. [   4.264275] en running macro begin_privileged
  5. You should now have a bit of an idea how far the connection attempt got
  6. Now look bottom up for where it failed, search for "pr failed:" or scroll through and look where the same output starts repeating, eg:
    1. -bash-4.1$
      [ 4.475526] pr nope, doesn't (yet) match connection_error
      [ 4.475725] pr nope, doesn't (yet) match generic
      [ 4.475914] pr nope, doesn't (yet) match pass
      [ 4.476100] pr nope, doesn't (yet) match privileged
      [ 4.476274] pr nope, doesn't (yet) match user
      [ 4.476398] pr no match so far, more data?
      [ 15.478110] pr failed: [read timed-out at /usr/local/ActivePerl-5.16/site/lib/Net/CLI/Interact/Transport/Wrapper/Net_Telnet.pm line 35

  7. Now figure out which prompt is failing to match, or which macro command is not working (eg, sudo -Hi bash may not work on your server but su - will)
    1. Change the prompt or macro, go back to step 1

...