MIMIC OpenAPI Guide

  1. Table of Contents
  2. Requirements
  3. The MIMIC OpenAPI is an optional Update Wizard package, which implements a OpenAPI based REST API to control MIMIC.

    In order to export the MIMIC OpenAPI, you have to run the mimic-openapi-daemon from the linux directory of the MIMIC installation as follows:

    $ ./mimic-openapi-daemon
    Thu Jan 23 14:30:20 EST 2020 - Only plain HTTP is working because tcl-TLS is not available in the system
    
    Thu Jan 23 14:30:20 EST 2020 - Opened socket sock24ceb20 for port 8080
    
    

    If you want to export the OpenAPI via HTTPS, then you also need to download the optional TLSTCL package with Update Wizard.

  4. API Reference
  5. See the definition on SwaggerHub

  6. Examples
    • The TestOpenAPI.java program is an small test program to exercise the MIMIC API.

      
      
      
    • You can use any command-line HTTP client such as curl . Eg. if the default agent.cfg lab configuration is loaded:

      $ curl -u lab:lab123 -X GET http://127.0.0.1:8080/mimic/get/max
      20000
      $ curl -u lab:lab123 -X GET --insecure https://127.0.0.1:8443/mimic/get/max
      20000
      $ curl -u lab:lab123 -X GET http://127.0.0.1:8080/mimic/get/last
      7
      $ curl -u lab:lab123 -X GET http://127.0.0.1:8080/mimic/get/cfgfile
      agent.cfg
      $ curl -u lab:lab123 -X GET http://127.0.0.1:8080/mimic/agent/1/get/host
      10.1.120.142
      $ curl -u lab:lab123 -X GET http://127.0.0.1:8080/mimic/agent/7/get/mibs 2> /dev/null \
       | python -mjson.tool
      [
          {
              "device": "sim-10.48.0.1.random",
              "mib": "RFC1213-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "SNMPv2-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "IF-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "EtherLike-MIB",
              "scenario": "1"
          },
          // removed 285 lines of MIBs for brevity
          {
              "device": "sim-10.48.0.1.random",
              "mib": "SNMP-NOTIFICATION-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "SNMP-USER-BASED-SM-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "SNMP-VIEW-BASED-ACM-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "cisco/CISCOTRAP-MIB",
              "scenario": "1"
          },
          {
              "device": "sim-10.48.0.1.random",
              "mib": "cisco/OLD-CISCO-TCP-MIB",
              "scenario": "1"
          }
      ]
      
      
    • The Postman API Client, can be used to do simple queries.