PT Anywhere

Published on March 06, 2016

Main technologies used: JAX-RS (Jersey), Swagger & Redis.

Features

  • Implemented in Jersey 2.x. The API follows the JAX-RS 2.0 specification and fully uses annotations instead of ugly and obscure XML-based configurations.
  • REST-like API where resources are the center of the interactions (note: it is not fully hypermedia-driven). See the requests made in session where a new switch is created and linked with another one:
POST http://forge.kmi.open.ac.uk/api/v1/sessions
GET http://forge.kmi.open.ac.uk/api/v1/sessions/JcbaMo1lTh64loN_rTT8IA--/network
POST http://forge.kmi.open.ac.uk/api/v1/sessions/JcbaMo1lTh64loN_rTT8IA--/devices
GET http://forge.kmi.open.ac.uk/api/v1/sessions/JcbaMo1lTh64loN_rTT8IA--/devices/DulfylcRSbWcotn.3Gt2bQ--/ports?free=true
GET http://forge.kmi.open.ac.uk/api/v1/sessions/JcbaMo1lTh64loN_rTT8IA--/devices/5ejnGalLRjeKNmWML4HZQQ--/ports?free=true
POST http://forge.kmi.open.ac.uk/api/v1/sessions/JcbaMo1lTh64loN_rTT8IA--/devices/DulfylcRSbWcotn.3Gt2bQ--/ports/FastEthernet0+3/link

The following code shows the use of these features in practice:

How does it work?

What does the API do behind the scenes?

  • It assigns one Packet Tracer instance to each session (and destroys it afterwards). For more info, read the Internal API subsection.
  • It records interactions in TinCan API. For more info, read the Learning Analytics subsection.
  • It handles sessions using Redis. For example, it caches information of the running Packet Tracer instance to reduce internal requests and speed up loading.