| 1 | == Config Server API == |
| 2 | |
| 3 | The config server is a RESTful API. The server (by default) listens on port 5000. All messages are in JSON and have a top level {{{status}}} entry. If {{{status}}} is not zero, the only other entry in the message will be a {{{message}}} field, which contains an error message. Otherwise the message will contain the information requested. |
| 4 | |
| 5 | * URL: **/this_is_a_bad_URL**. Bad URLs return a non-zero {{{status}}} and {{{error}}} message. |
| 6 | * Example: unknown URL: |
| 7 | {{{ |
| 8 | > curl http://localhost:5000/borkborkbork |
| 9 | { |
| 10 | "message": "404: Not Found", |
| 11 | "status": 1 |
| 12 | } |
| 13 | }}} |
| 14 | * Example: Bad request. A valid URL, but with bad "arguments". |
| 15 | {{{ |
| 16 | > curl http://localhost:5000/user/jjh |
| 17 | { |
| 18 | "message": "user jjh not found", |
| 19 | "status": 1 |
| 20 | } |
| 21 | }}} |
| 22 | * And another Invalid request. |
| 23 | {{{ |
| 24 | > curl http://localhost:5000/computer/bork |
| 25 | { |
| 26 | "message": "No computer 'bork' found.", |
| 27 | "status": 1 |
| 28 | } |
| 29 | }}} |
| 30 | |
| 31 | * URL: **/pnodes**. Return names of all physical nodes in the experiment. Each entry contains a {{{type}}}, {{{control_name}}}, and {{{exp_name}}} fields. |
| 32 | * Example |
| 33 | {{{ |
| 34 | > curl http://localhost:5000/computer/glory |
| 35 | { |
| 36 | "pnodes": [ |
| 37 | { |
| 38 | "control_name": "cpc9", |
| 39 | "exp_name": "pnode-0000", |
| 40 | "type": "pnode" |
| 41 | }, |
| 42 | { |
| 43 | "control_name": "cpc93", |
| 44 | "exp_name": "pnode-0001", |
| 45 | "type": "pnode" |
| 46 | }, |
| 47 | { |
| 48 | "control_name": "cpc90", |
| 49 | "exp_name": "config", |
| 50 | "type": "pnode" |
| 51 | } |
| 52 | ], |
| 53 | "status": 0 |
| 54 | } |
| 55 | }}} |
| 56 | |
| 57 | * URL: **/computer/<node_name>** - return information about computer given. What the information is is dependent on the type of computer. Currently supported: {{{pnode}}} and {{{qemu}}}. Examples of both are given below: |
| 58 | * QEMU: |
| 59 | {{{ |
| 60 | > curl http://localhost:5000/computer/glory |
| 61 | { |
| 62 | "computer": { |
| 63 | "arch": "x86_64", |
| 64 | "image_url": "http://scratch/benito/pangolinbz.img.bz2", |
| 65 | "interfaces": [ |
| 66 | { |
| 67 | "address": "10.0.1.3", |
| 68 | "bcast": null, |
| 69 | "capacity": { |
| 70 | "kind": "max", |
| 71 | "rate": 100000.0, |
| 72 | "units": "Kb/s" |
| 73 | }, |
| 74 | "mac": "00:00:00:00:00:07", |
| 75 | "mask": "255.255.255.0", |
| 76 | "name": "inf000", |
| 77 | "tap": false, |
| 78 | "tun": false |
| 79 | }, |
| 80 | { |
| 81 | "address": "172.16.100.130", |
| 82 | "bcast": null, |
| 83 | "capacity": null, |
| 84 | "mac": "00:66:00:00:64:82", |
| 85 | "mask": "255.240.0.0", |
| 86 | "name": "control0", |
| 87 | "tap": false, |
| 88 | "tun": false |
| 89 | } |
| 90 | ], |
| 91 | "name": "glory", |
| 92 | "os": "Ubuntu1204-64-STD", |
| 93 | "type": "qemu" |
| 94 | }, |
| 95 | "status": 1 |
| 96 | } |
| 97 | }}} |
| 98 | * Pnode: |
| 99 | {{{ |
| 100 | > curl http://localhost:5000/computer/pnode-0000 |
| 101 | { |
| 102 | "computer": { |
| 103 | "control_name": "cpc9", |
| 104 | "exp_name": "pnode-0000", |
| 105 | "type": "pnode" |
| 106 | }, |
| 107 | "status": 1 |
| 108 | } |
| 109 | }}} |
| 110 | |
| 111 | * URL: **/embed/<pnode_name>**. Returns a list of containers ("embeds") that run on that pnode. |
| 112 | * Example: |
| 113 | {{{ |
| 114 | > curl http://localhost:5000/embed/pnode-0000 |
| 115 | { |
| 116 | "embeds": [ |
| 117 | "giles", |
| 118 | "buffy", |
| 119 | "xander", |
| 120 | "angel" |
| 121 | ], |
| 122 | "status": 0 |
| 123 | } |
| 124 | }}} |
| 125 | |
| 126 | * URL: **/user/<login>**. Return the {{{/etc/passwd}}} type information for a user:{{{email}}}, {{{gid}}}, {{{password}}}, etc. |
| 127 | * Example |
| 128 | {{{ |
| 129 | > curl http://localhost:5000/user/glawler |
| 130 | { |
| 131 | "email": "\"glawler@tislabs.com\"", |
| 132 | "gid": 1, |
| 133 | "home": "/users/glawler", |
| 134 | "login": "glawler", |
| 135 | "name": "\"Geoff Lawler\"", |
| 136 | "password": "$1$25502626$SJgRY/qEUFJWWIB1rkFqW1", |
| 137 | "root": 1, |
| 138 | "shell": "bash", |
| 139 | "uid": 10467, |
| 140 | "user": "glawler" |
| 141 | } |
| 142 | }}} |
| 143 | |
| 144 | == Config DB Tables (Schema) == |
| 145 | |
| 146 | *to be pasted* |