Wednesday, June 1, 2016

Unittesting hardware

Having unit tests for software is all very well; but how can you test hardware?

FAUCET supports running unit tests against hardware as well against software.

This means you can verify - with the exact same test code - and before you deploy a new switch software release - that your code (and your switch) works correctly.

That's a lot more fun than a time consuming lab test or an embarrassing code upgrade and rollback in production.


                     +--------------------------+
                     |                          |
                     |         FAUCET CPN       |
                     |                          |
                     |                          |
+------------------------------+     +-------------------------+
|                    |         |     |          |              |
|                    |    +--+ |     | +--+     |              |
|                    |    |  +---------+  |     |              |
|   FAUCET test host |    +--+ |     | +--+     |              |
|                    +--------------------------+              |
|                              |     |                         |
|                              |     |                         |
|                              |     |                         |
|                              |     |                         |
|          +---------------------+   |                         |
|          |   +------+   +--+ | |   | +--+                    |
|          |   |VM 1  |   |  +---------+  |                    |
|          |   +------+   +--+ | |   | +--+                    |
|          |                   | |   |                         |
|          |   +------+   +--+ | |   | +--+  OpenFlow switch   |
|          |   |VM 2  |   |  +---------+  |  under test        |
|          |   +------+   +--+ | |   | +--+                    |
|          |                   | |   |                         |
|          |   +------+   +--+ | |   | +--+                    |
|          |   |VM 3  |   |  +---------+  |                    |
|          |   +------+   +--+ | |   | +--+                    |
|          |                   | |   |                         |
|          |   +------+   +--+ | |   | +--+                    |
|          |   |VM 4  |   |  +---------+  |                    |
|          |   +------+   +--+ | |   | +--+                    |
|          |                   | |   |                         |
|          |                   | |   |                         |
+------------------------------+ |   +-------------------------+
           |                     |
           |    MININET          |
           |                     |
           |                     |
           +---------------------+

To test hardware, connect 5 ports from your hardware switch, to 5 physical Ethernet ports on your test host. 1 of those ports will have to be for your control plane, of course.

Then, modify hw_switch_config.yaml in FAUCET's test directory. This file tells FAUCET how to map the ports you connected to the mininet test hosts:

# if set to True, map a hardware OpenFlow switch to ports on this machine.
# Otherwise, run tests against OVS locally.
hw_switch: True
# Map ports on the hardware switch, to physical ports on this machine.
dp_ports:
  1: p1p1
  2: p1p2
  3: p1p3
  4: p1p4
# override test DPID if necessary
dpid: 0000eccd6d9936ed

In this example, switch port 1, is mapped to physical port p1p1 on the test host, and so on.

Then run the tests. Now, the tests will run against hardware, instead of software. 





No comments:

Post a Comment

Note: Only a member of this blog may post a comment.