Embedded Event Manager

  • Way to trigger action when an event occurs on most Cisco IOS/IOS-XE/Cisco Flavor devices.
  • Events can be related to the following:
  • Following the event the following actions can be triggered:
  • Often times EEM is used to track specific Syslog messages or interface status’. For example when an OSPF adjacency is lost, an event could be triggered to send an email out debugging. Example below:

XML

  • eXtensible Markup Language
    • Open standard
    • Made up of Tags and Elements
      • Tag
        • Sits at beginning and end of data.
        • The start tag name is encapsulated with <>.
        • Specific name does not matter.
        • The end tag is encapsulated with </>
          • Ex. Begin <tagname>
          • Ex. End </tagname>
      • Element
        • Refers to data between tags.
        • Empty Element – <tagname />
    • Tag and element indentation does not matter.
    • XML Declaration:
      • At beginning of XML File and is optional.
      • Prepares XML processor to parse document.
        • ex. <? xml version = “#.0” encoding = “UTF-#”?>
    • Root
      • Main element of document
      • Top of Tree
    • Attributes
      • Elements can be associated with attributes.
      • Always follows a start tag.
        • Ex.start tag <tagname name=”value”>
        • Ex. end tag <tagname/>
    • Comments
      • Starts with “<!–” and ends with “–>”

JSON

  • Open Standard widely used in Web APIs today.
  • Purpose mainly for data serialization.
  • Indentation is completely optional, except for with string literals.
  • MAIN DATA STRUCTURES:
    • Objects/Dictionary
      • Groups of key value pairs.
      • Key must be a string.
      • Value can be objects, numbers, lists, boolean, strings or Null.
    • Lists
      • Ordered sequence of elements.
      • Elements can be same type as object values.
      • Can be objects, numbers, lists, boolean, strings or Null.
  • Object/Dictionary ex.
    • Curly braces and double quotes encapsulate name:value pairs, separated by commas.
      • {“R10″:”4431”, “R20:”2921”, “R30″:3850”}
  • List ex.
    • Same as Python
    • Encapsulated with square brackets and double quotes, separated by commas.
      • [“R1”, “R2”, “R3”]
  • Multi-Line Notation – common, ultimately doesn’t matter because whitespaces do not matter.
  • Using JSON in Python

import json

with open(“example.json”) as f:

data = f.read()

jsonDict = json.loads(data)

for k, v in jsonDict.items():

print( “The key {} uses a {} value.”.format(str(k), str(type(v))) )

  • with open(“example.json”) as f:
    • With open for better exception handling and closes file when done.
  • json.loads(data)
    • What converts imported string (with open <file>) into JSON object/dictionary.