Simon Hunt

GUI -- Simplified setRadio() api. Other minor cleanup. Added test topology data files.

{
"comment": [
"2 links removed from base",
" ff07 - ff09 ",
" ff01 - 0001 "
],
"devices": [
{
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff08",
"FF:FF:FF:FF:FF:08",
"?"
]
},
{
"id": "of:0000ffffffffff03",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff03",
"FF:FF:FF:FF:FF:03",
"?"
]
},
{
"id": "of:0000ffffffffff02",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff02",
"FF:FF:FF:FF:FF:02",
"?"
]
},
{
"id": "of:0000ffffffff0003",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0003",
"FF:FF:FF:FF:00:03",
"?"
]
},
{
"id": "of:0000ffffffffff07",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff07",
"FF:FF:FF:FF:FF:07",
"?"
]
},
{
"id": "of:0000ffffffffff06",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff06",
"FF:FF:FF:FF:FF:06",
"?"
]
},
{
"id": "of:0000ffffffff0007",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0007",
"FF:FF:FF:FF:00:07",
"?"
]
},
{
"id": "of:0000ffffffffff05",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff05",
"FF:FF:FF:FF:FF:05",
"?"
]
},
{
"id": "of:0000ffffffff0009",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0009",
"FF:FF:FF:FF:00:09",
"?"
]
},
{
"id": "of:0000ffffffffff04",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff04",
"FF:FF:FF:FF:FF:04",
"?"
]
},
{
"id": "of:0000ffffffff000A",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff000A",
"FF:FF:FF:FF:00:0A",
"?"
]
},
{
"id": "of:0000ffffffff0001",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0001",
"FF:FF:FF:FF:00:01",
"?"
]
},
{
"id": "of:0000ffffffffff01",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff01",
"FF:FF:FF:FF:FF:01",
"?"
]
},
{
"id": "of:0000ffffffff0004",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0004",
"FF:FF:FF:FF:00:04",
"?"
]
},
{
"id": "of:0000ffffffffff0A",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff0A",
"FF:FF:FF:FF:FF:0A",
"?"
]
},
{
"id": "of:0000ffffffffff09",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff09",
"FF:FF:FF:FF:FF:09",
"?"
]
}
],
"links": [
{
"src": "of:0000ffffffffff02",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff000A",
"srcPort": "2",
"dst": "of:0000ffffffffff0A",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "10",
"dst": "of:0000ffffffffff02",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "21",
"dst": "of:0000ffffffffff05",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "20",
"dst": "of:0000ffffffffff0A",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "20",
"dst": "of:0000ffffffffff06",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff02",
"srcPort": "10",
"dst": "of:0000ffffffffff01",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "1",
"dst": "of:0000ffffffff0009",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "30",
"dst": "of:0000ffffffffff04",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff0A",
"srcPort": "10",
"dst": "of:0000ffffffffff08",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0004",
"srcPort": "2",
"dst": "of:0000ffffffffff04",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "1",
"dst": "of:0000ffffffff0007",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0003",
"srcPort": "2",
"dst": "of:0000ffffffffff03",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
}
],
"hosts": [
{
"id": "00:00:00:00:00:03/-1",
"cp": {
"device": "of:0000ffffffff0003",
"port": 1
},
"labels": [
"10.0.0.3",
"00:00:00:00:00:03"
]
},
{
"id": "00:00:00:00:00:04/-1",
"cp": {
"device": "of:0000ffffffff0004",
"port": 1
},
"labels": [
"10.0.0.4",
"00:00:00:00:00:04"
]
},
{
"id": "00:00:00:00:00:0A/-1",
"cp": {
"device": "of:0000ffffffff000A",
"port": 1
},
"labels": [
"10.0.0.10",
"00:00:00:00:00:0A"
]
},
{
"id": "00:00:00:00:00:09/-1",
"cp": {
"device": "of:0000ffffffff0009",
"port": 1
},
"labels": [
"10.0.0.9",
"00:00:00:00:00:09"
]
},
{
"id": "00:00:00:00:00:07/-1",
"cp": {
"device": "of:0000ffffffff0007",
"port": 1
},
"labels": [
"10.0.0.7",
"00:00:00:00:00:07"
]
},
{
"id": "00:00:00:00:00:01/-1",
"cp": {
"device": "of:0000ffffffff0001",
"port": 1
},
"labels": [
"10.0.0.1",
"00:00:00:00:00:01"
]
}
]
}
{
"comment": [
"1 packet switch removed from base",
" 0007 "
],
"devices": [
{
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff08",
"FF:FF:FF:FF:FF:08",
"?"
]
},
{
"id": "of:0000ffffffffff03",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff03",
"FF:FF:FF:FF:FF:03",
"?"
]
},
{
"id": "of:0000ffffffffff02",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff02",
"FF:FF:FF:FF:FF:02",
"?"
]
},
{
"id": "of:0000ffffffff0003",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0003",
"FF:FF:FF:FF:00:03",
"?"
]
},
{
"id": "of:0000ffffffffff07",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff07",
"FF:FF:FF:FF:FF:07",
"?"
]
},
{
"id": "of:0000ffffffffff06",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff06",
"FF:FF:FF:FF:FF:06",
"?"
]
},
{
"id": "of:0000ffffffffff05",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff05",
"FF:FF:FF:FF:FF:05",
"?"
]
},
{
"id": "of:0000ffffffff0009",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0009",
"FF:FF:FF:FF:00:09",
"?"
]
},
{
"id": "of:0000ffffffffff04",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff04",
"FF:FF:FF:FF:FF:04",
"?"
]
},
{
"id": "of:0000ffffffff000A",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff000A",
"FF:FF:FF:FF:00:0A",
"?"
]
},
{
"id": "of:0000ffffffff0001",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0001",
"FF:FF:FF:FF:00:01",
"?"
]
},
{
"id": "of:0000ffffffffff01",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff01",
"FF:FF:FF:FF:FF:01",
"?"
]
},
{
"id": "of:0000ffffffff0004",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0004",
"FF:FF:FF:FF:00:04",
"?"
]
},
{
"id": "of:0000ffffffffff0A",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff0A",
"FF:FF:FF:FF:FF:0A",
"?"
]
},
{
"id": "of:0000ffffffffff09",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff09",
"FF:FF:FF:FF:FF:09",
"?"
]
}
],
"links": [
{
"src": "of:0000ffffffffff02",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff000A",
"srcPort": "2",
"dst": "of:0000ffffffffff0A",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "10",
"dst": "of:0000ffffffffff02",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "21",
"dst": "of:0000ffffffffff05",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0001",
"srcPort": "2",
"dst": "of:0000ffffffffff01",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "20",
"dst": "of:0000ffffffffff0A",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "20",
"dst": "of:0000ffffffffff06",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff02",
"srcPort": "10",
"dst": "of:0000ffffffffff01",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "1",
"dst": "of:0000ffffffff0009",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "30",
"dst": "of:0000ffffffffff04",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "20",
"dst": "of:0000ffffffffff09",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff0A",
"srcPort": "10",
"dst": "of:0000ffffffffff08",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0004",
"srcPort": "2",
"dst": "of:0000ffffffffff04",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "1",
"dst": "of:0000ffffffff0007",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0003",
"srcPort": "2",
"dst": "of:0000ffffffffff03",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
}
],
"hosts": [
{
"id": "00:00:00:00:00:03/-1",
"cp": {
"device": "of:0000ffffffff0003",
"port": 1
},
"labels": [
"10.0.0.3",
"00:00:00:00:00:03"
]
},
{
"id": "00:00:00:00:00:04/-1",
"cp": {
"device": "of:0000ffffffff0004",
"port": 1
},
"labels": [
"10.0.0.4",
"00:00:00:00:00:04"
]
},
{
"id": "00:00:00:00:00:0A/-1",
"cp": {
"device": "of:0000ffffffff000A",
"port": 1
},
"labels": [
"10.0.0.10",
"00:00:00:00:00:0A"
]
},
{
"id": "00:00:00:00:00:09/-1",
"cp": {
"device": "of:0000ffffffff0009",
"port": 1
},
"labels": [
"10.0.0.9",
"00:00:00:00:00:09"
]
},
{
"id": "00:00:00:00:00:07/-1",
"cp": {
"device": "of:0000ffffffff0007",
"port": 1
},
"labels": [
"10.0.0.7",
"00:00:00:00:00:07"
]
},
{
"id": "00:00:00:00:00:01/-1",
"cp": {
"device": "of:0000ffffffff0001",
"port": 1
},
"labels": [
"10.0.0.1",
"00:00:00:00:00:01"
]
}
]
}
{
"comment": [
"1 optical switch removed from base",
" ff07 "
],
"devices": [
{
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff08",
"FF:FF:FF:FF:FF:08",
"?"
]
},
{
"id": "of:0000ffffffffff03",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff03",
"FF:FF:FF:FF:FF:03",
"?"
]
},
{
"id": "of:0000ffffffffff02",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff02",
"FF:FF:FF:FF:FF:02",
"?"
]
},
{
"id": "of:0000ffffffff0003",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0003",
"FF:FF:FF:FF:00:03",
"?"
]
},
{
"id": "of:0000ffffffffff06",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff06",
"FF:FF:FF:FF:FF:06",
"?"
]
},
{
"id": "of:0000ffffffff0007",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0007",
"FF:FF:FF:FF:00:07",
"?"
]
},
{
"id": "of:0000ffffffffff05",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff05",
"FF:FF:FF:FF:FF:05",
"?"
]
},
{
"id": "of:0000ffffffff0009",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0009",
"FF:FF:FF:FF:00:09",
"?"
]
},
{
"id": "of:0000ffffffffff04",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff04",
"FF:FF:FF:FF:FF:04",
"?"
]
},
{
"id": "of:0000ffffffff000A",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff000A",
"FF:FF:FF:FF:00:0A",
"?"
]
},
{
"id": "of:0000ffffffff0001",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0001",
"FF:FF:FF:FF:00:01",
"?"
]
},
{
"id": "of:0000ffffffffff01",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff01",
"FF:FF:FF:FF:FF:01",
"?"
]
},
{
"id": "of:0000ffffffff0004",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0004",
"FF:FF:FF:FF:00:04",
"?"
]
},
{
"id": "of:0000ffffffffff0A",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff0A",
"FF:FF:FF:FF:FF:0A",
"?"
]
},
{
"id": "of:0000ffffffffff09",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff09",
"FF:FF:FF:FF:FF:09",
"?"
]
}
],
"links": [
{
"src": "of:0000ffffffffff02",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff000A",
"srcPort": "2",
"dst": "of:0000ffffffffff0A",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "10",
"dst": "of:0000ffffffffff02",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "21",
"dst": "of:0000ffffffffff05",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0001",
"srcPort": "2",
"dst": "of:0000ffffffffff01",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "20",
"dst": "of:0000ffffffffff0A",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "20",
"dst": "of:0000ffffffffff06",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff02",
"srcPort": "10",
"dst": "of:0000ffffffffff01",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "1",
"dst": "of:0000ffffffff0009",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "30",
"dst": "of:0000ffffffffff04",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "20",
"dst": "of:0000ffffffffff09",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff0A",
"srcPort": "10",
"dst": "of:0000ffffffffff08",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0004",
"srcPort": "2",
"dst": "of:0000ffffffffff04",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "1",
"dst": "of:0000ffffffff0007",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0003",
"srcPort": "2",
"dst": "of:0000ffffffffff03",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
}
],
"hosts": [
{
"id": "00:00:00:00:00:03/-1",
"cp": {
"device": "of:0000ffffffff0003",
"port": 1
},
"labels": [
"10.0.0.3",
"00:00:00:00:00:03"
]
},
{
"id": "00:00:00:00:00:04/-1",
"cp": {
"device": "of:0000ffffffff0004",
"port": 1
},
"labels": [
"10.0.0.4",
"00:00:00:00:00:04"
]
},
{
"id": "00:00:00:00:00:0A/-1",
"cp": {
"device": "of:0000ffffffff000A",
"port": 1
},
"labels": [
"10.0.0.10",
"00:00:00:00:00:0A"
]
},
{
"id": "00:00:00:00:00:09/-1",
"cp": {
"device": "of:0000ffffffff0009",
"port": 1
},
"labels": [
"10.0.0.9",
"00:00:00:00:00:09"
]
},
{
"id": "00:00:00:00:00:07/-1",
"cp": {
"device": "of:0000ffffffff0007",
"port": 1
},
"labels": [
"10.0.0.7",
"00:00:00:00:00:07"
]
},
{
"id": "00:00:00:00:00:01/-1",
"cp": {
"device": "of:0000ffffffff0001",
"port": 1
},
"labels": [
"10.0.0.1",
"00:00:00:00:00:01"
]
}
]
}
This diff is collapsed. Click to expand it.
{
"devices": [
{
"id": "of:0000ffffffffff08",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff08",
"FF:FF:FF:FF:FF:08",
"?"
]
},
{
"id": "of:0000ffffffffff03",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff03",
"FF:FF:FF:FF:FF:03",
"?"
]
},
{
"id": "of:0000ffffffffff02",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff02",
"FF:FF:FF:FF:FF:02",
"?"
]
},
{
"id": "of:0000ffffffff0003",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0003",
"FF:FF:FF:FF:00:03",
"?"
]
},
{
"id": "of:0000ffffffffff07",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff07",
"FF:FF:FF:FF:FF:07",
"?"
]
},
{
"id": "of:0000ffffffffff06",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff06",
"FF:FF:FF:FF:FF:06",
"?"
]
},
{
"id": "of:0000ffffffff0007",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0007",
"FF:FF:FF:FF:00:07",
"?"
]
},
{
"id": "of:0000ffffffffff05",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff05",
"FF:FF:FF:FF:FF:05",
"?"
]
},
{
"id": "of:0000ffffffff0009",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0009",
"FF:FF:FF:FF:00:09",
"?"
]
},
{
"id": "of:0000ffffffffff04",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff04",
"FF:FF:FF:FF:FF:04",
"?"
]
},
{
"id": "of:0000ffffffff000A",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff000A",
"FF:FF:FF:FF:00:0A",
"?"
]
},
{
"id": "of:0000ffffffff0001",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0001",
"FF:FF:FF:FF:00:01",
"?"
]
},
{
"id": "of:0000ffffffffff01",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff01",
"FF:FF:FF:FF:FF:01",
"?"
]
},
{
"id": "of:0000ffffffff0004",
"type": "switch",
"online": false,
"labels": [
"0000ffffffff0004",
"FF:FF:FF:FF:00:04",
"?"
]
},
{
"id": "of:0000ffffffffff0A",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff0A",
"FF:FF:FF:FF:FF:0A",
"?"
]
},
{
"id": "of:0000ffffffffff09",
"type": "roadm",
"online": false,
"labels": [
"0000ffffffffff09",
"FF:FF:FF:FF:FF:09",
"?"
]
}
],
"links": [
{
"src": "of:0000ffffffffff02",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff000A",
"srcPort": "2",
"dst": "of:0000ffffffffff0A",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "10",
"dst": "of:0000ffffffffff02",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "21",
"dst": "of:0000ffffffffff05",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0001",
"srcPort": "2",
"dst": "of:0000ffffffffff01",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "20",
"dst": "of:0000ffffffffff0A",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "20",
"dst": "of:0000ffffffffff05",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "20",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "20",
"dst": "of:0000ffffffffff06",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff02",
"srcPort": "10",
"dst": "of:0000ffffffffff01",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff09",
"srcPort": "1",
"dst": "of:0000ffffffff0009",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff03",
"srcPort": "30",
"dst": "of:0000ffffffffff04",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "20",
"dst": "of:0000ffffffffff09",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff0A",
"srcPort": "10",
"dst": "of:0000ffffffffff08",
"dstPort": "30",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0004",
"srcPort": "2",
"dst": "of:0000ffffffffff04",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff07",
"srcPort": "1",
"dst": "of:0000ffffffff0007",
"dstPort": "2",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffff0003",
"srcPort": "2",
"dst": "of:0000ffffffffff03",
"dstPort": "1",
"type": "optical",
"linkWidth": 2
},
{
"src": "of:0000ffffffffff06",
"srcPort": "30",
"dst": "of:0000ffffffffff08",
"dstPort": "10",
"type": "optical",
"linkWidth": 2
}
],
"hosts": [
{
"id": "00:00:00:00:00:03/-1",
"cp": {
"device": "of:0000ffffffff0003",
"port": 1
},
"labels": [
"10.0.0.3",
"00:00:00:00:00:03"
]
},
{
"id": "00:00:00:00:00:04/-1",
"cp": {
"device": "of:0000ffffffff0004",
"port": 1
},
"labels": [
"10.0.0.4",
"00:00:00:00:00:04"
]
},
{
"id": "00:00:00:00:00:0A/-1",
"cp": {
"device": "of:0000ffffffff000A",
"port": 1
},
"labels": [
"10.0.0.10",
"00:00:00:00:00:0A"
]
},
{
"id": "00:00:00:00:00:09/-1",
"cp": {
"device": "of:0000ffffffff0009",
"port": 1
},
"labels": [
"10.0.0.9",
"00:00:00:00:00:09"
]
},
{
"id": "00:00:00:00:00:07/-1",
"cp": {
"device": "of:0000ffffffff0007",
"port": 1
},
"labels": [
"10.0.0.7",
"00:00:00:00:00:07"
]
},
{
"id": "00:00:00:00:00:01/-1",
"cp": {
"device": "of:0000ffffffff0001",
"port": 1
},
"labels": [
"10.0.0.1",
"00:00:00:00:00:01"
]
}
]
}
......@@ -50,7 +50,10 @@
},
built = false,
errorCount = 0,
keyHandler = {};
keyHandler = {
fn: null,
map: {}
};
// DOM elements etc.
var $view,
......@@ -258,50 +261,56 @@
}
// generate 'unique' id by prefixing view id
function uid(view, id) {
function makeUid(view, id) {
return view.vid + '-' + id;
}
// restore id by removing view id prefix
function unUid(view, uid) {
function unmakeUid(view, uid) {
var re = new RegExp('^' + view.vid + '-');
return uid.replace(re, '');
}
function setRadioButtons(vid, btnSet, callback) {
function setRadioButtons(vid, btnSet) {
var view = views[vid],
btnG;
// lazily create the buttons...
if (!(btnG = view.radioButtons)) {
btnG = d3.select(document.createElement('div'));
btnG.buttonDef = {};
btnSet.forEach(function (btn, i) {
var bid = btn.id || 'b' + i,
txt = btn.text || 'Button #' + i,
b = btnG.append('span')
uid = makeUid(view, bid),
button = btnG.append('span')
.attr({
id: uid(view, bid),
id: uid,
class: 'radio'
})
.text(txt);
btnG.buttonDef[uid] = btn;
if (i === 0) {
b.classed('active', true);
button.classed('active', true);
}
});
btnG.selectAll('span')
.on('click', function (d) {
var btn = d3.select(this),
bid = btn.attr('id'),
act = btn.classed('active');
var button = d3.select(this),
uid = button.attr('id'),
btn = btnG.buttonDef[uid],
act = button.classed('active');
if (!act) {
$mastRadio.selectAll('span')
.classed('active', false);
btn.classed('active', true);
callback(view.token(), unUid(view, bid));
btnG.selectAll('span').classed('active', false);
button.classed('active', true);
if (isF(btn.cb)) {
btn.cb(view.token(), btn);
}
}
});
......@@ -479,8 +488,8 @@
return $(this.$div.node()).height();
},
setRadio: function (btnSet, cb) {
setRadioButtons(this.vid, btnSet, cb);
setRadio: function (btnSet) {
setRadioButtons(this.vid, btnSet);
},
setKeys: function (keyArg) {
......@@ -488,7 +497,7 @@
},
uid: function (id) {
return uid(this, id);
return makeUid(this, id);
}
// TODO: consider schedule, clearTimer, etc.
......
......@@ -23,7 +23,7 @@
(function (onos) {
'use strict';
var keyDispatch = {
var keyDispatch = {
Z: keyUndo,
X: keyCut,
C: keyCopy,
......
......@@ -23,33 +23,21 @@
(function (onos) {
'use strict';
var data = [ 'Yo, radio button set...', 'Time to shine' ],
var intro = [ 'Yo, radio button set...', 'Time to shine' ],
btnSet = [
{ id: 'b1', text: 'First Button' },
{ id: 'b2', text: 'Second Button' },
{ id: 'b3', text: 'Third Button' }
],
btnLookup = {};
{ text: 'First Button', cb: cbRadio },
{ text: 'Second Button', cb: cbRadio },
{ text: 'Third Button', cb: cbRadio }
];
btnSet.forEach(function (b) {
btnLookup[b.id] = b;
});
// invoked when the view is loaded
function load(view, ctx) {
view.setRadio(btnSet, doRadio);
view.$div.selectAll('p')
.data(data)
.enter()
.append('p')
.text(function (d) { return d; })
.style('padding', '2px 8px');
// radio button callback
function cbRadio(view, btn) {
write(view, 'You pressed the ' + btn.text);
}
function doRadio(view, id) {
function write(view, msg) {
view.$div.append('p')
.text('You pressed the ' + btnLookup[id].text)
.text(msg)
.style({
'font-size': '10pt',
color: 'green',
......@@ -58,6 +46,18 @@
});
}
// invoked when the view is loaded
function load(view, ctx) {
view.setRadio(btnSet);
view.$div.selectAll('p')
.data(intro)
.enter()
.append('p')
.text(function (d) { return d; })
.style('padding', '2px 8px');
}
// == register the view here, with links to lifecycle callbacks
onos.ui.addView('sampleRadio', {
......
......@@ -68,59 +68,130 @@
// radio buttons
var btnSet = [
{ id: 'showAll', text: 'All Layers' },
{ id: 'showPkt', text: 'Packet Only' },
{ id: 'showOpt', text: 'Optical Only' }
];
{ text: 'All Layers', cb: showAllLayers },
{ text: 'Packet Only', cb: showPacketLayer },
{ text: 'Optical Only', cb: showOpticalLayer }
];
// key bindings
var keyDispatch = {
Q: getUpdatedNetworkData,
B: toggleBg,
G: toggleLayout,
L: cycleLabels,
P: togglePorts,
U: unpin
};
// state variables
var svg,
bgImg,
network = {},
var network = {},
selected = {},
highlighted = null,
hovered = null,
viewMode = 'showAll',
portLabelsOn = false;
// D3 selections
var svg,
bgImg,
topoG;
// ==============================
// Private functions
// For Debugging / Development
var topoPrefix = 'json/topoTest_',
lastFlavor = 4,
topoBase = true,
topoFlavor = 1;
function nextTopo() {
if (topoBase) {
topoBase = false;
} else {
topoBase = true;
topoFlavor = (topoFlavor === lastFlavor) ? 1 : topoFlavor + 1
}
}
// set the size of the SVG layer (or other element) to that of the view
function setSize(view, el) {
var thing = el || svg;
thing.attr({
width: view.width(),
height: view.height()
});
// TODO change this to return the live data URL
function getTopoUrl() {
var suffix = topoBase ? 'base' : topoFlavor;
return topoPrefix + suffix + '.json';
}
function doRadio(view, id) {
showAllLayers();
if (id === 'showPkt') {
showPacketLayer();
} else if (id === 'showOpt') {
showOpticalLayer();
}
// ==============================
// Key Callbacks
function getUpdatedNetworkData(view) {
nextTopo();
getNetworkData(view);
}
function toggleBg() {
var vis = bgImg.style('visibility');
bgImg.style('visibility', (vis === 'hidden') ? 'visible' : 'hidden');
}
function toggleLayout(view) {
}
function cycleLabels(view) {
}
function togglePorts(view) {
}
function unpin(view) {
}
// ==============================
// Radio Button Callbacks
function showAllLayers() {
// network.node.classed('inactive', false);
// network.link.classed('inactive', false);
// d3.selectAll('svg .port').classed('inactive', false);
// d3.selectAll('svg .portText').classed('inactive', false);
alert('show all layers');
// TODO ...
console.log('showAllLayers()');
}
function showPacketLayer() {
alert('show packet layer');
showAllLayers();
// TODO ...
console.log('showPacketLayer()');
}
function showOpticalLayer() {
alert('show optical layer');
showAllLayers();
// TODO ...
console.log('showOpticalLayer()');
}
// ==============================
// Private functions
// set the size of the given element to that of the view
function setSize(el, view) {
el.attr({
width: view.width(),
height: view.height()
});
}
function getNetworkData(view) {
var url = getTopoUrl();
// TODO ...
}
// ==============================
// View life-cycle callbacks
......@@ -132,8 +203,9 @@
// NOTE: view.$div is a D3 selection of the view's div
svg = view.$div.append('svg');
setSize(view);
svg.append('g')
setSize(svg, view);
topoG = svg.append('g')
.attr('transform', config.force.translate());
// load the background image
......@@ -151,13 +223,15 @@
function load(view, ctx) {
view.setRadio(btnSet, doRadio);
view.setRadio(btnSet);
view.setKeys(keyDispatch);
getNetworkData(view);
}
function resize(view, ctx) {
setSize(view);
setSize(view, bgImg);
setSize(svg, view);
setSize(bgImg, view);
}
......