Skip to content

Commit eb85437

Browse files
authored
Small fixes: memory tests, alternate binaries, ... (#76)
- Required apps to be installed in $GOPATH/bin - Changed memory tests to require 2000MB, not 2048MB - Updated READMEs, removed images for new install process - Updated default app server destinations from @perrig - Handled more bwtest errors - Moved all bwest graph points to use test start, not end - Fixed camerapp storage issue moving fetch to `webapp/data/images` - Allows continuous SCMP echo console feedback during continuous test - Prevents camerapp and sensorapp from using continuous switch - Memory tests now show size of memory during failure - SCION run test now ignores default sciond socket on localhost topology - Adds localhost test script to launch local scionlab apps servers
1 parent f53c92e commit eb85437

File tree

15 files changed

+227
-256
lines changed

15 files changed

+227
-256
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ More information on [SCION](https://www.scion-architecture.net/), and [tutorials
88

99
To build:
1010
1. run once the provided script `deps.sh` to set up the dependencies
11-
2. run `make` to build all projects
11+
2. run `make install` to build all projects and install into `$GOPATH/bin`
1212

1313

1414
## bat

webapp/README.md

Lines changed: 27 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,42 @@
1-
SCIONLab Go Static Tester
1+
Webapp AS Visualization
22
=========================
33

4-
## Webapp Setup
5-
6-
Webapp is a Go application that will serve up a static web portal to make it easy to
7-
experiment with SCIONLab test apps on a virtual machine.
8-
9-
To install the SCIONLab `webapp`:
10-
11-
```shell
12-
go get github.com/netsec-ethz/scion-apps/webapp
13-
```
14-
15-
### Local Infrastructure
4+
More installation and usage information is available on the [SCION Tutorials web page for webapp](https://netsec-ethz.github.io/scion-tutorials/as_visualization/webapp/).
165

17-
To run the Go Web UI at default localhost 127.0.0.1:8000 run:
6+
## Webapp Setup
7+
Webapp is a Go application that will serve up a static web portal to make it easy to visualize and experiment with SCIONLab test apps on a virtual machine.
188

9+
### Install
1910
```shell
20-
webapp
11+
mkdir ~/go/src/github.com/netsec-ethz
12+
cd ~/go/src/github.com/netsec-ethz
13+
git clone https://github.com/netsec-ethz/scion-apps.git
2114
```
2215

23-
### SCIONLab Virtual Machine
24-
25-
Using vagrant, make sure to edit your `vagrantfile` to provision the additional port
26-
for the Go web server by adding this line for port 8080 (for example, just choose any forwarding
27-
port not already in use by vagrant):
28-
29-
```
30-
config.vm.network "forwarded_port", guest: 8080, host: 8080, protocol: "tcp"
31-
```
32-
33-
To run the Go Web UI at a specific address (-a) and port (-p) like 0.0.0.0:8080 for a SCIONLabVM use:
34-
16+
### Build
17+
Install all [SCIONLab apps](https://github.com/netsec-ethz/scion-apps) and dependancies, including `webapp`:
3518
```shell
36-
webapp -a 0.0.0.0 -p 8080 -r .
19+
cd scion-apps
20+
./deps.sh
21+
make install
3722
```
3823

39-
Now, open a web browser at http://127.0.0.1:8080, to begin.
24+
### Run
25+
!!! warning
26+
If the old [scion-viz](https://github.com/netsec-ethz/scion-viz) web server is running on your SCIONLab VM, port 8000 may still be in use. To remedy this, before `vagrant up`, make sure to edit your `vagrantfile` to provision an alternate port for the `webapp` web server. Add this line for a different port, say 8080 (for example, just choose any forwarding port not already in use by vagrant, and use that port everywhere below):
4027

41-
## Development
28+
```
29+
config.vm.network "forwarded_port", guest: 8080, host: 8080, protocol: "tcp"
30+
```
4231

43-
For developing the web server go code, since it is annoying to make several changes,
44-
only to have to start and stop the web server each time, a watcher library
45-
like `go-watcher` is recommended.
46-
47-
```shell
48-
go get github.com/canthefason/go-watcher
49-
go install github.com/canthefason/go-watcher/cmd/watcher
50-
```
51-
52-
After installation you can `cd` to the `webapp.go` directory and webapp will be rebuilt
53-
and rerun every time you save your source file changes, with or without command arguments.
54-
55-
```shell
56-
cd ~/go/src/github.com/netsec-ethz/scion-apps/webapp
57-
watcher -a 0.0.0.0 -p 8080 -r ..
58-
```
59-
or
32+
To run the Go Web UI at a specific address (-a) and port (-p) like 0.0.0.0:8000 for a SCIONLab VM use:
6033
```shell
61-
cd ~/go/src/github.com/netsec-ethz/scion-apps/webapp
62-
watcher
34+
cd webapp
35+
webapp -a 0.0.0.0 -p 8000
6336
```
37+
Now, open a web browser at [http://127.0.0.1:8000](http://127.0.0.1:8000), to begin.
6438

65-
## Webapp Features
66-
67-
This Go web server wraps several SCION test client apps and provides an interface
68-
for any text and/or image output received.
69-
[SCIONLab Apps](http://github.com/netsec-ethz/scion-apps) are on Github.
70-
71-
Two functional server tests are included to test the networks without needing
72-
specific sensor or camera hardware, `imagetest` and `statstest`.
73-
74-
Supported client applications include `camerapp`, `sensorapp`, and `bwtester`.
75-
For best results, ensure the desired server-side apps are running and connected to
76-
the SCION network first. Instructions to setup the servers are
77-
[here](https://github.com/netsec-ethz/scion-apps/blob/master/README.md).
78-
The web interface launched above can be used to run the client-side apps.
79-
80-
### File System Browser
81-
82-
The File System Browser button on the front page will allow you to navigate and serve any
83-
files on the SCIONLab node from the root (-r) directory you specified (if any) when
84-
starting webapp.go.
85-
86-
### bwtester client
87-
88-
Simply adjust the dials to the desired level, while the icon lock will allow you
89-
to keep one value constant.
90-
91-
![Webapp Bandwidth Test](static/img/bwtest.png?raw=true "Webapp Bandwidth Test")
92-
93-
94-
### camerapp client
95-
96-
The retrieved image will appear scaled down and can be clicked on to open a larger size.
97-
98-
![Webapp Image Test](static/img/imagetest.png?raw=true "Webapp Image Test")
99-
100-
101-
### sensorapp client
102-
103-
![Webapp Stats Test](static/img/statstest.png?raw=true "Webapp Stats Test")
104-
105-
106-
### statstest server
107-
108-
This hardware-independent test will echo some remote machine stats from the Python script
109-
`local-stats.py`, which is piped to the server for transmission to clients.
110-
On your remote SCION server node run (substituting your own address parameters):
111-
112-
```shell
113-
cd $GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/tests/statstest/statsserver
114-
python3 local-stats.py | sensorserver -s 1-15,[127.0.0.5]:35555
115-
```
116-
117-
Now, from your webapp browser interface running on your virtual client SCION node,
118-
you can enter both client and server addresses and ask the client for remote stats
119-
by clicking on the `sensorapp` tab.
120-
121-
### imagetest server
122-
123-
This hardware-independent test will generate an image with some remote machine stats from
124-
the Go app `local-image.go`, which will be saved locally for transmission to clients.
125-
126-
You may need golang.org's image package first:
127-
128-
```shell
129-
go get golang.org/x/image
130-
```
131-
132-
On your remote SCION server node run (substituting your own address parameters):
133-
134-
```shell
135-
cd $GOPATH/src/github.com/netsec-ethz/scion-apps/webapp/tests/imgtest/imgserver
136-
go build
137-
./imgserver | imageserver -s 1-18,[127.0.0.8]:38887
138-
```
139-
140-
Now, from your webapp browser interface running on your virtual client SCION node,
141-
you can enter both client and server addresses and ask the client for the most
142-
recently generated remote image by clicking on the `camerapp` tab.
143-
39+
## Related Links
40+
* [Webapp SCIONLab AS Visualization Tutorials](https://netsec-ethz.github.io/scion-tutorials/as_visualization/webapp/)
41+
* [Webapp SCIONLab Apps Visualization](https://netsec-ethz.github.io/scion-tutorials/as_visualization/webapp_apps/)
42+
* [Webapp Development Tips](https://netsec-ethz.github.io/scion-tutorials/as_visualization/webapp_development/)

webapp/config/servers_default.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{
1616
"name": "17-ffaa:1:13",
1717
"isdas": "17-ffaa:1:13",
18-
"addr": "192.168.1.111",
18+
"addr": "192.168.1.79",
1919
"port": 30100
2020
},
2121
{
@@ -67,34 +67,34 @@
6767
{
6868
"name": "17-ffaa:1:13",
6969
"isdas": "17-ffaa:1:13",
70-
"addr": "192.168.1.111",
70+
"addr": "192.168.1.79",
7171
"port": 42003
7272
}
7373
],
7474
"echo": [
7575
{
7676
"name": "17-ffaa:0:1107 Attachment Point",
7777
"isdas": "17-ffaa:0:1107",
78-
"addr": "10.0.8.1",
79-
"port": 30100
78+
"addr": "192.33.93.195",
79+
"port": 40002
8080
},
8181
{
8282
"name": "18-ffaa:0:1202 Attachment Point",
8383
"isdas": "18-ffaa:0:1202",
84-
"addr": "10.0.8.1",
85-
"port": 30100
84+
"addr": "128.105.21.208",
85+
"port": 40002
8686
},
8787
{
8888
"name": "19-ffaa:0:1303 Attachment Point",
8989
"isdas": "19-ffaa:0:1303",
90-
"addr": "10.0.8.1",
91-
"port": 30100
90+
"addr": "141.44.25.144",
91+
"port": 40002
9292
},
9393
{
9494
"name": "20-ffaa:0:1404 Attachment Point",
9595
"isdas": "20-ffaa:0:1404",
96-
"addr": "10.0.8.1",
97-
"port": 30100
96+
"addr": "203.230.60.98",
97+
"port": 40002
9898
}
9999
]
100100
}

webapp/lib/bwcont.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ var reItMax = `(?i:interarrival time max:\s*)([0-9.-]*)(?:\s*ms)`
3131
var reErr1 = `(?i:err=*)"(.*?)"`
3232
var reErr2 = `(?i:crit msg=*)"(.*?)"`
3333
var reErr3 = `(?i:error:\s*)([\s\S]*)`
34+
var reErr4 = `(?i:eror:\s*)([\s\S]*)`
35+
var reErr5 = `(?i:crit:\s*)([\s\S]*)`
3436
var reUPath = `(?i:using path:)`
3537

3638
// ExtractBwtestRespData will parse cmd line output from bwtester for adding BwTestItem fields.
@@ -98,6 +100,8 @@ func ExtractBwtestRespData(resp string, d *model.BwTestItem, start time.Time) {
98100
match1, _ := regexp.MatchString(reErr1, r[i])
99101
match2, _ := regexp.MatchString(reErr2, r[i])
100102
match3, _ := regexp.MatchString(reErr3, r[i])
103+
match4, _ := regexp.MatchString(reErr4, r[i])
104+
match5, _ := regexp.MatchString(reErr5, r[i])
101105

102106
if match1 {
103107
re := regexp.MustCompile(reErr1)
@@ -108,6 +112,12 @@ func ExtractBwtestRespData(resp string, d *model.BwTestItem, start time.Time) {
108112
} else if match3 {
109113
re := regexp.MustCompile(reErr3)
110114
err = re.FindStringSubmatch(r[i])[1]
115+
} else if match4 {
116+
re := regexp.MustCompile(reErr4)
117+
err = re.FindStringSubmatch(r[i])[1]
118+
} else if match5 {
119+
re := regexp.MustCompile(reErr5)
120+
err = re.FindStringSubmatch(r[i])[1]
111121
} else if err == "" && r[i] != "" {
112122
// fallback to first line if err msg needed
113123
err = r[i]

webapp/lib/image.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func findNewestFileExt(dir, extRegEx string) (imgFilename string, imgTimestamp i
7373

7474
// FindImageInfoHandler locating most recent image and writing text info data about it.
7575
func FindImageInfoHandler(w http.ResponseWriter, r *http.Request) {
76-
filesDir := "."
76+
filesDir := path.Join(GOPATH, LABROOT, "webapp/data/images")
7777
imgFilename, _ := findNewestFileExt(filesDir, regexImageFiles)
7878
if imgFilename == "" {
7979
return
@@ -84,7 +84,7 @@ func FindImageInfoHandler(w http.ResponseWriter, r *http.Request) {
8484

8585
// FindImageHandler locating most recent image formatting it for graphic display in response.
8686
func FindImageHandler(w http.ResponseWriter, r *http.Request, browserAddr string, port int) {
87-
filesDir := "."
87+
filesDir := path.Join(GOPATH, LABROOT, "webapp/data/images")
8888
imgFilename, _ := findNewestFileExt(filesDir, regexImageFiles)
8989
if imgFilename == "" {
9090
fmt.Fprint(w, "Error: Unable to find image file locally.")
@@ -111,6 +111,6 @@ func FindImageHandler(w http.ResponseWriter, r *http.Request, browserAddr string
111111
panic("Unhandled image type!")
112112
}
113113
CheckError(err)
114-
url := fmt.Sprintf("http://%s:%d/%s/%s", browserAddr, port, "images", imgFilename)
114+
url := fmt.Sprintf("http://%s:%d/%s/%s", browserAddr, port, "data/images", imgFilename)
115115
writeJpegTemplate(w, &rawImage, url)
116116
}

webapp/static/img/bwtest.png

-116 KB
Binary file not shown.

webapp/static/img/imagetest.png

-254 KB
Binary file not shown.

webapp/static/img/statstest.png

-103 KB
Binary file not shown.

0 commit comments

Comments
 (0)