Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dpino committed Dec 5, 2016
1 parent 6797e8c commit 119cdd4
Showing 1 changed file with 88 additions and 102 deletions.
190 changes: 88 additions & 102 deletions src/program/snabbvmx/doc/README.troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,33 +407,27 @@ Parameters:
- **V6-OUT.PCAP** : Outgoing IPv6 packets (to b4, encapsulated)
- **[COUNTERS.LUA]** : Lua file with counter values. Will be regenerated via [-r] param


## How to run SnabbVMX interactive end-to-end test

If you detected an error in the lwAFTR, the first step is to obtain the
configuration file that SnabbVMX was using, as well as a copy of lwAFTR's
configuration and binding table. With that information and knowing the error
report (ping to lwAFTR but it doesn't reply, valid softwire packet doesn't get
decapsulated, etc), you craft a hand-made packet that meets the testing case.
If you detected an error in the lwAFTR, the first step is to obtain the configuration file that SnabbVMX was using, as well as a copy of lwAFTR's configuration and binding table. With that information and knowing the error report (ping to lwAFTR but it doesn't reply, valid softwire packet doesn't get decapsulated, etc), you craft a hand-made packet that meets the testing case.

**obtaining the config-files**
**Obtaining the config-files**

To run a test, the following config-files are required:

- the binding-table : binding_table.txt.s
- lwaftr conf : snabbvmx-lwaftr-xe[0-9].conf
- snabbvmx cfg : snabbvmx-lwaftr-xe[0-9].cfg
- binding-table: binding_table.txt.s.
- lwaftr conf: snabbvmx-lwaftr-xe[0-9].conf.
- snabbvmx cfg: snabbvmx-lwaftr-xe[0-9].cfg.

If you are running lwaftr check, then snabbvmx config-file (snabbvmx-lwaftr-xe[0-9].cfg) is not required
If you are running lwaftr check, then snabbvmx config-file (snabbvmx-lwaftr-xe[0-9].cfg) is not required.

It is fine to copy or manually craft the config-files.
A running snabbvmx can be used as well to copy the config-files from the running container
To gain the used config-files from the running container, either run the collect-support-infos.sh (https://github.com/mwiget/vmxlwaftr/blob/igalia/SUPPORT-INFO.md)
or execute a shell within the dockers container and copy configs and binding-table from the /tmp directory.

Note: the check application is just using a single interface. If the running container consists of two or more snabb-instances, then just take one of them for when running the check.
A running snabbvmx can be used as well to copy the config-files from the running container. To obtain the used config-files from the running container, either run the collect-support-infos.sh (https://github.com/mwiget/vmxlwaftr/blob/igalia/SUPPORT-INFO.md) or execute a shell within the dockers container and copy configs and binding-table from the /tmp directory.

Note: The `snabbvmx check` application is just using a single interface. If the running container consists of two or more snabb-instances, then just take one of them for when running the check.

**collect-support-infos.sh**
**Script collect-support-infos.sh**

```
lab@ubuntu1:~/vmxlwaftr/tests$ ./collect-support-infos.sh lwaftr3-16.2R3
Expand Down Expand Up @@ -474,28 +468,40 @@ lab@ubuntu1:~/vmxlwaftr/tests/t1$ tar -tvzf support-info-20161108-1335.tgz
-rwxr-xr-x root/root 2707019 2016-10-31 14:06 usr/local/bin/snabb
```

**config-files within /tmp inside docker container**
**Config-files within /tmp inside docker container**

The snabbvmx config-files can be derived from the container's shell as well directly within the /tmp directory
The snabbvmx config-files can be derived from the container's shell as well directly within the /tmp directory.

```
lab@ubuntu1:~/vmxlwaftr/tests/t1$ docker exec -ti lwaftr3-16.2R3 bash
pid 2654's current affinity mask: fffff
pid 2654's new affinity mask: ff3ff
root@8f5d057b8298:/# ls /tmp/
binding_table.txt config.new mac_xe0 snabb_xe0.log snabbvmx-lwaftr-xe1.cfg test-snabbvmx-lwaftr-xe0.cfg test_snabb_snabbvmx_xe0.sh vhost_features_xe1.socket
binding_table.txt.s config.new1 mac_xe1 snabb_xe1.log snabbvmx-lwaftr-xe1.conf test-snabbvmx-lwaftr-xe1.cfg test_snabb_snabbvmx_xe1.sh vmxhdd.img
binding_table.txt.s.new config.old pci_xe0 snabbvmx-lwaftr-xe0.cfg support-info.tgz test_snabb_lwaftr_xe0.sh vFPC-20160922.img xe0.socket
binding_table.txt.s.o junos-vmx-x86-64-16.1-20160926.0.qcow2 pci_xe1 snabbvmx-lwaftr-xe0.conf sysinfo.txt test_snabb_lwaftr_xe1.sh vhost_features_xe0.socket xe1.socket
```
Note: press ctrl p ctrl q to exit the containers shell


**some adoption of config-files is required**
binding_table.txt config.new
binding_table.txt.s config.new1
binding_table.txt.s.new config.old
binding_table.txt.s.o junos-vmx.qcow2
mac_xe snabb_xe0.log
mac_xe snabb_xe1.log
pci_xe snabbvmx-lwaftr-xe0.cfg
pci_xe snabbvmx-lwaftr-xe0.conf
snabbvmx-lwaftr-xe1.cfg test-snabbvmx-lwaftr-xe0.cfg
snabbvmx-lwaftr-xe1.conf test-snabbvmx-lwaftr-xe1.cfg
support-info.tgz test_snabb_lwaftr_xe0.sh
sysinfo.txt test_snabb_lwaftr_xe1.sh
test_snabb_snabbvmx_xe0.sh vhost_features_xe1.socket
test_snabb_snabbvmx_xe1.sh vmxhdd.img
vFPC-20160922.img xe0.socket
vhost_features_xe0.socket xe1.socket
```

Note: Press Ctrl-P + Ctrl-Q to exit the containers shell.

**Some adoption of config-files is required**

The advantage of snabbvmx is the dynamic next-hop resolution via Junos. When running the the lwaftr or snabbvmx app standalone, then the next-hop resolution via Junos is missing. The config-files are required to get modified for static next-hop configuration.

**config as derived from a running vmxlwaftr container**
**Config as derived from a running vmxlwaftr container**

```
lab@ubuntu1:~/vmxlwaftr/tests/t1$ cat snabbvmx-lwaftr-xe1.cfg
Expand All @@ -520,10 +526,9 @@ return {

To change configuration for static next-hop, below changes are required:


- cache_refresh_interval = 0 (turns off next-hop learning via Junos)
- mac_address (thats the own/self mac-address fo lwaftr)
- next_hop_mac (next-hop mac to send the packets to)
- cache_refresh_interval = 0 (turns off next-hop learning via Junos).
- mac_address (thats the own/self mac-address fo lwaftr).
- next_hop_mac (next-hop mac to send the packets to).

Note: The snabbvmx config icmp_snabbvmx-lwaftr-xe1.cfg references the snabb-configuration file icmp_snabbvmx-lwaftr-xe1.conf via the "lwaftr" directive. When running "snabbvmx check" then both the lwaftr and the snabbvmx config-files must be provided.

Expand All @@ -536,33 +541,30 @@ return {
},
ipv6_interface = {
ipv6_address = "",
cache_refresh_interval = 0, <<< set this to 0
cache_refresh_interval = 0, # Set this to 0
fragmentation = false,
mac_address = "02:cf:69:15:81:01", <<< the lwaftr's own mac address. input pcap match this mac
next_hop_mac = "90:e2:ba:94:2a:bc", <<< the next-hop mac to use for outgoing packets
mac_address = "02:cf:69:15:81:01", # lwaftr's own mac address. input pcap match this mac
next_hop_mac = "90:e2:ba:94:2a:bc", # the next-hop mac to use for outgoing packets
},
ipv4_interface = {
ipv4_address = "192.168.5.2",
cache_refresh_interval = 0, <<< set this to 0
fragmentation = false,
mac_address = "02:cf:69:15:81:01", <<< the lwaftr's own mac address. input pcap match this mac
next_hop_mac = "90:e2:ba:94:2a:bc", <<< the next-hop mac to use for outgoing packets
mac_address = "02:cf:69:15:81:01", # lwaftr's own mac address. input pcap match this mac
next_hop_mac = "90:e2:ba:94:2a:bc", # the next-hop mac to use for outgoing packets
},
}
```

**The input pcaps**

The snabb "check" app requires one or two input pcaps.
It is ok to:
The snabb "check" app requires one or two input pcaps. It is OK to:

- only feed V4-IN.PCAP
- only feed the V6-IN.PCAP
- or feed both V4-IN.PCAP and V6-IN.PCAP
- Only feed V4-IN.PCAP.
- Only feed the V6-IN.PCAP.
- Feed both V4-IN.PCAP and V6-IN.PCAP.

Note for interactive tests:<br>
When only feeding one pcap as input, then the other empty pcap must be the "empty.pcap" in
"src/program/snabbvmx/tests/end-to-end/data/empty.pcap" and not an empty string like ""
Note for interactive tests: When only feeding one pcap as input, then the other empty pcap must be the "empty.pcap" (src/program/snabbvmx/tests/end-to-end/data/empty.pcap`) and not an empty string like "".

```
cd snabb/src/program/snabbvmx/tests/end-to-end/data$
Expand All @@ -572,10 +574,9 @@ $ tcpdump -r empty.pcap
reading from file empty.pcap, link-type EN10MB (Ethernet)
```

**sample icmp-ipv4-in.pcap**
**Sample icmp-ipv4-in.pcap**

For any input pcap it makes sense to keep it short - ideally a single packet to check correctness of the lwaftr.
The input packet "11:26:07.168372 IP 10.0.1.100.53 > 10.10.0.0.1024: [|domain]" is matching the binding-table for PSID=1.
For any input pcap it makes sense to keep it short - ideally a single packet to check correctness of the lwaftr. The input packet "11:26:07.168372 IP 10.0.1.100.53 > 10.10.0.0.1024: [|domain]" is matching the binding-table for PSID=1.

```
cd snabb/src/program/snabbvmx/tests/end-to-end/data$
Expand All @@ -600,13 +601,14 @@ reading from file ipv4-in.pcap, link-type EN10MB (Ethernet)
11:26:07.168372 IP 10.0.1.100.53 > 10.10.0.0.1024: [|domain]
```

**running the interactive check**
**Running the interactive check**

The interactive check is performed via `snabb snabbvmx check -r`. Using the "-r" param instructs the check to generate the counters and out.pcap files.
As there is no IPv6 input, the "empty.pcap" is configured.
The interactive check is performed via `snabb snabbvmx check -r`. Using the "-r" param instructs the check to generate the counters and out.pcap files. As there is no IPv6 input, the "empty.pcap" is configured.

```
sudo ~/vmx-docker-lwaftr/snabb/src/snabb snabbvmx check -r ./snabbvmx-lwaftr-xe1.cfg "./ipv4-in.pcap" "./empty.pcap" "./outv4.pcap" "./outv6.pcap" test.lua
sudo ~/vmx-docker-lwaftr/snabb/src/snabb snabbvmx check -r \
./snabbvmx-lwaftr-xe1.cfg "./ipv4-in.pcap" "./empty.pcap" \
"./outv4.pcap" "./outv6.pcap" test.lua
loading compiled binding table from ./binding_table.txt.s.o
compiled binding table ./binding_table.txt.s.o is up to date.
nh_fwd4: cache_refresh_interval set to 0 seconds
Expand All @@ -616,15 +618,14 @@ nh_fwd6: static next_hop_mac 90:e2:ba:94:2a:bc
done
```

**results**
**Results**

The -r flag is set, as such the resulting counters file test.lua and the out.pcap files are generated freshly.
The results below show a correct processing of the lwatr:
The -r flag is set, as such the resulting counters file test.lua and the out.pcap files are generated freshly. The results below show a correct processing of the lwatr:

- the counters-file lists one IPv4 packet as input
- as the input-packet matches the binding-table, one IPv6 packet output
- outv4.pcap is empty
- outv6.pcap shows the resulting encapsulated lw4o6 packet
- The counters-file lists one IPv4 packet as input as the input-packet matches the binding-table.
- One IPv6 packet output.
- Outv4.pcap is empty.
- Outv6.pcap shows the resulting encapsulated lw4o6 packet.

```
$ cd snabb/src/program/snabbvmx/tests/end-to-end/data
Expand All @@ -640,46 +641,42 @@ reading from file outv4.pcap, link-type EN10MB (Ethernet)
$ tcpdump -n -r outv6.pcap
reading from file outv6.pcap, link-type EN10MB (Ethernet)
01:00:00.000000 IP6 2a02:587:f700::100 > 2a02:587:f710::400: IP 10.0.1.100.53 > 10.10.0.0.1024: [|domain]
01:00:00.000000 IP6 2a02:587:f700::100 > 2a02:587:f710::400:
IP 10.0.1.100.53 > 10.10.0.0.1024: [|domain]
```

**summary interactive check**
**Summary of interactive check**

At this stage the interactive test is finished.
The following is defined:
At this stage the interactive test is finished. The following is defined:

- lwaftr and snabbvmx configs
- binding-table
- input pcaps
- expected resulting counters and out.pcap
- lwaftr and snabbvmx configs.
- Binding-table.
- Input pcaps.
- Expected resulting counters and out.pcap.

With known input and results, the test can now be added to the scripted end-to-end.sh - to be executed with all other tests to ensure snabbvmx behaves as it should.

Further more, this end-to-end procedure can be ideally used to report issues!

Tip: packets always arrive only in one interface, but the output might be
empty or non-empty for both IPv4 and IPv6.
With known input and results, the test can now be added to the scripted end-to-end.sh to be executed with all other tests to ensure snabbvmx behaves as it should. Furthermore, this end-to-end procedure can be ideally used to report issues!

Tip: packets always arrive only in one interface, but the output might be empty or non-empty for both IPv4 and IPv6.

## Adding the sample-test towards the scripted end-to-end tests

### In short

- place counter file and out.pcaps into correct directory
- edit "test_env.sh" and add the test
- run the test
- Place counter file and out.pcaps into correct directory.
- Edit "test_env.sh" and add the test.
- Run the test.

### Detailed steps

**directory-structure**
place out.pcap into the data-drectory
Step 1. Directory structure:

Place out.pcap into the data-drectory

```
snabb/src/program/snabbvmx/tests/end-to-end/data
```

place counter-file into counters-drectory
Place counter-file into counters-drectory

```
snabb/src/program/snabbvmx/tests/end-to-end/data/counters
Expand All @@ -695,17 +692,14 @@ configuration files and binding tables.
* **end-to-end-vlan.sh**: Runs **core-end-to-end.sh** on VLAN packets.
* **selftest.sh**: Runs both **end-to-end.sh** and **end-to-end-vlan.sh**

Step 2. Adding the sample test:

**adding the sample test**:

All tests are defined in the "test_env.sh" file.
This "test_env.sh" file has to be edited to include the sample test.
The check app always checks the provided data to decide if the test is successful or not: <br>
All tests are defined in the "test_env.sh" file. This "test_env.sh" file has to be edited to include the sample test. The check app always checks the provided data to decide if the test is successful or not:

- if the optional counters-file is provided, then it must match
- the resulting out.pcap files must always match

**pass-criteria without the optional counters.lua file**
Step 3. Pass-criteria without the optional counters.lua file:

```
src/program/snabbvmx/tests/end-to-end$ vi test_env.sh
Expand All @@ -727,8 +721,9 @@ TEST_DATA=(
"snabbvmx-lwaftr-xe1.cfg" "" "regressiontest-signedntohl-frags.pcap" "" ""
"drop-all-ipv6-fragments.lua"
)
```

```
src/program/snabbvmx/tests/end-to-end$ sudo ./end-to-end.sh
Testing: sample test
loading compiled binding table from data/binding_table.txt.s.o
Expand All @@ -751,24 +746,15 @@ Test passed
All end-to-end lwAFTR tests passed.
```

If the counters file shall be taken into consideration as well (e.g. to count dropped frames), then just one line needs to be changed from "" to the counters file "test.lua"
If the counters file shall be taken into consideration as well (e.g. to count dropped frames), then just one line needs to be changed from "" to the counters file "test.lua".

```
$ cd snabb/src/program/snabbvmx/tests/end-to-end
$ vi test_env.sh
...
"sample test"
"snabbvmx-lwaftr-xe1.cfg" "ipv4-in.pcap" "" "" "outv6.pcap"
"test.lua"
```











```
"sample test"
"snabbvmx-lwaftr-xe1.cfg" "ipv4-in.pcap" "" "" "outv6.pcap"
"test.lua"
```

0 comments on commit 119cdd4

Please sign in to comment.