Versions Compared

Key

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

...

3. Command Set Definition (IOS_INTERFACE_INVENTORY)

Create the Command Set definition file under: /usr/local/omk/conf/command_sets.d/IOS_INTERFACE_INVENTORY.json
and adds the FSM plugins to

...

Command Set.
use_processing_plugins : which plugins to run during process_configuration step,
custom_table_configuration : How many table configurations are needed and their title and columns (This only works if TextFsmTable is part of use_processing_plugins)

Code Block
breakoutModewide
breakoutWidth760
languagejson

"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"]
        }
    ],

Example configuration:

When you have finished create the Command Set and manually editing it to add the TextFSM plugins, it should look like this:

Code Block
breakoutModewide
breakoutWidth760
{
   "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"
         }
      ]
   }
}

3. 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

4. Running the Command Set

...

Code Block
breakoutModewide
breakoutWidth760
/usr/local/omk/bin/opconfig-cli.pl act=run_command_sets nodes=omk-core2 names="IOS_INTERFACE_INVENTORY" debug=9


Or or
Create a Virtual Operator Job to run Command Set on selected nodes.

5. Expected Results

·       Structured parsed output from show interfaces

...

Code Block
breakoutModewide
breakoutWidth760
{"OVERRUN": "0","ENCAPSULATION": "ARPA","PROTOCOL_STATUS": "up","BIA": "ca02.07c1.0038","QUEUE_FLUSHES": "0","LAST_OUTPUT": "00:00:01","VLAN_ID_OUTER": "","LAST_OUTPUT_HANG": "never","QUEUE_MAX": "75","MEDIA_TYPE": "","FRAME": "0","ABORT": "0","LAST_INPUT": "never","SPEED": "","DELAY": "1000 usec","DUPLEX": "","QUEUE_DROPS": "0","INPUT_RATE": "0","IP_ADDRESS": "10.248.2.58","QUEUE_STRATEGY": "fifo","OUTPUT_PPS": "0","BANDWIDTH": "10000 Kbit","MAC_ADDRESS": "ca02.07c1.0038",
"MTU": "1500",
"OUTPUT_ERRORS": "0","CRC": "0","VLAN_ID": "","OUTPUT_PACKETS": "24855328","LINK_STATUS": "up","QUEUE_OUTPUT_DROPS": "0","PREFIX_LENGTH": "31","HARDWARE_TYPE": "AmdP2","OUTPUT_RATE": "0","VLAN_ID_INNER": "","DESCRIPTION": "pe1","RUNTS": "0","QUEUE_SIZE": "0","INPUT_PPS": "0","INPUT_PACKETS": "0",
"INTERFACE": "Ethernet2/0",
"INPUT_ERRORS": "0","GIANTS": "0"},

·       Custom tables visible in opConfig UI

INTERFACE

DESCRIPTION

BANDWIDTH

MTU

SPEED

PROTOCOL_STATUS

FastEthernet0/0

rr1

10000 Kbit

1530

10Mb/s

up

FastEthernet0/1

rr2

100000 Kbit

1500

100Mb/s

down

Ethernet1/0

rr2

10000 Kbit

1500

 

down

Ethernet1/1

rr2

10000 Kbit

1500

 

up

Ethernet1/2

p1

10000 Kbit

1500

 

up

Ethernet1/3

p3

10000 Kbit

1500

 

up

Ethernet1/4

p4

10000 Kbit

1500

 

up

Ethernet1/5

p5

10000 Kbit

1500

 

up

Ethernet1/6

p6

10000 Kbit

1500

 

up

Ethernet1/7

pe1

10000 Kbit

1500

 

down

Ethernet2/0

pe1

10000 Kbit

1500

 

up

·       Inventory updates for interfaces

Code Block
breakoutModewide
breakoutWidth760
{
    "_id" : ObjectId("65a5b8eb43c6b8c138bda392"),
    "data" : {
        "template_data" : {
            "INPUT_RATE" : NumberInt(0),
            "DUPLEX" : "",
            "QUEUE_DROPS" : NumberInt(0),
            "DELAY" : "1000 usec",
            "ABORT" : NumberInt(0),
            "LAST_INPUT" : "never",
            "SPEED" : "",
            "LAST_OUTPUT_HANG" : "never",
            "QUEUE_MAX" : NumberInt(75),
            "FRAME" : NumberInt(0),
            "MEDIA_TYPE" : "",
            "VLAN_ID_OUTER" : "",
            "BIA" : "ca02.07c1.0038",
            "LAST_OUTPUT" : "00:00:01",
            "QUEUE_FLUSHES" : NumberInt(0),
            "ENCAPSULATION" : "ARPA",
            "OVERRUN" : NumberInt(0),
            "PROTOCOL_STATUS" : "up",
            "INPUT_ERRORS" : NumberInt(0),
            "INTERFACE" : "Ethernet2/0",
            "GIANTS" : NumberInt(0),
            "INPUT_PACKETS" : NumberInt(0),
            "QUEUE_SIZE" : NumberInt(0),
            "RUNTS" : NumberInt(0),
            "INPUT_PPS" : NumberInt(0),
            "HARDWARE_TYPE" : "AmdP2",
            "OUTPUT_RATE" : NumberInt(0),
            "DESCRIPTION" : "pe1",
            "VLAN_ID_INNER" : "",
            "CRC" : NumberInt(0),
            "OUTPUT_PACKETS" : NumberInt(24855328),
            "VLAN_ID" : "",
            "LINK_STATUS" : "up",
            "PREFIX_LENGTH" : NumberInt(31),
            "QUEUE_OUTPUT_DROPS" : NumberInt(0),
            "OUTPUT_ERRORS" : NumberInt(0),
            "MTU" : NumberInt(1500),
            "IP_ADDRESS" : "10.248.2.58",
            "QUEUE_STRATEGY" : "fifo",
            "OUTPUT_PPS" : NumberInt(0),
            "BANDWIDTH" : "10000 Kbit",
            "MAC_ADDRESS" : "ca02.07c1.0038"
        }
    }
}

·       Alerts created in opEvents for MTU conditions

Alert

Node

Element

State

Details

Incorrect MTU

omk-core2

Ethernet2/5

Warning

MTU alert for interface: Ethernet2/5 (MTU: 1500)

Incorrect MTU

omk-core2

Ethernet2/3

Warning

MTU alert for interface: Ethernet2/3 (MTU: 1500)

Incorrect MTU

omk-core2

Ethernet1/6

Warning

MTU alert for interface: Ethernet1/6 (MTU: 1500)

Incorrect MTU

omk-core2

Loopback3

Normal

MTU alert for interface: Loopback3 (MTU: 1514)

Incorrect MTU

omk-core2

Ethernet1/1

Warning

MTU alert for interface: Ethernet1/1 (MTU: 1500)

6. Architecture Flow

...