Skip to content

Commit

Permalink
Consistent parameters formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo authored and sethfowler committed Apr 10, 2017
1 parent d12766e commit 99335a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ automatically configured with l2 and l3 rules for routing traffic to all hosts
],
"hosts": {
"h1": {
"cmd": "python echo_server.py %port%",
"cmd": "python echo_server.py $port",
"startup_sleep": 0.2,
"wait": false
},
"h2": {
"cmd": "python echo_client.py h1 %port% %echo_msg%",
"cmd": "python echo_client.py h1 $port $echo_msg",
"wait": true
}
},
Expand Down Expand Up @@ -231,9 +231,9 @@ with the following options:
- `latency` - the latency between this host and the switch. This can either be a number (interpreted as seconds) or a string with time units (e.g. `50ms` or `1s`). This overrides the latency set in the `links` object.
The command is formatted by replacing the hostnames (e.g. `h1`) with the
corresponding IP address, and the parameters (surrounded by '%', e.g.
`%port%`) with their corresponding values. The parameters should be defined in
the multiswitch target in the manifest. For example, have a look at the
corresponding IP address. The parameters specified in the target will be
available to the command as environment variables (i.e. `$` followed by the
variable name). For an example, have a look at the
[manifest](examples/multiswitch.p4app/p4app.json) for the multiswitch example
app.
Expand Down
3 changes: 2 additions & 1 deletion docker/scripts/mininet/multi_switch_mininet.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def main():

def formatParams(s):
for param in params:
s = s.replace('{'+param+'}', str(params[param]))
s = s.replace('$'+param, str(params[param]))
s = s.replace('${'+param+'}', str(params[param]))
return s

AppTopo = apptopo.AppTopo
Expand Down
2 changes: 1 addition & 1 deletion examples/multi_iface.p4app/p4app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"targets": {
"multiswitch": {
"auto-control-plane": true,
"links": [["h1", "s1"], ["h2", "s2"], ["h3", "s1"], ["h3", "s2", "{mylatency}ms"]],
"links": [["h1", "s1"], ["h2", "s2"], ["h3", "s1"], ["h3", "s2", "${mylatency}ms"]],
"hosts": {
"h1": {
"cmd": "python echo_server.py $port",
Expand Down

0 comments on commit 99335a3

Please sign in to comment.