Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

1. Objective

Create an opConfig command-set for Cisco IOS devices (IOS_HOURLY) that:

·       Runs IOS CLI commands (e.g. show interfaces)

·       Uses TextFSM-based plugins: TextFsm, TextFsmTable, TextFsmInventory, AlertTextFsmMTU

·       Produces structured parsed output

·       Generates custom table data

·       Updates inventory

·       Creates user-based alerts (e.g. MTU)

2. opCommon.json Configuration

(In Production, This step is not needed)
Add the following under the opconfig section in opCommon.json:

"opconfig_ntc_templates": "<omk_conf>/ntc_templates",
"go_text_fsm" : "<omk_bin>/gotextfsm-impl"

Also copy the ntc_templates folder from install/ntc_templates to conf/ntc_templates

3. Command-Set Definition (IOS_INTERFACE_INVENTORY)

Create the file under:

/usr/local/omk/conf/command_sets.d/IOS_INTERFACE_INVENTORY.json

Example configuration:

{
   "IOS_INTERFACE_INVENTORY" : {
      "active" : "true",
      "os_info" : {
         "os" : "IOS"
      },
      "modified" : 1770074947,
      "scheduling_info" : {
         "run_local" : null,
         "run_commands_on_separate_connection" : "false",
         "attempt_timeout_recovery" : 1,
         "parameters_required" : null
      },
      "parameters" : [],
      "purging_policy" : {
         "purge_older_than" : null,
         "keep_last" : 0,
         "autoprotect_first_revision" : null
      },
      "commands" : [
         {
            "command" : "show interfaces",
            "compare_to_previous_revision" : null,
            "use_collection_plugin" : "",
            "tags" : [
               "DAILY",
               "detect-change",
               "inventory",
               "report-change"
            ],
            "use_processing_plugins" : [
               "TextFsm","TextFsmTable","TextFsmInventory","AlertTextFsmMTU"
            ],
            "custom_table_configuration" : [
               {
                  "title" : "Custom Table Data 01",
                  "labels" :[ "INTERFACE","DESCRIPTION", "BANDWIDTH", "MTU","SPEED", "PROTOCOL_STATUS"]
               },
               {
                  "title" : "Custom Table Data 02",
                  "labels" :[ "INTERFACE","DESCRIPTION"]
               }
            ],
            "report_level_min_changes" : null,
            "privileged" : "false",
            "multipage" : "true",
            "active" : "true"
         }
      ]
   }
}

4. Plugin Roles

TextFsm

·       Parses raw CLI output using NTC templates

·       Produces structured JSON data

TextFsmTable

·       Generates structured table output using command-set parameter: custom_table_configuration

TextFsmInventory

·       Updates node inventory data

AlertTextFsmMTU

·       Evaluates MTU values

·       Creates alerts in opEvents when thresholds are triggered

5. Running the Command-Set

Run using opconfig-cli:

./opconfig-cli.pl act=run_command_sets nodes=omk-core2 names="IOS_INTERFACE_INVENTORY" debug=9
Or
Create a VO Job to run command-set on selected nodes.

6. Expected Results

·       Structured parsed output from show interfaces

·       Custom tables visible in opConfig UI

·       Inventory updates for interfaces

·       Alerts created in opEvents for MTU conditions

7. Architecture Flow

show interfaces (command)

TextFsm (NTC Template)
(go binary processes command output using NTC Templates)

Structured Data (JSON)

┌─────────────────────────────┐
│ TextFsmTable │ → Table Output |
│ TextFsmInventory │ → Inventory Update |
│ AlertTextFsmMTU │ → Event Creation |
└─────────────────────────────┘

  • No labels