# mplane_http_transport

> mPlane HTTPS transport

Latest version **0.2.1** (published 2015-05-06) · BSD license · 0 weekly downloads

## Install

```sh
npm install mplane_http_transport
pnpm add mplane_http_transport
yarn add mplane_http_transport
bun add mplane_http_transport
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2015-05-06 |
| First published | 2014-10-03 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Fabrizio Invernizzi |
| Maintainers | finvernizzi |
| Keywords | mplane, measure, http, https |

## Links

- npm: https://www.npmjs.com/package/mplane_http_transport
- Repository: https://github.com/finvernizzi/mplane_http_transport
- Issues: https://github.com/finvernizzi/mplane_http_transport/issues
- npm.io page: https://npm.io/package/mplane_http_transport

## Dependencies (3)

- [async](https://npm.io/package/async.md) >=0.0.0
- [mplane](https://npm.io/package/mplane.md) >=0.5.0
- [request](https://npm.io/package/request.md) >=0.0.0

## Recent versions

- 0.2.1 (latest) — 2015-05-06
- 0.1.15 — 2015-03-03
- 0.1.14 — 2015-03-03
- 0.1.12 — 2015-01-29
- 0.1.11 — 2015-01-22
- 0.1.10 — 2015-01-21
- 0.1.9-b — 2015-01-21
- 0.1.9-a — 2015-01-21
- 0.1.8 — 2014-11-12
- 0.1.7 — 2014-11-12
- 0.1.6 — 2014-11-12
- 0.1.5 — 2014-11-12
- 0.1.4-a — 2014-10-27
- 0.1.4 — 2014-10-27
- 0.1.3 — 2014-10-27
- … 4 more at https://npm.io/package/mplane_http_transport/versions

## README

mplane_http_transport
=====================

[![mPlane](http://www.ict-mplane.eu/sites/default/files//public/mplane_final_256x_0.png)](http://www.ict-mplane.eu/)

This library implements a nodejs module for transport of [mPlane](http://www.ict-mplane.eu/) informational elements over HTTPS.
All transaction can be secured using trusted certificates.

#REST API
The implementation has a limited set of  [CRUD](http://en.wikipedia.org/wiki/Create,_read,_update_and_delete) set of messages.
In particular, for any of the mPlane informational elements, it is possible to Create and Read them between mPlane components.


##REGISTER
The register keyword is the Create message for an element.

###Capability
Use this message to register a list of capabilities.

    URL: /register/capability
    METHOD: POST
    BODY: json array containing the capabilities.
    ANSWER:
           + 200 OK. Operations completed. The body can contain a list of capabilityes not registered with some explanation
                    Example: {"label1":{registered:"no", reason:"..."} , "label1":{registered:"ok"}})
           + 400 not a capability/wrong format
           + 401 not authorized
           + 500 server error

This is an example of the body format generated by a probe to register on a supervisor.

```json
[ 
  { 
    "capability": "measure",
    "label": "pinger_TI_test",
    "metadata":
     { "System_type": "Pinger",
       "System_version": "0.1a",
       "System_ID": "Lab test machine" 
     },
    "link": "",
    "token": "c61ad8db5f9a4cc38e7ae8d8b5deae85ea93187b",
    "when": "now ... future / 1s",
    "resultvalues": [],
    "results": [ "delay.twoway" ],
    "parameters":{ 
        "destination.ip4": "192.168.0.1 ... 192.168.255.255",
        "number": "1 ... 10",
       "source.ip4": "192.168.0.1" 
    } 
  },
  { 
    "capability": "measure",
    "label": "tracer_TI_test",
    "metadata":{ 
        "System_type": "Tracer",
       "System_version": "0.1a",
       "System_ID": "Lab test machine" 
    },
    "link": "",
    "token": "361dcee90873ade735326ad411f87a995816ed20",
    "when": "now ... future / 1s",
    "resultvalues": [],
    "results": [ "delay.twoway", "hops.ip" ],
    "parameters":{ 
        "destination.ip4": "192.168.0.1 ... 192.168.255.255",
        "source.ip4": "192.168.0.1" 
     } 
  } 
]
```

###Result
Use this message to register a result.
    
    URL:/register/result
    METHOD:POST
    BODY: the result object
    ANSWER:
        + 200 OK
        + 400 not a result/wrong format
        + 401 not authorized
        + 403 unexpected result. Usually this is due to no specification known for this result.
        + 500 server error
        
Following json snippet is an example of a result message generated by a probe after a measure.

```json
{
    "result":"measure",
    "label":"tracer_TI_test",
    "metadata":{
        "System_type":"Tracer",
        "System_version":"0.1a",
        "System_ID":"Lab test machine",
        "eventTime":"2014-10-02T15:43:09.397Z",
        "specification_status":"queued"
     },
     "link":"",
     "token":"361dcee90873ade735326ad411f87a995816ed20",
     "when":"2014-09-29 10:19:26.765203 ... 2014-09-29 10:19:27.767020",
     "resultvalues":[[0.3,1]],
     "results":["delay.twoway","hops.ip"],
     "parameters":{
        "destination.ip4":"192.168.0.4",
        "source.ip4":"192.168.0.1"
     }
}
```

##Specification
Use this message to register a specification for a component.
  
    URL: /register/specification
    METHOD: POST
    BODY: {DistinguishedName:{specification}}. The distinguished name of the component you need to register a specification for
    ANSWER:
        + 200 OK. The body will contain the receipt of the required specification
        + 400 not a specification/wrong format
        + 401 not authorized
        + 403 unrecognized specification. Usually this is due to no capability known for this specification.
        + 500 server error
 
Following code is an example of Specification message generated by a client to register a new Specification on a Supervisor for a specific registered probe (pinger1.TI.mplane.org)

```json
{
    "pinger1.TI.mplane.org":{
            "specification":"measure",
            "label":"pinger_TI_test",
            "metadata":{
                "System_type":"Pinger",
                "System_version":"0.1a",
                "System_ID":"Lab test machine",
                "eventTime":"2014-10-02T15:47:07.634Z"},
                "link":"",
                "token":"c61ad8db5f9a4cc38e7ae8d8b5deae85ea93187b",
                "when":"now + 1s",
                "resultvalues":[],
                "results":["delay.twoway"],
                "parameters":{
                    "destination.ip4":"192.168.0.4",
                    "number":"5",
                    "source.ip4":"192.168.0.1"
                }
        }
}
```

##SHOW
These set of messages is implemented to read information from specific mPlane component. 

###Result
Use this message to show result from a receipt.
    
    URL:/show/result
    METHOD:POST
    BODY: redemption of the specification you need to know results.
    ANSWER:
        + If the result is available
            200 OK + result 
        + If the Result is not available
            200 OK + receipt of the Specification
        + 401 not authorized
        + 403 unexpected redemption. Usually this is due to no Specification kwnon for the redeem provided.
        + 500 server error

###Capability
Use this message to show capability kwnon by a component.

        URL:/show/capability
        METHOD:GET
        BODY: empty
        ANSWER:
               + 200 OK. The body contains the capabilities in the format {DN1:[capability1, capability2],…}
               + 401 not authorized
               + 500 server error
               
               
Following code is an example of json body generated by a Supervisor upon request of all the registered capabilities

```json
{ 
    "pinger1.TI.mplane.org":
             [ 
                 { 
                       "capability": "measure",
                       "label": "pinger_TI_test",
                       "metadata": [Object],
                       "link": "",
                       "token": "c61ad8db5f9a4cc38e7ae8d8b5deae85ea93187b",
                       "when": "now ... future / 1s",
                       "resultvalues": [],
                       "results": [Object],
                       "parameters": [Object] 
                 },
                 { 
                    "capability": "measure",
                    "label": "tracer_TI_test",
                    "metadata": [Object],
                    "link": "",
                    "token": "361dcee90873ade735326ad411f87a995816ed20",
                    "when": "now ... future / 1s",
                    "resultvalues": [],
                    "results": [Object],
                    "parameters": [Object] 
                 } 
             ] 
}
```

###Specification
This Api is needed to show Specification registered on a component.

        URL:/show/specification
        METHOD:GET
        BODY: empty
        ANSWER:
               + 200 OK. The body contains an array of specifications. Component can filter Specifications from the provided DN.
               + 401 not authorized
               + 428 not registered. This message is returned if the component needs to have at least a registered capability from the Component. 
                    It is a way to inform all probes that a Supervisor lost all the capability (for example after a crash) and ask probes to register again. 
               + 500 server error

---
_Source: https://npm.io/package/mplane_http_transport · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
