Changes between Version 43 and Version 44 of OpenFlow/FOAM/Testing


Ignore:
Timestamp:
07/06/13 01:50:35 (6 years ago)
Author:
Josh Smift
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenFlow/FOAM/Testing

    v43 v44  
    374374= Auto-approval =
    375375
    376 This section contains multiple tests, and includes a "General setup" subsection to set some variables, and then additional subsections to do various tests.
    377 
    378 Each of the subsections corresponds to one of the approve-on-creation modes; you should run the tests in the section that corresponds to the approve-on-creation mode of the FOAM server that you're testing. (The "General setup" subsection includes a step for determining this, each subsection includes a step to double-check it.)
    379 
    380 You only need to do the "General setup" subsection once.
    381 
    382 Pre-requisites/assumptions:
    383 
    384  * You're set up to use Omni in general, and have it in your path as 'omni', i.e. you've successfully used Omni to reserve GENI resources (and have the latest version of the software, a user credential signed by a CA that's trusted by the FOAM server you intend to test, a working omni_config file, etc).
    385  * You have a set of valid request rspec files to test with. We plan to make some sample rspecs available.
    386  * You can log in non-interactively to the FOAM and FV servers, and have admin privs there, and have the FOAM and fvadmin password stored in files (/etc/foam.passwd and /etc/flowvisor.passwd). (This generally can't be used as-is to test FOAM at other sites.)
    387  * The URL of the FOAM server is also a name that you can use to log in to it. (Very likely, but might be untrue with virtualhosts or some other odd thing.)
    388  * On the FOAM server you're testing, you have the foam-confirm-sliver, flowvisor-confirm-fvslice-exists, and flowvisor-confirm-flowspace-rule-count scripts.
    389  * On the system where you're running commands, you have the foam-create-and-verify-sliver script.
    390 
    391 Note that the scripts mentioned in the last two items are currently GPO-only. (GPO folks, they're in the syseng repo, under gposw.) We're working on making them public.
    392 
    393 You can run these tests wherever you usually use Omni; as written, they use SSH to run remote commands on the FOAM/FV server.
    394 
    395 == General setup ==
    396 
    397 Set the FOAM server name (modify this to use the DNS name of the server that you want to test):
    398 
    399 {{{
    400 foamserver=foam.example.edu
    401 }}}
    402 
    403 Set the name of the FlowVisor server to be the same (if it's the same, or something else if it isn't):
    404 
    405 {{{
    406 fvserver=$foamserver
    407 }}}
    408 
    409 Set the AM API URL:
    410 
    411 {{{
    412 am=https://${foamserver}:3626/foam/gapi/1
    413 }}}
    414 
    415 Identify the rspecs you plan to use (modify this if you want to use different rspecs), in several categories:
     376Since we first started testing auto-approval, our test suite has gotten increasingly more complicated, and more automated. At this point, we can't just post the script that we use to do the testing on the wiki for people to copy and use directly, but we do want people to be able to see what we do, so this section now contains pseudocode that describes what the script does, but which can't actually be run without a fair bit of additional setup (which is also described).
     377
     378These days, we only bother testing auto-approval mode 2 ("analysis"), because that's what we recommend that GENI sites use.
     379
     380== Setup ==
     381
     382The script has a general setup section, which defines:
     383
     384 * the FOAM and FV server hostnames ($foamserver and $fvserver)
     385 * the AM URL ($am)
     386 * a command to run the `foam-create-and-verify-sliver` script ($fcavs)
     387 * four slice names ($slicename1, $slicename2, $slicename3, $slicename4)
     388 * a filename for the saved slice credential for the four slices ($slicecred1, $slicecred2, $slicecred3, $slicecred4)
     389
     390It then:
     391
     392 * creates the slices
     393 * makes sure there aren't any leftover slivers in those slices on the FOAM server you're testing
     394 * turns off admin e-mail for creation, approval, and deletion, so you're not swamped with admin mail
     395
     396It then sets up a bunch of rspec variables, referring to rspecs defining a variety of slivers. For testing shared VLANs, it defines a VLAN ID, or 'none', and there's a variant of each rspec for each VLAN ID we want to test.
     397
     398The rspecs are:
    416399
    417400 * Four that specify subnets: The first two don't overlap, the third overlaps with one of the first two, the fourth overlaps with all of the first three.
    418401 * Four that specify MAC addresses: The first two don't overlap, the third overlaps with one of the first two, the fourth overlaps with all of the first three.
    419402 * Four that specify ethertypes: The first two don't overlap, the third overlaps with one of the first two, the fourth overlaps with all of the first three.
     403 * Two that specify an ethertype and a VLAN: One is a restricted VLAN, one is an exclusive VLAN.
    420404 * One that specifies a subnet, a MAC address, and an ethertype, each of which overlaps with one of the rspecs in the corresponding one of the three groups above.
    421  * One that includes a subnet that doesn't overlap with anything else, but also an entire VLAN (which should not be auto-approved).
    422  * Five that test various combinations of port groups.
    423 
    424 {{{
    425 rspec_10_3_5_0_24=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ip-10-3-5-0-24.rspec
    426 rspec_10_7_9_0_24=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ip-10-7-9-0-24.rspec
    427 rspec_10_3_0_0_16=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ip-10-3-0-0-16.rspec
    428 rspec_10_0_0_0_12=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ip-10-0-0-0-12.rspec
    429 
    430 rspec_cafebeefface=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-mac-cafebeefface.rspec
    431 rspec_deadbeadfeed=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-mac-deadbeadfeed.rspec
    432 rspec_aced_and_cafe=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-mac-aced-and-cafe.rspec
    433 rspec_aced_and_cafe_and_dead=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-mac-aced-and-cafe-and-dead.rspec
    434 
    435 rspec_ethertype_3171=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ethertype-3171.rspec
    436 rspec_ethertype_3172=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ethertype-3172.rspec
    437 rspec_ethertype_3173_and_3171=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ethertype-3173-and-3171.rspec
    438 rspec_ethertype_3173_and_3172_and_3171=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-ethertype-3173-and-3172-and-3171.rspec
    439 
    440 rspec_one_of_each=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-one-each-subnet-mac-ethertype.rspec
    441 
    442 rspec_dpid_aa_port_3_and_36=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-dpid-aa-port-3-and-36.rspec
    443 rspec_dpid_aa_port_3_and_11=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-dpid-aa-port-3-and-11.rspec
    444 rspec_dpid_aa_port_5_dpid_ff_port_21=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-dpid-aa-port-5-dpid-ff-port-21.rspec
    445 rspec_dpid_aa_port_9_dpid_ff_port_21=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-dpid-aa-port-9-dpid-ff-port-21.rspec
    446 rspec_dpid_aa_port_3_and_no_packet_match=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-dpid-aa-port-3-and-no-packet-match.rspec
    447 
    448 rspec_subnet_and_vlan=~/rspecs/request/foam-testing/rspecs/$foamserver/openflow-subnet-and-vlan.rspec
    449 }}}
    450 
    451 Set four slicenames, using something with your username and "foamtest":
    452 
    453 {{{
    454 slicename1=${USER}foamtest1
    455 slicename2=${USER}foamtest2
    456 slicename3=${USER}foamtest3
    457 slicename4=${USER}foamtest4
    458 }}}
    459 
    460 Make sure FOAM is listening at all:
    461 
    462 {{{
    463 omni -a $am getversion
    464 omni -a $am listresources
    465 }}}
    466 
    467 Check which approve-on-creation mode FOAM is currently set to use:
    468 
    469 {{{
    470 ssh $foamserver foamctl config:get-value --key="geni.approval.approve-on-creation" --passwd-file=/etc/foam.passwd
    471 }}}
    472 
    473 The possible values are 2 for "analysis", 1 for "always", and 0 for "never". (You can change this if you want to test a different value, but you may not want to do that, e.g. if it's a server that anyone else is using.)
    474 
    475 OPTIONALLY, turn off e-mail notification for creation, approval, and deletion:
    476 
    477 {{{
    478 ssh $foamserver foamctl config:set-value --key="email.event.createsliver.admin" --value="false" --passwd-file=/etc/foam.passwd
    479 ssh $foamserver foamctl config:set-value --key="email.event.approvesliver.admin" --value="false" --passwd-file=/etc/foam.passwd
    480 ssh $foamserver foamctl config:set-value --key="email.event.gapi-deletesliver.admin" --value="false" --passwd-file=/etc/foam.passwd
    481 }}}
    482 
    483 If you do that, you may want to turn notification back on when you're done testing:
    484 
    485 {{{
    486 ssh $foamserver foamctl config:set-value --key="email.event.createsliver.admin" --value="true" --passwd-file=/etc/foam.passwd
    487 ssh $foamserver foamctl config:set-value --key="email.event.approvesliver.admin" --value="true" --passwd-file=/etc/foam.passwd
    488 ssh $foamserver foamctl config:set-value --key="email.event.gapi-deletesliver.admin" --value="true" --passwd-file=/etc/foam.passwd
    489 }}}
    490 
    491 Now you're ready to run the tests in one or more of the following subections.
    492 
    493 == Approval mode 2 ("analysis") ==
    494 
    495 This subsection tests the behavior of FOAM when new slivers are created and geni.approval.approve-on-creation is set to 2 (analysis). The expected behavior is that slivers will be automatically approved if they pass all of the checks in the analysis engine, i.e. they don't overlap with any existing slivers; and don't contain any flowspace that can't be handled by the analysis engine.
    496 
    497 Double-check the FOAM server's current configuration:
    498 
    499 {{{
    500 ssh $foamserver foamctl config:get-value --key="geni.approval.approve-on-creation" --passwd-file=/etc/foam.passwd
    501 }}}
    502 
    503 If the value isn't "2", then you shouldn't run this section on this FOAM server. (You can first change the configuration of this FOAM server, but you may not want to do that, e.g. if it's a server that anyone else is using.)
    504 
    505 You can go through all of these tests in sequence; they're further divided into sets of tests for convenience.
    506 
    507 === Four slivers ===
    508 
    509 This set of tests uses four rspecs that specify a single feature (IP subnet, MAC address, or ethertype). In each set of four rspecs, the first two (A and B) don't overlap, the third (C) overlaps with one of the first two (A), and the fourth (D) overlaps with all of the first three.
    510 
    511 Each test (one per block below) creates the slivers in a different order, to confirm that the anlysis engine detects overlap regardless of whether a more specific or less specific sliver is created first. Each test deletes any lingering slivers before running, just to make sure the slate is clean. Each test should generate four "sliver created" e-mail messages, plus one "sliver approved" message per sliver that's expected to be automatically approved; and also four "sliver deleted" messages if any slivers were there to be deleted.
    512 
    513 These tests attempt to verify these principles:
     405 * One that specifies a port on a shared VLAN, but no packet match.
     406 * Twenty-seven that test various combinations of port groups.
     407 * Two that test restricted VLANs: One that specifies only a restricted VLAN, and one that specifies a restricted VLAN and an exclusive VLAN.
     408 * Four that specify combinations of exclusive VLANs: The first two don't overlap, the third overlaps with one of the first two, the fourth overlaps with all of the first three.
     409 * Three that specify combinations of a VLAN and a DPID: VLAN 5 and DPID 1, VLAN 5 and DPID 2, and VLAN 6 and DPID 1.
     410 * Three that specify combinations of a VLAN and an ethertype: VLAN 5 and ethertype 3171, VLAN 5 and ethertype 3172, and VLAN 6 and ethertype 3171.
     411
     412Those are used in various combinations in the tests below.
     413
     414== Tests ==
     415
     416=== Overview ===
     417
     418The script first runs a set of shared VLAN tests, twice: Once with the VLAN ID unspecified (as on a VLAN-hybrid switch), and once with a specified shared VLAN (which must be configured as a shared VLAN on the FOAM server of course). The test_shared_vlan function below has more details.
     419
     420It then runs three sets of exclusive VLAN tests with four slivers (ABCD):
     421
     422 * One with four slivers which just specify VLANs, where A and B don't overlap, C overlaps with A, and D overlaps with all of them.
     423 * One with four slivers which specify VLAN IDs and DPIDs, where A, B, and C all overlap, and D doesn't overlap with any of them.
     424 * One with four slivers which specify VLAN IDs and ethertypes, where A, B, and C all overlap, and D doesn't overlap with any of them.
     425
     426Finally, it runs two simple tests using slivers with restricted VLANs.
     427
     428=== Four-sliver tests ===
     429
     430The "four-sliver" tests use four rspecs that share a feature, where some overlap with respect to that feature, and some don't. Each test creates the slivers in a different order, to confirm that the anlysis engine detects overlap regardless of whether a more specific or less specific sliver is created first.
     431
     432There are two "styles" of four-sliver tests. In "style 1", the first two rspecs (A and B) don't overlap, the third (C) overlaps with one of the first two (A), and the fourth (D) overlaps with all of the first three. The ensuing tests verify these principles:
    514433
    515434 * Whichever of A and C gets created first should be approved, and will then block the other.
    516435 * B should always be approved as long as it's created before D, since it isn't blocked by either A or C.
    517436 * D should only be approved if it's created first, because otherwise it's blocked by any of A, B, or C; and if it's created first, it blocks all of them.
    518  * If something would block other things if it was approved, it doesn't block those things if it's pending.
    519 
    520 There's a "Four-sliver setup" section to set the A/B/C/D variables, and then a tests section to run the tests. You can re-run the "Four-sliver setup" section, and then re-run the tests section, e.g. to test each of the three features.
    521 
    522 ==== Four-sliver setup ====
    523 
    524 Do ONE of these, depending on whether you want to test IP, MAC, or ethertype, to define which rspecs to use, and how many FlowVisor flowspace rules to expect if that rspec is approved.
    525 
    526 IP:
    527 
    528 {{{
    529 rspec_A=$rspec_10_3_5_0_24
    530 rspec_B=$rspec_10_7_9_0_24
    531 rspec_C=$rspec_10_3_0_0_16
    532 rspec_D=$rspec_10_0_0_0_12
    533 
    534 rules_A=2
    535 rules_B=2
    536 rules_C=2
    537 rules_D=2
    538 }}}
    539 
    540 MAC:
    541 
    542 {{{
    543 rspec_A=$rspec_cafebeefface
    544 rspec_B=$rspec_deadbeadfeed
    545 rspec_C=$rspec_aced_and_cafe
    546 rspec_D=$rspec_aced_and_cafe_and_dead
    547 
    548 rules_A=2
    549 rules_B=2
    550 rules_C=4
    551 rules_D=6
    552 }}}
    553 
    554 Ethertype:
    555 
    556 {{{
    557 rspec_A=$rspec_ethertype_3171
    558 rspec_B=$rspec_ethertype_3172
    559 rspec_C=$rspec_ethertype_3173_and_3171
    560 rspec_D=$rspec_ethertype_3173_and_3172_and_3171
    561 
    562 rules_A=1
    563 rules_B=1
    564 rules_C=2
    565 rules_D=3
    566 }}}
    567 
    568 Now you're ready to run the four-sliver tests.
    569 
    570 ==== Four-sliver tests ====
    571 
    572 ABCD - A and B should be approved, C and D should be pending:
    573 
    574 {{{
    575 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    576 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_A approved true $rules_A
    577 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_B approved true $rules_B
    578 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_C pending false 0
    579 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_D pending false 0
    580 }}}
    581 
    582 ACBD - A should be approved, C pending, B approved, and D pending:
    583 
    584 {{{
    585 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    586 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_A approved true $rules_A
    587 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_C pending false 0
    588 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_B approved true $rules_B
    589 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_D pending false 0
    590 }}}
    591 
    592 BACD - B and A should be approved, C and D pending should be pending:
    593 
    594 {{{
    595 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    596 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_B approved true $rules_B
    597 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_A approved true $rules_A
    598 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_C pending false 0
    599 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_D pending false 0
    600 }}}
    601 
    602 BCAD - B and C should be approved, A and D should be pending:
    603 
    604 {{{
    605 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    606 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_B approved true $rules_B
    607 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_C approved true $rules_C
    608 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_A pending false 0
    609 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_D pending false 0
    610 }}}
    611 
    612 CABD - C should be approved, A pending, B approved, and D pending:
    613 
    614 {{{
    615 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    616 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_C approved true $rules_C
    617 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_A pending false 0
    618 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_B approved true $rules_B
    619 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_D pending false 0
    620 }}}
    621 
    622 CBAD - C and B should be approved, A and D should be pending:
    623 
    624 {{{
    625 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    626 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_C approved true $rules_C
    627 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_B approved true $rules_B
    628 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_A pending false 0
    629 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_D pending false 0
    630 }}}
    631 
    632 DABC - D should be approved, A and B and C should be pending:
    633 
    634 {{{
    635 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    636 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_D approved true $rules_D
    637 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_A pending false 0
    638 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_B pending false 0
    639 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_C pending false 0
    640 }}}
    641 
    642 ADBC - A should be approved, D pending, B approved, and C pending:
    643 
    644 {{{
    645 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    646 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_A approved true $rules_A
    647 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_D pending false 0
    648 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_B approved true $rules_B
    649 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_C pending false 0
    650 }}}
    651 
    652 ADCB - A should be approved, D pending, C pending, and B approved:
    653 
    654 {{{
    655 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    656 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_A approved true $rules_A
    657 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_D pending false 0
    658 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_C pending false 0
    659 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_B approved true $rules_B
    660 }}}
    661 
    662 Delete any remaining slivers:
    663 
    664 {{{
    665 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    666 }}}
    667 
    668 === Three-feature slivers ===
    669 
    670 This set of tests uses an rspec that reserves all three features (an IP subnet, a MAC address, and an Ethertype), and tests situations where the three-way rspec does and doesn't overlap with other rspecs that only reserve one of those three things.
    671 
    672 Each test (one per block below) creates the slivers in a different order, to confirm that the anlysis engine detects overlap regardless of whether a more specific or less specific sliver is created first. Each test deletes any lingering slivers before running, just to make sure the slate is clean. Each test should generate four "sliver created" e-mail messages, plus one "sliver approved" message per sliver that's expected to be automatically approved; and also four "sliver deleted" messages if any slivers were there to be deleted.
    673 
    674 These tests attempt to verify these principles:
     437 * If something would block other things if it was approved, it doesn't block those things if it's pending. (For example, D normally blocks B, but in A D B C, B should not be blocked, because D should not be approved, because A blocks it; the pending D should not block B, even though an approved B would block D.)
     438
     439In "style 2", the first three slivers all overlap, and the fourth doesn't overlap with any of them. The ensuing tests verify these principles:
     440
     441 * Whichever of A, B, or C gets created first should be approved, and block the other two.
     442 * D should always be approved, no matter when it's created.
     443 * If D is approved before A, B, or C, it should have no effect on whether the others are approved.
     444
     445Each stle is used at appropriate points in the script.
     446
     447=== Three-feature tests ===
     448
     449The "three-feature" tests use one rspec that reserves three features on a shared VLAN (an IP subnet, a MAC address, and an Ethertype), and tests situations where the three-way rspec does and doesn't overlap with three other rspecs that only reserve one of those three things each. Each test creates the slivers in a different order, to confirm that the anlysis engine detects overlap regardless of whether a more specific or less specific sliver is created first.
     450
     451The ensuing tests verify these principles:
    675452
    676453 * If the three-way sliver doesn't overlap with any of the one-way slivers, they all get approved.
     
    680457   * If any one-way sliver is created first, and the three-way sliver is created second, the three-way sliver should be pending, and the others should all be approved.
    681458
    682 This set of tests doesn't need any additional setup.
    683 
    684 No overlap, three-way first:
    685 
    686 {{{
    687 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    688 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_one_of_each approved true 5
    689 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_7_9_0_24 approved true 2
    690 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_deadbeadfeed approved true 2
    691 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3172 approved true 1
    692 }}}
    693 
    694 No overlap, three-way last:
    695 
    696 {{{
    697 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    698 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_7_9_0_24 approved true 2
    699 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_deadbeadfeed approved true 2
    700 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_ethertype_3172 approved true 1
    701 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_one_of_each approved true 5
    702 }}}
    703 
    704 Overlap, three-way first:
    705 
    706 {{{
    707 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    708 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_one_of_each approved true 5
    709 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_3_5_0_24 pending false 0
    710 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_cafebeefface pending false 0
    711 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 pending false 0
    712 }}}
    713 
    714 Overlap three-way last:
    715 
    716 {{{
    717 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    718 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_3_5_0_24 approved true 2
    719 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_cafebeefface approved true 2
    720 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_ethertype_3171 approved true 1
    721 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_one_of_each pending false 0
    722 }}}
    723 
    724 Overlap, three-way second, IP first:
    725 
    726 {{{
    727 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    728 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_3_5_0_24 approved true 2
    729 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_one_of_each pending false 0
    730 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_cafebeefface approved true 2
    731 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 approved true 1
    732 }}}
    733 
    734 Overlap, three-way second, MAC first:
    735 
    736 {{{
    737 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    738 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_cafebeefface approved true 2
    739 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_one_of_each pending false 0
    740 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_3_5_0_24 approved true 2
    741 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 approved true 1
    742 }}}
    743 
    744 Overlap, three-way second, ethertype first:
    745 
    746 {{{
    747 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    748 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3171 approved true 1
    749 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_one_of_each pending false 0
    750 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_3_5_0_24 approved true 2
    751 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_cafebeefface approved true 2
    752 }}}
    753 
    754 Delete any remaining slivers:
    755 
    756 {{{
    757 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    758 }}}
    759 
    760 === Slivers with port groups ===
    761 
    762 This set of tests uses rspecs containing port groups, and tests various situations where a sliver does or doesn't include multiple ports in a port group.
    763 
    764 Because the different combinations of ports are defined in the rspec, each test creates only one sliver, using a different rspec with the different combinations of ports that we want to test.
    765 
    766 NOTE that this assumes that you have datapaths and port groups defined in your FOAM server, which correspond to the datapaths and port groups in the rspec. FIXME: Need to document how to do this with fake datapaths.
    767 
    768 This set of tests doesn't need any additional setup.
    769 
    770 One port in a port group, and one that isn't - should be approved:
    771 
    772 {{{
    773 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_dpid_aa_port_3_and_36 approved true 4
    774 for slicename in $slicename1 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    775 }}}
    776 
    777 Two ports in a port group on the same datapath - should be pending:
    778 
    779 {{{
    780 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_dpid_aa_port_3_and_11 pending false 0
    781 for slicename in $slicename1 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    782 }}}
    783 
    784 Two ports, one on each datapath, not in a port group - should be approved:
    785 
    786 {{{
    787 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_dpid_aa_port_5_dpid_ff_port_21 approved true 8
    788 for slicename in $slicename1 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    789 }}}
    790 
    791 Two ports, one on each datapath, in a port group - should be pending:
    792 
    793 {{{
    794 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_dpid_aa_port_9_dpid_ff_port_21 pending false 0
    795 for slicename in $slicename1 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    796 }}}
    797 
    798 One port, but no <openflow:packet> match - should be pending:
    799 
    800 {{{
    801 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_dpid_aa_port_3_and_no_packet_match pending false 0
    802 for slicename in $slicename1 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    803 }}}
    804 
    805 === Forbidden slivers ===
    806 
    807 This set of tests uses rspecs containing things that should never be auto-approved. (Currently, only one of them, an rspec containing an entire VLAN.)
    808 
    809 This set of tests doesn't need any additional setup.
    810 
    811 Create and verify the sliver:
    812 
    813 {{{
    814 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_subnet_and_vlan pending false 0
    815 }}}
    816 
    817 (That should generate one "sliver created" and no "sliver approved" e-mail messages, one set to the experimenter and one set to the FOAM admin.)
    818 
    819 Delete the sliver:
    820 
    821 {{{
    822 for slicename in $slicename1 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    823 }}}
    824 
    825 == Approval mode 1 ("always") ==
    826 
    827 This subsection tests the behavior of FOAM when new slivers are created and geni.approval.approve-on-creation is set to 1 (always). The expected behavior is that all slivers will automatically be approved after they're created.
    828 
    829 Note that we don't test port groups in mode 1, assuming that if an admin is going to always auto-approve everything, they wouldn't even create port groups in the first place.
    830 
    831 Double-check the FOAM server's current configuration:
    832 
    833 {{{
    834 ssh $foamserver foamctl config:get-value --key="geni.approval.approve-on-creation" --passwd-file=/etc/foam.passwd
    835 }}}
    836 
    837 If the value isn't "1", then you shouldn't run this section on this FOAM server. (You can first change the configuration of this FOAM server, but you may not want to do that, e.g. if it's a server that anyone else is using.)
    838 
    839 You can go through all of these tests in sequence; they're divided into blocks of four because we only try creating four slivers at a time.
    840 
    841 IP subnets, smaller subnets first:
    842 
    843 {{{
    844 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    845 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_3_5_0_24 approved true 2
    846 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_7_9_0_24 approved true 2
    847 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_3_0_0_16 approved true 2
    848 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_10_0_0_0_12 approved true 2
    849 }}}
    850 
    851 IP subnets, larger subnets first:
    852 
    853 {{{
    854 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    855 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_0_0_0_12 approved true 2
    856 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_3_5_0_24 approved true 2
    857 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_7_9_0_24 approved true 2
    858 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_10_3_0_0_16 approved true 2
    859 }}}
    860 
    861 MAC addresses, fewer addresses first:
    862 
    863 {{{
    864 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    865 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_cafebeefface approved true 2
    866 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_deadbeadfeed approved true 2
    867 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_aced_and_cafe approved true 4
    868 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_aced_and_cafe_and_dead approved true 6
    869 }}}
    870 
    871 MAC addresses, more addresses first:
    872 
    873 {{{
    874 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    875 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_aced_and_cafe_and_dead approved true 6
    876 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_aced_and_cafe approved true 4
    877 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_deadbeadfeed approved true 2
    878 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_cafebeefface approved true 2
    879 }}}
    880 
    881 Ethertypes, fewer ethertypes first:
    882 
    883 {{{
    884 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    885 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3171 approved true 1
    886 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_ethertype_3172 approved true 1
    887 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_ethertype_3173_and_3171 approved true 2
    888 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3173_and_3172_and_3171 approved true 3
    889 }}}
    890 
    891 Ethertypes, more ethertypes first:
    892 
    893 {{{
    894 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    895 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3173_and_3172_and_3171 approved true 3
    896 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_ethertype_3173_and_3171 approved true 2
    897 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_ethertype_3172 approved true 1
    898 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 approved true 1
    899 }}}
    900 
    901 Three-feature slivers with no overlap, three-way first:
    902 
    903 {{{
    904 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    905 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_one_of_each approved true 5
    906 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_7_9_0_24 approved true 2
    907 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_deadbeadfeed approved true 2
    908 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3172 approved true 1
    909 }}}
    910 
    911 Three-feature slivers with no overlap, three-way last:
    912 
    913 {{{
    914 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    915 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3172 approved true 1
    916 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_deadbeadfeed approved true 2
    917 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_7_9_0_24 approved true 2
    918 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_one_of_each approved true 5
    919 }}}
    920 
    921 Three-feature slivers with overlap, three-way first:
    922 
    923 {{{
    924 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    925 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_one_of_each approved true 5
    926 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_3_5_0_24 approved true 2
    927 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_cafebeefface approved true 2
    928 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 approved true 1
    929 }}}
    930 
    931 Three-feature slivers with overlap, three-way last:
    932 
    933 {{{
    934 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    935 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3171 approved true 1
    936 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_cafebeefface approved true 2
    937 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_3_5_0_24 approved true 2
    938 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_one_of_each approved true 5
    939 }}}
    940 
    941 Forbidden slivers:
    942 
    943 {{{
    944 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    945 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_subnet_and_vlan approved true 3
    946 }}}
    947 
    948 Delete any remaining slivers:
    949 
    950 {{{
    951 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    952 }}}
    953 
    954 == Approval mode 0 ("never") ==
    955 
    956 This subsection tests the behavior of FOAM when new slivers are created and geni.approval.approve-on-creation is set to 0 (never). The expected behavior is that all slivers will automatically be pending after they're created.
    957 
    958 Note that we don't test port groups in mode 0, assuming that if an admin is going to never auto-approve anything, they wouldn't even create port groups in the first place.
    959 
    960 Double-check the FOAM server's current configuration:
    961 
    962 {{{
    963 ssh $foamserver foamctl config:get-value --key="geni.approval.approve-on-creation" --passwd-file=/etc/foam.passwd
    964 }}}
    965 
    966 If the value isn't "0", then you shouldn't run this section on this FOAM server. (You can first change the configuration of this FOAM server, but you may not want to do that, e.g. if it's a server that anyone else is using.)
    967 
    968 You can go through all of these tests in sequence; they're divided into blocks of four because we only try creating four slivers at a time.
    969 
    970 IP subnets, smaller subnets first:
    971 
    972 {{{
    973 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    974 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_3_5_0_24 pending false 0
    975 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_7_9_0_24 pending false 0
    976 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_3_0_0_16 pending false 0
    977 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_10_0_0_0_12 pending false 0
    978 }}}
    979 
    980 IP subnets, larger subnets first:
    981 
    982 {{{
    983 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    984 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_10_0_0_0_12 pending false 0
    985 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_3_5_0_24 pending false 0
    986 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_7_9_0_24 pending false 0
    987 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_10_3_0_0_16 pending false 0
    988 }}}
    989 
    990 MAC addresses, fewer addresses first:
    991 
    992 {{{
    993 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    994 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_cafebeefface pending false 0
    995 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_deadbeadfeed pending false 0
    996 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_aced_and_cafe pending false 0
    997 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_aced_and_cafe_and_dead pending false 0
    998 }}}
    999 
    1000 MAC addresses, more addresses first:
    1001 
    1002 {{{
    1003 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1004 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_aced_and_cafe_and_dead pending false 0
    1005 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_aced_and_cafe pending false 0
    1006 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_deadbeadfeed pending false 0
    1007 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_cafebeefface pending false 0
    1008 }}}
    1009 
    1010 Ethertypes, fewer ethertypes first:
    1011 
    1012 {{{
    1013 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1014 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3171 pending false 0
    1015 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_ethertype_3172 pending false 0
    1016 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_ethertype_3173_and_3171 pending false 0
    1017 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3173_and_3172_and_3171 pending false 0
    1018 }}}
    1019 
    1020 Ethertypes, more ethertypes first:
    1021 
    1022 {{{
    1023 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1024 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3173_and_3172_and_3171 pending false 0
    1025 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_ethertype_3173_and_3171 pending false 0
    1026 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_ethertype_3172 pending false 0
    1027 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 pending false 0
    1028 }}}
    1029 
    1030 Three-feature slivers with no overlap, three-way first:
    1031 
    1032 {{{
    1033 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1034 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_one_of_each pending false 0
    1035 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_7_9_0_24 pending false 0
    1036 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_deadbeadfeed pending false 0
    1037 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3172 pending false 0
    1038 }}}
    1039 
    1040 Three-feature slivers with no overlap, three-way last:
    1041 
    1042 {{{
    1043 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1044 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3172 pending false 0
    1045 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_deadbeadfeed pending false 0
    1046 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_7_9_0_24 pending false 0
    1047 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_one_of_each pending false 0
    1048 }}}
    1049 
    1050 Three-feature slivers with overlap, three-way first:
    1051 
    1052 {{{
    1053 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1054 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_one_of_each pending false 0
    1055 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_10_3_5_0_24 pending false 0
    1056 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_cafebeefface pending false 0
    1057 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_ethertype_3171 pending false 0
    1058 }}}
    1059 
    1060 Three-feature slivers with overlap, three-way last:
    1061 
    1062 {{{
    1063 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1064 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_ethertype_3171 pending false 0
    1065 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename2 $rspec_cafebeefface pending false 0
    1066 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename3 $rspec_10_3_5_0_24 pending false 0
    1067 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename4 $rspec_one_of_each pending false 0
    1068 }}}
    1069 
    1070 Forbidden slivers:
    1071 
    1072 {{{
    1073 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1074 foam-create-and-verify-sliver -q $foamserver $fvserver $am $slicename1 $rspec_subnet_and_vlan pending false 0
    1075 }}}
    1076 
    1077 Delete any remaining slivers:
    1078 
    1079 {{{
    1080 for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni -a $am deletesliver $slicename >& /dev/null ; done
    1081 }}}
    1082 
    1083 == Automation ==
    1084 
    1085 We have a wrapper script that does all of that automatically, but it's also GPO-only at the moment. For GPO people, it's foam-run-auto-approval-tests, and you can run it like this:
    1086 
    1087 {{{
    1088 foam-run-auto-approval-tests $foamserver 2 |& tee auto-approval-results.txt
    1089 grep ERROR auto-approval-results.txt || echo no errors!
    1090 }}}
    1091 
    1092 where the first argument is the FOAM server, and the second is the approval mode to test. (You can test an approval mode other than the one that the server is in, if you want to confirm that you get lots of error output when the test results aren't as expected -- it just tells the script what mode to test, it doesn't change anything on the server.)
    1093 
    1094 The 'grep ERROR' at the end is to find any actual errors (at which point you can go looking in the full log for the details).
    1095 
    1096 You may also want to disable some e-mail notifications temporarily, as above, and re-enable them afterwards; the script doesn't do that for you.
     459We don't bother to test what happens if the there-way sliver is created third, since it should be the same as when it's created second.
     460
     461=== Port group tests ===
     462
     463Note that the port group tests assumes that you have certain datapaths and port groups defined in your FOAM server, which correspond to the datapaths and port groups in the rspecs. In our rspecs, we test combinations that reflect the network managed by our production FOAM server, with fake datapaths on the pre-production systems.
     464
     465=== Pseudocode ===
     466
     467All the tests, in pseudocode, follow. DO NOT just copy and paste this; it shouldn't do much, but it definitely won't do anything good.
     468
     469==== Main loop ====
     470
     471This mostly calls the other functions defined below, but also does the restricted VLAN test.
     472
     473{{{
     474## test_approval_mode_2
     475#
     476# This function tests auto-approval mode 2.
     477
     478function test_approval_mode_2
     479{
     480
     481  echo "Checking the current approval-on-creation mode..."
     482
     483  ssh $foamserver foamctl config:get-value --key="geni.approval.approve-on-creation" --passwd-file=/etc/foam.passwd
     484
     485  echo "If that value was '2', any errors after this point are unexpected."
     486
     487  # Test shared VLAN stuff twice: Once for the 'none' VLAN, and once for
     488  # shared VLAN 1750.
     489
     490  do_rspec_setup none
     491  test_shared_vlans
     492
     493  do_rspec_setup 1750
     494  test_shared_vlans
     495
     496  # Run the exclusive VLAN tests.
     497
     498  test_four_slivers_style_1 $rspec_vlan_5 $rspec_vlan_6 $rspec_vlan_7_and_5 $rspec_vlan_7_and_6_and_5 1 1 2 3
     499
     500  test_four_slivers_style_2 $rspec_vlan_5 $rspec_vlan_5_dpid1 $rspec_vlan_5_dpid2 $rspec_vlan_6_dpid1 1 1 1 1
     501
     502  test_four_slivers_style_2 $rspec_vlan_5 $rspec_vlan_5_ethertype_3171 $rspec_vlan_5_ethertype_3172 $rspec_vlan_6_ethertype_3171 1 1 1 1
     503
     504  # Run the restricted VLAN tests.
     505
     506  $fcavs $slicename1 $rspec_vlan_1 pending false 0 $slicecred1
     507  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     508
     509  $fcavs $slicename1 $rspec_vlan_5_and_1 pending false 0 $slicecred1
     510  $fcavs $slicename2 $rspec_vlan_5 approved true 1 $slicecred2
     511  for slicename in $slicename1 $slicename2 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     512
     513}
     514}}}
     515
     516==== test_shared_vlans ====
     517
     518{{{
     519
     520## test_shared_vlans
     521#
     522# Any tests that relate to shared VLANs need to live here, so they can be
     523# repeated with all shared VLANs (either VLAN-hybrid ones or ones with
     524# dl_vlan that are marked as shared).
     525
     526function test_shared_vlans
     527
     528
     529  ## Four-sliver tests
     530
     531  # Run these three times: Once for IP subnets, once for MAC addresses, and once for ethertypes.
     532
     533  test_four_slivers_style_1 $rspec_172_17_16_0_24 $rspec_172_17_32_0_24 $rspec_172_17_00_0_19 $rspec_172_17_00_0_18 2 2 2 2
     534
     535  test_four_slivers_style_1 $rspec_cafebeefface $rspec_deadbeadfeed $rspec_aced_and_cafe $rspec_aced_and_cafe_and_dead 2 2 4 6
     536
     537  test_four_slivers_style_1 $rspec_ethertype_3171 $rspec_ethertype_3172 $rspec_ethertype_3173_and_3171 $rspec_ethertype_3173_and_3172_and_3171 1 1 2 3
     538
     539  ## Three-feature tests
     540
     541  # No overlap, three-way first.
     542
     543  $fcavs $slicename1 $rspec_one_of_each approved true 5 $slicecred1
     544  $fcavs $slicename2 $rspec_172_17_32_0_24 approved true 2 $slicecred2
     545  $fcavs $slicename3 $rspec_deadbeadfeed approved true 2 $slicecred3
     546  $fcavs $slicename4 $rspec_ethertype_3172 approved true 1 $slicecred4
     547  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     548
     549  # No overlap, three-way last.
     550
     551  $fcavs $slicename1 $rspec_172_17_32_0_24 approved true 2 $slicecred1
     552  $fcavs $slicename2 $rspec_deadbeadfeed approved true 2 $slicecred2
     553  $fcavs $slicename3 $rspec_ethertype_3172 approved true 1 $slicecred3
     554  $fcavs $slicename4 $rspec_one_of_each approved true 5 $slicecred4
     555  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     556
     557  # Overlap, three-way first.
     558
     559  $fcavs $slicename1 $rspec_one_of_each approved true 5 $slicecred1
     560  $fcavs $slicename2 $rspec_172_17_16_0_24 pending false 0 $slicecred2
     561  $fcavs $slicename3 $rspec_cafebeefface pending false 0 $slicecred3
     562  $fcavs $slicename4 $rspec_ethertype_3171 pending false 0 $slicecred4
     563  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     564
     565  # Overlap, three-way last.
     566
     567  $fcavs $slicename1 $rspec_172_17_16_0_24 approved true 2 $slicecred1
     568  $fcavs $slicename2 $rspec_cafebeefface approved true 2 $slicecred2
     569  $fcavs $slicename3 $rspec_ethertype_3171 approved true 1 $slicecred3
     570  $fcavs $slicename4 $rspec_one_of_each pending false 0 $slicecred4
     571  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     572
     573  # Overlap, three-way second, IP first.
     574
     575  $fcavs $slicename1 $rspec_172_17_16_0_24 approved true 2 $slicecred1
     576  $fcavs $slicename2 $rspec_one_of_each pending false 0 $slicecred2
     577  $fcavs $slicename3 $rspec_cafebeefface approved true 2 $slicecred3
     578  $fcavs $slicename4 $rspec_ethertype_3171 approved true 1 $slicecred4
     579  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     580
     581  # Overlap, three-way second, MAC first.
     582
     583  $fcavs $slicename1 $rspec_cafebeefface approved true 2 $slicecred1
     584  $fcavs $slicename2 $rspec_one_of_each pending false 0 $slicecred2
     585  $fcavs $slicename3 $rspec_172_17_16_0_24 approved true 2 $slicecred3
     586  $fcavs $slicename4 $rspec_ethertype_3171 approved true 1 $slicecred4
     587  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     588
     589  # Overlap, three-way second, ethertype first.
     590
     591  $fcavs $slicename1 $rspec_ethertype_3171 approved true 1 $slicecred1
     592  $fcavs $slicename2 $rspec_one_of_each pending false 0 $slicecred2
     593  $fcavs $slicename3 $rspec_172_17_16_0_24 approved true 2 $slicecred3
     594  $fcavs $slicename4 $rspec_cafebeefface approved true 2 $slicecred4
     595  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     596
     597  ## Forbidden slivers
     598
     599  $fcavs $slicename1 $rspec_no_packet_match pending false 0 $slicecred1
     600  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     601
     602  ## Port groups
     603
     604  $fcavs $slicename1 $rspec_port_groups_03_05 pending false 0 $slicecred1
     605  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     606
     607  $fcavs $slicename1 $rspec_port_groups_03_09 pending false 0 $slicecred1
     608  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     609
     610  $fcavs $slicename1 $rspec_port_groups_03_11 pending false 0 $slicecred1
     611  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     612
     613  $fcavs $slicename1 $rspec_port_groups_05_09 pending false 0 $slicecred1
     614  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     615
     616  $fcavs $slicename1 $rspec_port_groups_05_11 pending false 0 $slicecred1
     617  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     618
     619  $fcavs $slicename1 $rspec_port_groups_09_11 pending false 0 $slicecred1
     620  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     621
     622  $fcavs $slicename1 $rspec_port_groups_20_03 approved true 4 $slicecred1
     623  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     624
     625  $fcavs $slicename1 $rspec_port_groups_ganel_03 pending false 0 $slicecred1
     626  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     627
     628  $fcavs $slicename1 $rspec_port_groups_ganel_05 pending false 0 $slicecred1
     629  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     630
     631  $fcavs $slicename1 $rspec_port_groups_ganel_09 approved true 8 $slicecred1
     632  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     633
     634  $fcavs $slicename1 $rspec_port_groups_ganel_11 approved true 8 $slicecred1
     635  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     636
     637  $fcavs $slicename1 $rspec_port_groups_gardil_03 pending false 0 $slicecred1
     638  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     639
     640  $fcavs $slicename1 $rspec_port_groups_gardil_05 pending false 0 $slicecred1
     641  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     642
     643  $fcavs $slicename1 $rspec_port_groups_gardil_09 approved true 8 $slicecred1
     644  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     645
     646  $fcavs $slicename1 $rspec_port_groups_gardil_11 approved true 8 $slicecred1
     647  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     648
     649  $fcavs $slicename1 $rspec_port_groups_sardis_03 pending false 0 $slicecred1
     650  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     651
     652  $fcavs $slicename1 $rspec_port_groups_sardis_05 pending false 0 $slicecred1
     653  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     654
     655  $fcavs $slicename1 $rspec_port_groups_sardis_09 approved true 8 $slicecred1
     656  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     657
     658  $fcavs $slicename1 $rspec_port_groups_sardis_11 approved true 8 $slicecred1
     659  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     660
     661  $fcavs $slicename1 $rspec_port_groups_bain_03 approved true 8 $slicecred1
     662  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     663
     664  $fcavs $slicename1 $rspec_port_groups_bain_05 approved true 8 $slicecred1
     665  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     666
     667  $fcavs $slicename1 $rspec_port_groups_bain_09 pending false 0 $slicecred1
     668  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     669
     670  $fcavs $slicename1 $rspec_port_groups_bain_11 pending false 0 $slicecred1
     671  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     672
     673  $fcavs $slicename1 $rspec_port_groups_navis_03 approved true 8 $slicecred1
     674  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     675
     676  $fcavs $slicename1 $rspec_port_groups_navis_05 approved true 8 $slicecred1
     677  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     678
     679  $fcavs $slicename1 $rspec_port_groups_navis_09 pending false 0 $slicecred1
     680  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     681
     682  $fcavs $slicename1 $rspec_port_groups_navis_11 pending false 0 $slicecred1
     683  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     684
     685  ## Exclusive VLANs
     686
     687  $fcavs $slicename1 $rspec_vlan_5_ethertype_3172 approved true 1 $slicecred1
     688  $fcavs $slicename2 $rspec_ethertype_3173_and_3172_and_3171 approved true 3 $slicecred2
     689  $fcavs $slicename3 $rspec_vlan_6_ethertype_3171 approved true 1 $slicecred3
     690  for slicename in $slicename1 $slicename2 $slicename3 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     691
     692  ## Restricted VLANs
     693
     694  $fcavs $slicename1 $rspec_ethertype_3173_and_vlan_1 pending false 0 $slicecred1
     695  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     696
     697  $fcavs $slicename1 $rspec_ethertype_3173_and_vlan_1_and_5 pending false 0 $slicecred1
     698  for slicename in $slicename1 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     699
     700}
     701}}}
     702
     703==== Four-sliver tests ====
     704
     705{{{
     706### Four-sliver tests
     707#
     708# There are multiple styles of this test; see the comments before each
     709# function for more info.
     710
     711## test_four_slivers_style_1
     712#
     713# There are multiple styles of "the four-sliver test"; see the comments
     714# before each function for more info.
     715#
     716# This one tests various combinations of four slivers (A B C D), assuming
     717# that A and B don't overlap, C overlaps with A, and D overlaps with all
     718# of them.
     719
     720function test_four_slivers_style_1
     721{
     722
     723  ## Variables
     724
     725  rspec_A=$1
     726  rspec_B=$2
     727  rspec_C=$3
     728  rspec_D=$4
     729
     730  rules_A=$5
     731  rules_B=$6
     732  rules_C=$7
     733  rules_D=$8
     734
     735  ## Tests
     736
     737  # ABCD - A and B should be approved, C and D should be pending.
     738
     739  $fcavs $slicename1 $rspec_A approved true $rules_A $slicecred1
     740  $fcavs $slicename2 $rspec_B approved true $rules_B $slicecred2
     741  $fcavs $slicename3 $rspec_C pending false 0 $slicecred3
     742  $fcavs $slicename4 $rspec_D pending false 0 $slicecred4
     743  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     744
     745  # ACBD - A should be approved, C pending, B approved, and D pending.
     746
     747  $fcavs $slicename1 $rspec_A approved true $rules_A $slicecred1
     748  $fcavs $slicename2 $rspec_C pending false 0 $slicecred2
     749  $fcavs $slicename3 $rspec_B approved true $rules_B $slicecred3
     750  $fcavs $slicename4 $rspec_D pending false 0 $slicecred4
     751  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     752
     753  # BACD - B and A should be approved, C and D should be pending.
     754
     755  $fcavs $slicename1 $rspec_B approved true $rules_B $slicecred1
     756  $fcavs $slicename2 $rspec_A approved true $rules_A $slicecred2
     757  $fcavs $slicename3 $rspec_C pending false 0 $slicecred3
     758  $fcavs $slicename4 $rspec_D pending false 0 $slicecred4
     759  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     760
     761  # BCAD - B and C should be approved, A and D should be pending.
     762
     763  $fcavs $slicename1 $rspec_B approved true $rules_B $slicecred1
     764  $fcavs $slicename2 $rspec_C approved true $rules_C $slicecred2
     765  $fcavs $slicename3 $rspec_A pending false 0 $slicecred3
     766  $fcavs $slicename4 $rspec_D pending false 0 $slicecred4
     767  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     768
     769  # CABD - C should be approved, A pending, B approved, and D pending.
     770
     771  $fcavs $slicename1 $rspec_C approved true $rules_C $slicecred1
     772  $fcavs $slicename2 $rspec_A pending false 0 $slicecred2
     773  $fcavs $slicename3 $rspec_B approved true $rules_B $slicecred3
     774  $fcavs $slicename4 $rspec_D pending false 0 $slicecred4
     775  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     776
     777  # CBAD - C and B should be approved, A and D should be pending.
     778
     779  $fcavs $slicename1 $rspec_C approved true $rules_C $slicecred1
     780  $fcavs $slicename2 $rspec_B approved true $rules_B $slicecred2
     781  $fcavs $slicename3 $rspec_A pending false 0 $slicecred3
     782  $fcavs $slicename4 $rspec_D pending false 0 $slicecred4
     783  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     784
     785  # DABC - D should be approved, A and B and C should be pending.
     786
     787  $fcavs $slicename1 $rspec_D approved true $rules_D $slicecred1
     788  $fcavs $slicename2 $rspec_A pending false 0 $slicecred2
     789  $fcavs $slicename3 $rspec_B pending false 0 $slicecred3
     790  $fcavs $slicename4 $rspec_C pending false 0 $slicecred4
     791  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     792
     793  # ADBC - A should be approved, D pending, B approved, and C pending.
     794
     795  $fcavs $slicename4 $rspec_A approved true $rules_A $slicecred4
     796  $fcavs $slicename3 $rspec_D pending false 0 $slicecred3
     797  $fcavs $slicename2 $rspec_B approved true $rules_B $slicecred2
     798  $fcavs $slicename1 $rspec_C pending false 0 $slicecred1
     799  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     800
     801  # ADCB - A should be approved, D pending, C pending, and B approved.
     802
     803  $fcavs $slicename4 $rspec_A approved true $rules_A $slicecred4
     804  $fcavs $slicename3 $rspec_D pending false 0 $slicecred3
     805  $fcavs $slicename2 $rspec_C pending false 0 $slicecred2
     806  $fcavs $slicename1 $rspec_B approved true $rules_B $slicecred1
     807  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     808
     809}
     810
     811## test_four_slivers_style_2
     812#
     813# There are multiple styles of "the four-sliver test"; see the comments
     814# before each function for more info.
     815#
     816# This one tests various combinations of four slivers (A B C D), in which
     817# A, B, and C all overlap, and D doesn't overlap with any of them. Thus,
     818# it tests these six combinations: ABCD BACD CABD DABC DBAC DCAB; those
     819# are sufficient to confirm that the overlap is handled correctly.
     820
     821function test_four_slivers_style_2
     822{
     823
     824  ## Variables
     825
     826  rspec_A=$1
     827  rspec_B=$2
     828  rspec_C=$3
     829  rspec_D=$4
     830
     831  rules_A=$5
     832  rules_B=$6
     833  rules_C=$7
     834  rules_D=$8
     835
     836  ## Tests
     837
     838  # ABCD - A should be approved, B pending, C pending, D approved.
     839
     840  $fcavs $slicename1 $rspec_A approved true $rules_A $slicecred1
     841  $fcavs $slicename2 $rspec_B pending false 0 $slicecred2
     842  $fcavs $slicename3 $rspec_C pending false 0 $slicecred3
     843  $fcavs $slicename4 $rspec_D approved true $rules_D $slicecred4
     844  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     845
     846  # BACD - B should be approved, A pending, C pending, D approved.
     847
     848  $fcavs $slicename1 $rspec_B approved true $rules_B $slicecred1
     849  $fcavs $slicename2 $rspec_A pending false 0 $slicecred2
     850  $fcavs $slicename3 $rspec_C pending false 0 $slicecred3
     851  $fcavs $slicename4 $rspec_D approved true $rules_D $slicecred4
     852  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     853
     854  # CABD - C should be approved, A pending, B pending, D approved.
     855
     856  $fcavs $slicename1 $rspec_C approved true $rules_C $slicecred1
     857  $fcavs $slicename2 $rspec_A pending false 0 $slicecred2
     858  $fcavs $slicename3 $rspec_B pending false 0 $slicecred3
     859  $fcavs $slicename4 $rspec_D approved true $rules_D $slicecred4
     860  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     861
     862  # DABC - D should be approved, A approved, B pending, C pending.
     863
     864  $fcavs $slicename1 $rspec_D approved true $rules_D $slicecred1
     865  $fcavs $slicename2 $rspec_A approved true $rules_A $slicecred2
     866  $fcavs $slicename3 $rspec_B pending false 0 $slicecred3
     867  $fcavs $slicename4 $rspec_C pending false 0 $slicecred4
     868  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     869
     870  # DACB - D should be approved, A approved, C pending, B pending.
     871
     872  $fcavs $slicename1 $rspec_D approved true $rules_D $slicecred1
     873  $fcavs $slicename2 $rspec_B approved true $rules_B $slicecred2
     874  $fcavs $slicename3 $rspec_A pending false 0 $slicecred3
     875  $fcavs $slicename4 $rspec_C pending false 0 $slicecred4
     876  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     877
     878  # DCAB - D should be approved, C approved, A pending, B pending.
     879
     880  $fcavs $slicename1 $rspec_D approved true $rules_D $slicecred1
     881  $fcavs $slicename2 $rspec_C approved true $rules_C $slicecred2
     882  $fcavs $slicename3 $rspec_A pending false 0 $slicecred3
     883  $fcavs $slicename4 $rspec_B pending false 0 $slicecred4
     884  for slicename in $slicename1 $slicename2 $slicename3 $slicename4 ; do omni --slicecredfile=$slicename-cred.xml -a $am deletesliver $slicename ; done
     885
     886}
     887}}}
     888
     889== Cleanup ==
     890
     891Finally, the script does some general cleanup: Right now, it just turns back on admin e-mail for creation, approval, and deletion.
    1097892
    1098893= GENI AM API =