Simon Hunt

GUI -- Created Mock WebSocket Server (runs with node.js)

- moved test scenario events to directory in test branch.

Change-Id: I1f94a9b4c844be1ea2633de0c74d49ebf5a770a7
Showing 243 changed files with 2 additions and 442 deletions
......@@ -30,7 +30,8 @@
// creates a web socket for the given path, returning a "handle".
// cb is the callbacks block.
function createWebSocket(path, cb) {
var fullUrl = ufs.wsUrl(path),
//var fullUrl = ufs.wsUrl(path),
var fullUrl = 'ws://localhost:8123/foo',
ws = new WebSocket(fullUrl),
api = {
meta: { path: fullUrl, ws: ws },
......
{
"event": "showTraffic",
"sid": 1,
"payload": {
"paths": [
{
"class": "secondary",
"links": [
"0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101",
"0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/101"
],
"labels": [
"35 bytes",
"35 bytes"
]
},
{
"class": "secondary optical",
"links": [
"of:0000ffffffff0003/4-of:0000ffffffffff03/1",
"of:0000ffffffff0008/4-of:0000ffffffffff08/1",
"of:0000ffffffffff08/4-of:0000ffffffffff03/1"
],
"labels": [
"24 bytes",
"some bits",
"foo bars"
]
}
]
}
}
{
"event": "showTraffic",
"sid": 1,
"payload": {
"paths": [
{
"class": "animated",
"traffic": true,
"links": [
"0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101",
"0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/101"
],
"labels": [
"47 bytes",
"47 bytes"
]
},
{
"class": "animated optical",
"traffic": true,
"links": [
"of:0000ffffffff0003/4-of:0000ffffffffff03/1",
"of:0000ffffffff0008/4-of:0000ffffffffff08/1",
"of:0000ffffffffff08/4-of:0000ffffffffff03/1"
],
"labels": [
"24 bytes",
"some bits",
"foo bars"
]
}
]
}
}
{
"event": "showTraffic",
"sid": 1,
"payload": {
"paths": [
{
"class": "primary",
"traffic": false,
"links": [
"of:0000ffffffff0008/2-of:0000ffffffff0003/1"
],
"labels": [""]
},
{
"class": "secondary",
"traffic": false,
"links": [
"of:0000ffffffff0003/9-of:0000ffffffff0007/2"
],
"labels": [""]
},
{
"class": "animated",
"traffic": true,
"links": [
"of:0000ffffffff0008/4-of:0000ffffffff0007/1"
],
"labels": [""]
},
{
"class": "animated optical",
"traffic": true,
"links": [
"of:0000ffffffff0008/4-of:0000ffffffffff08/1"
],
"labels": [""]
},
{
"class": "secondary optical",
"traffic": false,
"links": [
"of:0000ffffffff0003/4-of:0000ffffffffff03/1"
],
"labels": [""]
},
{
"class": "primary optical",
"traffic": false,
"links": [
"of:0000ffffffffff08/4-of:0000ffffffffff03/1"
],
"labels": [""]
}
]
}
}
{
"event": "showTraffic",
"sid": 1,
"payload": {
"paths": []
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000ffffffff0008",
"type": "switch",
"online": true,
"labels": [
"",
"sw-8",
"0000ffffffff0008"
],
"metaUi": {
"x": 734,
"y": 477
}
}
}
{
"event": "updateDevice",
"payload": {
"id": "of:0000ffffffff0007",
"type": "switch",
"online": false,
"labels": [
"",
"sw-7",
"0000ffffffff0007"
],
"metaUi": {
"x": 530,
"y": 330
}
}
}
{
"event": "updateDevice",
"payload": {
"id": "of:0000ffffffff0007",
"type": "switch",
"online": true,
"labels": [
"",
"sw-7",
"0000ffffffff0007"
],
"metaUi": {
"x": 530,
"y": 330
}
}
}
{
"event": "removeDevice",
"payload": {
"id": "of:0000ffffffff0008",
"type": "switch",
"online": false,
"labels": [
"",
"sw-8",
"0000ffffffff0008"
],
"metaUi": {
"x": 734,
"y": 477
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000ffffffff0008",
"type": "switch",
"online": true,
"labels": [
"",
"sw-8",
"0000ffffffff0008"
],
"metaUi": {
"x": 734,
"y": 477
}
}
}
{
"event": "removeHost",
"payload": {
"id": "0E:2A:69:30:13:88/-1",
"ingress": "0E:2A:69:30:13:88/-1/0-of:0000ffffffff0007/101",
"egress": "of:0000ffffffff0007/101-0E:2A:69:30:13:86/-1/0",
"cp": {
"device": "of:0000ffffffff0007",
"port": 101
},
"labels": [
"4.5.7.6",
"0E:2A:69:30:13:88"
],
"props": {}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000ffffffff0003",
"type": "switch",
"online": true,
"labels": [
"",
"sw-3",
"0000ffffffff0003"
],
"metaUi": {
"x": 282,
"y": 503
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000ffffffff0007",
"type": "switch",
"online": true,
"labels": [
"",
"sw-7",
"0000ffffffff0007"
],
"metaUi": {
"x": 530,
"y": 330
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": true,
"labels": [
"",
"opt-8",
"0000ffffffffff08"
],
"metaUi": {
"x": 734,
"y": 577
}
}
}
{
"event": "addDevice",
"payload": {
"id": "of:0000ffffffffff03",
"type": "roadm",
"online": true,
"labels": [
"",
"opt-3",
"0000ffffffffff03"
],
"metaUi": {
"x": 282,
"y": 603
}
}
}
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff0003/9-of:0000ffffffff0007/2",
"type": "direct",
"online": true,
"linkWidth": 2,
"src": "of:0000ffffffff0003",
"srcPort": "9",
"dst": "of:0000ffffffff0007",
"dstPort": "2",
"props" : {
"BW": "120 Gb"
}
}
}
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff0008/2-of:0000ffffffff0003/1",
"type": "direct",
"online": true,
"linkWidth": 2,
"src": "of:0000ffffffff0008",
"srcPort": "2",
"dst": "of:0000ffffffff0003",
"dstPort": "1",
"props" : {
"BW": "70 Gb"
}
}
}
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff0008/4-of:0000ffffffff0007/1",
"type": "direct",
"online": true,
"linkWidth": 2,
"src": "of:0000ffffffff0008",
"srcPort": "4",
"dst": "of:0000ffffffff0007",
"dstPort": "1",
"props" : {
"BW": "90 Gb"
}
}
}
{
"event": "addLink",
"payload": {
"id": "of:0000ffffffff0008/4-of:0000ffffffffff08/1",
"type": "direct",
"online": true,
"linkWidth": 2,
"src": "of:0000ffffffff0008",
"srcPort": "4",
"dst": "of:0000ffffffffff08",
"dstPort": "1",
"props" : {
"BW": "90 Gb"
}
}
}
{
"comments": [
"Stepping through showTraffic"
],
"title": "Show Traffic Scenario",
"params": {
"lastAuto": 14
},
"description": [
"Figure out primary, secondary and animated link visualizations.",
"",
"Press 'H' to show hosts.",
"",
"Press '=' to load initial events.",
"Press '-' to fire further events."
]
}
see: http://bost.ocks.org/mike/map/
brew install gdal
npm install -g topojson
To generate continental US map:
$ wget 'http://www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_1_states_provinces_lakes.zip'
$ unzip ne_50m_admin_1_states_provinces_lakes.zip
$ ogr2ogr -f GeoJSON -where "sr_adm0_a3 IN ('USA')" states.json ne_50m_admin_1_states_provinces_lakes.shp
edit states.json to remove data for Hawaii and Alaska
$ topojson states.json > topology.json
The .shp file above is incomplete (USA and part of Candada.)
So it may be that each region requires a bit of research to generate.
Ideally a source for public domain shp files can be found that covers all geographic regions.
For Canada:
# wget 'http://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/files-fichiers/gpr_000b11a_e.zip'
# unzip gpr_000b11a_e.zip
# ogr2ogr -f "GeoJSON" -s_srs EPSG:21781 -t_srs EPSG:4326 canada.json gpr_000b11a_e.shp
# topojson --id-property CFSAUID -p name=PRNAME -p name canada.json > topology.json
This produces a very large (5MB) file and draws very slowly in Chrome.
So some additional processing is required to simplify the geometry. (It is not checked in.)
Also, the specification of object structure within the geojson is unclear.
In the US map the geojson structure is
json.objects.states
but in the Canadian data it's
json.objects.canada
Lastly, the projection that is used may be tailored to the region.
The preferred projection for the US is "albers" and d3 provides a "albersUSA" which can be used to
project hawaii and alaska as well
For Canada, apparantly a "Lambert" projection (called conicConformal in d3) is preferred
see:
https://github.com/mbostock/d3/wiki/Geo-Projections
http://www.statcan.gc.ca/pub/92-195-x/2011001/other-autre/mapproj-projcarte/m-c-eng.htm
Summary:
- some additional work is required to fully generalize maps functionality.
- it may be worthwhile for ON.LAB to provide the topo files for key regions since producing these
files is non-trivial
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.