Skip to content

Commit

Permalink
Merge pull request #386 from eugeneia/master-fixes
Browse files Browse the repository at this point in the history
Master fixes after program branch merge
  • Loading branch information
eugeneia committed Mar 3, 2015
2 parents 7ae8008 + 57f930f commit b7cb089
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,5 @@ mrproper: clean
$(E) "RM $(RMOBJS)"
$(Q)-rm -rf $(RMOBJS)

.PHONY: clean $(TESTMODS)
.PHONY: clean $(TESTMODS) $(TESTSCRIPTS)

4 changes: 2 additions & 2 deletions src/doc/genbook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ $(cat ../lib/hardware/README.md)
$(cat ../lib/protocol/README.md)
## NFV Config (lib.nfv.config)
## Snabb NFV
$(cat ../lib/nfv/README.md)
$(cat ../program/snabbnfv/README.md)
## Watchdog (lib.watchdog.watchdog)
Expand Down
Binary file added src/program/snabbnfv/.images/NFV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 26 additions & 23 deletions src/lib/nfv/README.md → src/program/snabbnfv/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
The `lib.nfv.config` module implements a
[Network Functions Virtualization](https://en.wikipedia.org/wiki/Network_Functions_Virtualization)
component based on Snabb Switch. It introduces a simple configuration file
format to describe NFV configurations which it then compiles to app
networks. This NFV component is compatible with
[OpenStack Neutron](https://wiki.openstack.org/wiki/Neutron).
### NFV config (program.snabbnfv.nfvconfig)

The `program.snabbnfv.nfvconfig` module implements a [Network Functions
Virtualization](https://en.wikipedia.org/wiki/Network_Functions_Virtualization)
component based on Snabb Switch. It introduces a simple configuration
file format to describe NFV configurations which it then compiles to app
networks. This NFV component is compatible with [OpenStack
Neutron](https://wiki.openstack.org/wiki/Neutron).

![NFV](.images/NFV.png)

Expand All @@ -19,10 +21,11 @@ Loads the NFV configuration from *file* and compiles an app network using
Configures the engine to use *config* and assign *zerocopy* pairs. Uses
`engine.configure()` internally.

### NFV Configuration Format
#### NFV Configuration Format

The configuration file format understood by `lib.nfv.config` is based on
*Lua expressions*. Initially, it contains a list of NFV *ports*:
The configuration file format understood by `program.snabbnfv.nfvconfig`
is based on *Lua expressions*. Initially, it contains a list of NFV
*ports*:

```
return { <port-1>, ..., <port-n> }
Expand Down Expand Up @@ -56,31 +59,31 @@ tunnel := { type = "L2TPv3", -- The only type (for now)
session = <32bit-int> -- ~ `session_id' }
```

### snabbnfv-traffic
### snabbnfv traffic

The `snabbnfv-traffic` design (in `designs/neutron`) loads and runs a
NFV configuration using `lib.nfv.config`. It can be invoked like so:
The `snabbnfv traffic` program loads and runs a NFV configuration using
`program.snabbnfv.nfvconfig`. It can be invoked like so:

```
snabbnfv-traffic <file> <pci-address> <socket-path>
./snabb snabbnfv traffic <file> <pci-address> <socket-path>
```

`snabbnfv-traffic` runs the loaded configuration indefinitely and
`snabbnfv traffic` runs the loaded configuration indefinitely and
automatically reloads the configuration file if it changes (at most once
every second).

### neutron2snabb
### snabbnfv neutron2snabb

The `neutron2snabb` design (in `designs/neutron`) converts Neutron
database CSV dumps to the format used by `lib.nfv.config`. For more info
see [Snabb NFV Architecture](https://github.com/SnabbCo/snabb-nfv/wiki/Architecture).
The `snabbnfv neutron2snabb` program converts Neutron database CSV dumps
to the format used by `program.snabbnfv.nfvconfig`. For more info see
[Snabb NFV Architecture](https://github.com/SnabbCo/snabb-nfv/wiki/Architecture).
It can be invoked like so:

```
neutron2snabb <csv-directory> <output-directory> [<hostname>]
./snabb snabbnfv neutron2snabb <csv-directory> <output-directory> [<hostname>]
```

`neutron2snabb` reads the Neutron configuration *csv-directory* and
translates them to one `lib.nfv.conig` configuration file per physical
network. If *hostname* is given, it overrides the hostname provided by
`hostname.1`.
`snabbnfv neutron2snabb` reads the Neutron configuration *csv-directory*
and translates them to one `lib.nfv.conig` configuration file per
physical network. If *hostname* is given, it overrides the hostname
provided by `hostname.1`.
58 changes: 31 additions & 27 deletions src/lib/nfv/README.md.src → src/program/snabbnfv/README.md.src
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
The `lib.nfv.config` module implements a
[Network Functions Virtualization](https://en.wikipedia.org/wiki/Network_Functions_Virtualization)
component based on Snabb Switch. It introduces a simple configuration file
format to describe NFV configurations which it then compiles to app
networks. This NFV component is compatible with
[OpenStack Neutron](https://wiki.openstack.org/wiki/Neutron).
### NFV config (program.snabbnfv.nfvconfig)

The `program.snabbnfv.nfvconfig` module implements a [Network Functions
Virtualization](https://en.wikipedia.org/wiki/Network_Functions_Virtualization)
component based on Snabb Switch. It introduces a simple configuration
file format to describe NFV configurations which it then compiles to app
networks. This NFV component is compatible with [OpenStack
Neutron](https://wiki.openstack.org/wiki/Neutron).

DIAGRAM: NFV
+------+
Expand All @@ -14,10 +16,11 @@ networks. This NFV component is compatible with
| | \-=-------/
: :
v |
+----------------+
|{io} |
| lib.nfv.config |
+----------------+
+----------+-+
|{io} |
| nfvconfig |
| |
+------------+

— Function **nfvconfig.load** *file*, *pci_address*, *socket_path*

Expand All @@ -31,10 +34,11 @@ Loads the NFV configuration from *file* and compiles an app network using
Configures the engine to use *config* and assign *zerocopy* pairs. Uses
`engine.configure()` internally.

### NFV Configuration Format
#### NFV Configuration Format

The configuration file format understood by `lib.nfv.config` is based on
*Lua expressions*. Initially, it contains a list of NFV *ports*:
The configuration file format understood by `program.snabbnfv.nfvconfig`
is based on *Lua expressions*. Initially, it contains a list of NFV
*ports*:

```
return { <port-1>, ..., <port-n> }
Expand Down Expand Up @@ -68,31 +72,31 @@ tunnel := { type = "L2TPv3", -- The only type (for now)
session = <32bit-int> -- ~ `session_id' }
```

### snabbnfv-traffic
### snabbnfv traffic

The `snabbnfv-traffic` design (in `designs/neutron`) loads and runs a
NFV configuration using `lib.nfv.config`. It can be invoked like so:
The `snabbnfv traffic` program loads and runs a NFV configuration using
`program.snabbnfv.nfvconfig`. It can be invoked like so:

```
snabbnfv-traffic <file> <pci-address> <socket-path>
./snabb snabbnfv traffic <file> <pci-address> <socket-path>
```

`snabbnfv-traffic` runs the loaded configuration indefinitely and
`snabbnfv traffic` runs the loaded configuration indefinitely and
automatically reloads the configuration file if it changes (at most once
every second).

### neutron2snabb
### snabbnfv neutron2snabb

The `neutron2snabb` design (in `designs/neutron`) converts Neutron
database CSV dumps to the format used by `lib.nfv.config`. For more info
see [Snabb NFV Architecture](https://github.com/SnabbCo/snabb-nfv/wiki/Architecture).
The `snabbnfv neutron2snabb` program converts Neutron database CSV dumps
to the format used by `program.snabbnfv.nfvconfig`. For more info see
[Snabb NFV Architecture](https://github.com/SnabbCo/snabb-nfv/wiki/Architecture).
It can be invoked like so:

```
neutron2snabb <csv-directory> <output-directory> [<hostname>]
./snabb snabbnfv neutron2snabb <csv-directory> <output-directory> [<hostname>]
```

`neutron2snabb` reads the Neutron configuration *csv-directory* and
translates them to one `lib.nfv.conig` configuration file per physical
network. If *hostname* is given, it overrides the hostname provided by
`hostname.1`.
`snabbnfv neutron2snabb` reads the Neutron configuration *csv-directory*
and translates them to one `lib.nfv.conig` configuration file per
physical network. If *hostname* is given, it overrides the hostname
provided by `hostname.1`.
16 changes: 8 additions & 8 deletions src/program/snabbnfv/nfvconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ function selftest ()
os.exit(engine.test_skipped_code)
end
engine.log = true
for i, confpath in ipairs({"test_fixtures/nfvconfig/switch_nic/x",
"test_fixtures/nfvconfig/switch_filter/x",
"test_fixtures/nfvconfig/switch_qos/x",
"test_fixtures/nfvconfig/switch_tunnel/x",
"test_fixtures/nfvconfig/scale_up/y",
"test_fixtures/nfvconfig/scale_up/x",
"test_fixtures/nfvconfig/scale_change/x",
"test_fixtures/nfvconfig/scale_change/y"})
for i, confpath in ipairs({"program/snabbnfv/test_fixtures/nfvconfig/switch_nic/x",
"program/snabbnfv/test_fixtures/nfvconfig/switch_filter/x",
"program/snabbnfv/test_fixtures/nfvconfig/switch_qos/x",
"program/snabbnfv/test_fixtures/nfvconfig/switch_tunnel/x",
"program/snabbnfv/test_fixtures/nfvconfig/scale_up/y",
"program/snabbnfv/test_fixtures/nfvconfig/scale_up/x",
"program/snabbnfv/test_fixtures/nfvconfig/scale_change/x",
"program/snabbnfv/test_fixtures/nfvconfig/scale_change/y"})
do
print("testing:", confpath)
apply(load(confpath, pcideva, "/dev/null"))
Expand Down
6 changes: 4 additions & 2 deletions src/program/snabbnfv/selftest.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function stop_bench_env {

# Clean up temporary config location.
rm -f "$TESTCONFPATH"

exit
}

# Set up graceful `exit'.
Expand Down Expand Up @@ -198,7 +200,7 @@ function same_vlan_tests {
}

function rate_limited_tests {
load_config program/snabbnfv/test_fixtures/nfvconfig/test_functions/rate_limit.ports
load_config program/snabbnfv/test_fixtures/nfvconfig/test_functions/tx_rate_limit.ports

test_ping $TELNET_PORT0 "$GUEST_IP1%eth0"
test_rate_limited $TELNET_PORT0 $TELNET_PORT1 "$GUEST_IP1%eth0" 900 1000
Expand All @@ -208,7 +210,7 @@ function rate_limited_tests {
# test_checksum $TELNET_PORT0
# test_checksum $TELNET_PORT1

load_config test_fixtures/nfvconfig/test_functions/rx_rate_limit.ports
load_config program/snabbnfv/test_fixtures/nfvconfig/test_functions/rx_rate_limit.ports

test_ping $TELNET_PORT0 "$GUEST_IP1%eth0"
test_rate_limited $TELNET_PORT0 $TELNET_PORT1 "$GUEST_IP1%eth0" 1200 1000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
return {
{ vlan = 43,
mac_address = "52:54:00:00:00:00",
port_id = "A",
ingress_filter = nil,
rx_police_gbps = 1,
tunnel = nil
},
{ vlan = 43,
mac_address = "52:54:00:00:00:01",
port_id = "B",
ingress_filter = nil,
rx_police_gbps = 1,
tunnel = nil
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
return {
{ vlan = 43,
mac_address = "52:54:00:00:00:00",
port_id = "A",
ingress_filter = nil,
tx_police_gbps = 0.5,
tunnel = nil
},
{ vlan = 43,
mac_address = "52:54:00:00:00:01",
port_id = "B",
ingress_filter = nil,
tx_police_gbps = 0.5,
tunnel = nil
},
}
2 changes: 1 addition & 1 deletion src/program/snabbnfv/traffic/README
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PacketFilter, RateLimiter, nd_light and SimpleKeyedTunnel):
rx_police_gbps = <n>, -- Allowed input rate in Gbps
tx_police_gbps = <n> } -- Allowed output rate in Gbps

The `tunnel` section deviates a little from `SimpleKeyedTunnel`'s
The tunnel section deviates a little from SimpleKeyedTunnel's
terminology:

tunnel := { type = "L2TPv3", -- The only type (for now)
Expand Down
8 changes: 4 additions & 4 deletions src/scripts/bench_env/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ run_nfv () {
fi

numactl $NUMA \
$SNABB ${NFV?} $NFV_PCI ${CONFIG?} $NFV_SOCKET ${NFV_PACKETS?} \
$SNABB ${NFV?} ${NFV_PACKETS?} $NFV_PCI ${CONFIG?} $NFV_SOCKET \
> $LOG 2>&1 &

SNABBPIDS="$SNABBPIDS $!"
Expand Down Expand Up @@ -197,15 +197,15 @@ fi
# detect designs
printf "SNABB=$SNABB\n"
SNABB_PATH=$(dirname $SNABB)
if [ -f $SNABB_PATH/designs/neutron/snabbnfv-bench ]; then
export NFV=$SNABB_PATH/designs/neutron/snabbnfv-bench
if [ -f $SNABB_PATH/snabb ]; then
export NFV="snabbnfv traffic -B"
else
printf "NFV design not found\n"
exit 1
fi

if [ -f $SNABB_PATH/snabb ]; then
export LOADGEN="$SNABB_PATH/snabb packetblaster replay"
export LOADGEN="packetblaster replay"
else
printf "LOADGEN design not found\n"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/bench_env/host-nic-snabbnfv-guests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GUESTS="2"
# Execute snabbswitch and pin it to the proper node (CPU and memory)
export NFV_PCI=${NFV_PCI0?}
numactl --cpunodebind=${NODE_BIND0?} --membind=${NODE_BIND0?} \
$SNABB designs/neutron/snabbnfv-traffic ${NFV_PCI0?} ${1?} vhost_%s.sock \
$SNABB snabbnfv traffic ${NFV_PCI0?} ${1?} vhost_%s.sock \
> ${SNABB_LOG0?} 2>&1 &
SNABB_PID0=$!

Expand Down

0 comments on commit b7cb089

Please sign in to comment.