Changes between Initial Version and Version 1 of OpenFlow/FOAM/Testing


Ignore:
Timestamp:
03/07/12 14:54:59 (12 years ago)
Author:
Josh Smift
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OpenFlow/FOAM/Testing

    v1 v1  
     1[[PageOutline]]
     2
     3= Testing FOAM =
     4
     5This page describes a couple of ways to test FOAM:
     6
     7 * Testing that the software complies with the GENI AM API, using the test suite that comes with GCF.
     8 * Testing that slivers can be created, and then managed in various ways, including:
     9   * Simple tests that slivers appear and disappear in FlowVisor.
     10   * More complex tests for other sliver management operations.
     11   * Tests for sliver expiration.
     12
     13= GENI AM API =
     14
     15This tests whether a given FOAM server is compliant with the GENI AM API, using Omni's built-in acceptance test suite.
     16
     17Pre-requisites/assumptions:
     18
     19 * You're set up to use Omni in general, 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).
     20 * You have four rspec files needed to test with (three valid request rspecs, and one valid manifest rspec). We plan to make some sample rspecs available.
     21
     22You can run these tests wherever you usually use Omni; they don't need to run on the FOAM/FV server.
     23
     24As of this writing, the current version of GCF is 1.6.1; some of these steps may need to be different if you have a more recent version than that.
     25
     26Note that this is a streamlined summary of the full docs for running the GCF GENI AM API Acceptance Test Suite. The full docs for that suite are in .../gcf-1.6.1/acceptance_tests/AM_API/README-accept-AMAPI.txt.
     27
     28== Setup ==
     29
     30Set the FOAM server name (modify this to use the DNS name of the server that you want to test):
     31
     32{{{
     33foamserver=foam.example.edu
     34}}}
     35
     36Set the AM API URL:
     37
     38{{{
     39am=https://${foamserver}:3626/foam/gapi/1
     40}}}
     41
     42Identify the rspecs you plan to use (modify this to use your actual rspecs):
     43
     44{{{
     45rspec_request1=~/rspecs/request/misc/openflow-any-acedcodefood.rspec
     46rspec_request2=~/rspecs/request/misc/openflow-any-cafebeefface.rspec
     47rspec_request3=~/rspecs/request/misc/openflow-any-deadbeadfeed.rspec
     48rspec_manifest1=~/rspecs/manifest/jbs-gpolab-cafebeefface.rspec
     49}}}
     50
     51== Run the tests ==
     52
     53If you don't already have the latest version of Omni, you can get it from http://www.gpolab.bbn.com/local-sw/.
     54
     55The rest of these docs assume that you have GCF 1.6.1 in ~/src/gcf-1.6.1.
     56
     57Change into that directory, and copy in your rspec files:
     58
     59{{{
     60cd ~/src/gcf-1.6.1/acceptance_tests/AM_API
     61cp $rspec_request1 request1.xml
     62cp $rspec_request3 request2.xml
     63cp $rspec_request2 request3.xml
     64cp $rspec_manifest1 bad.xml
     65cp request1.xml request.xml
     66}}}
     67
     68Set your Python path, and run the tests:
     69
     70{{{
     71export PYTHONPATH=~/src/gcf-1.6.1/acceptance_tests/AM_API
     72./am_api_accept.py -a $am
     73}}}
     74
     75If you'd like more verbose details about what tests it's running, you can add '--v'.
     76
     77When not in verbose mode, this will run for a few minutes, and should produce output like
     78
     79{{{
     80.............
     81----------------------------------------------------------------------
     82Ran 13 tests in 202.744s
     83
     84OK
     85}}}
     86
     87This may generate e-mail with harmless "slice is busy" errors to the admins of the Slice Authority that you're using; this can happen if something tries to use a slice too quickly after it's been created. Omni should re-try in those circumstances, and you won't see any errors yourself (unless you happen to be an admin for the Slice Authority you're using).
     88
     89Any other errors or failures are unexpected and should be investigated.
     90
     91The test suite should also generate sixteen e-mail messages to the experimenter and sixteen to the FOAM admin. There should be a "sliver created" message, two "sliver renewed" messages, and a "sliver deleted" message, for each of four slices; the slices have names like accjbs, accjbs0, accjbs1, and accjbs2, replacing 'jbs' with your Unix username on the system where you're running the tests.
     92
     93= Sliver creation and management =
     94
     95This set of tests includes a Setup section to set some variables, a Creation section to create a sliver, and then additional sections to do various tests with it.
     96
     97You only need to do the Setup section once.
     98
     99You need to repeat the Creation section before doing any of the other sections, because the Creation section sets some variables that you'll need for the other sections, and each of the other sections concludes by deleting the sliver.
     100
     101Pre-requisites/assumptions:
     102
     103 * 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).
     104 * You have a valid request rspec file to test with. We plan to make some sample rspecs available.
     105 * 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 (/opt/foam/etc/passwd and /etc/flowvisor/fvpasswd). (This generally can't be used as-is to test FOAM at other sites.)
     106 * You know what output to expect when common things succeed. (Expected output is described here only in cases where an error is the expected result, or where it otherwise might not be obvious; if you think the expected output isn't obvious for any given step, let us know.)
     107 * 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.)
     108 * On the FOAM server you're testing, when you create a sliver, it's marked as Pending, and isn't automatically approved.
     109
     110You can run most of these tests wherever you usually use Omni; they don't need to run on the FOAM/FV server, except as noted below.
     111
     112== Setup ==
     113
     114Set the FOAM server name (modify this to use the DNS name of the server that you want to test):
     115
     116{{{
     117foamserver=foam.example.edu
     118}}}
     119
     120Set the name of the FlowVisor server to be the same (if it's the same, or something else if it isn't):
     121
     122{{{
     123fvserver=$foamserver
     124}}}
     125
     126Set the AM API URL:
     127
     128{{{
     129am=https://${foamserver}:3626/foam/gapi/1
     130}}}
     131
     132Identify the rspec you plan to use (modify this if you want to use a different rspec):
     133
     134{{{
     135rspec=~/rspecs/request/misc/openflow-any-acedcodefood.rspec
     136}}}
     137
     138Set the slicename to something with your username and "foamtest":
     139
     140{{{
     141slicename=${USER}foamtest
     142}}}
     143
     144Set the full slice URN (modify this if you're not using pgeni.gpolab.bbn.com as your Slice Authority), and a version of it for handing off to egrep later:
     145
     146{{{
     147slice_urn=urn:publicid:IDN+pgeni.gpolab.bbn.com+slice+$slicename
     148slice_urn_egrep=$(echo $slice_urn | sed -e 's/+/\\+'/g)
     149}}}
     150
     151Make sure FOAM is listening at all:
     152
     153{{{
     154omni -a $am getversion
     155omni -a $am listresources
     156}}}
     157
     158Now you're ready to create a sliver.
     159
     160== Creation ==
     161
     162Create a slice:
     163
     164{{{
     165omni createslice $slicename
     166}}}
     167
     168Create a sliver:
     169
     170{{{
     171omni -a $am createsliver $slicename $rspec
     172}}}
     173
     174(That should generate a "sliver created" e-mail message, one to the experimenter and one to the FOAM admin.)
     175
     176Confirm that it looks right via Omni:
     177
     178{{{
     179omni -a $am listresources $slicename
     180omni -a $am sliverstatus $slicename
     181}}}
     182
     183Confirm that it shows up in FOAM:
     184
     185{{{
     186ssh $foamserver foamctl list-slivers --passwd-file=/opt/foam/etc/foampasswd | egrep slice_urn.+$slice_urn_egrep
     187}}}
     188
     189Get the sliver URN and FlowVisor slicename from FOAM, and put them into $sliver_urn and $fv_slicename:
     190
     191{{{
     192sliver_urn=$(ssh $foamserver foamctl list-slivers --passwd-file=/opt/foam/etc/foampasswd | egrep sliver_urn.+$slice_urn_egrep | sed -e 's/ *"sliver_urn": "\(.*\)".*/\1/')
     193fv_slicename=$(echo $sliver_urn | awk -F : '{print $NF}')
     194}}}
     195
     196Now you're ready to do additional tests with this sliver.
     197
     198== Simple management ==
     199
     200NOTE: Do the [wiki:OpenFlow/FOAM/Testing#Creation Creation] section immediately before starting this section.
     201
     202The steps in this section look at a newly-created sliver, approve it, confirm that it shows up in the FlowVisor, delete it, and confirm that it vanishes from the FlowVisor.
     203
     204Show the sliver, and confirm that 'status' is "Pending":
     205
     206{{{
     207ssh $foamserver foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     208}}}
     209
     210Confirm that the sliver doesn't yet show up in FlowVisor:
     211
     212{{{
     213ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     214}}}
     215
     216(Expect a "slice does not exist" error.)
     217
     218Show the sliver's rspec:
     219
     220{{{
     221ssh $foamserver foamctl show-sliver -r -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     222}}}
     223
     224Show the sliver's flowspec:
     225
     226{{{
     227ssh $foamserver foamctl show-sliver -s -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     228}}}
     229
     230Show the sliver's flowspace rules:
     231
     232{{{
     233ssh $foamserver foamctl show-sliver -f -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     234}}}
     235
     236Approve the sliver, and confirm that 'status' is now "Approved":
     237
     238{{{
     239ssh $foamserver foamctl approve-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     240ssh $foamserver foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     241}}}
     242
     243(That should generate a "sliver approved" e-mail message, one to the experimenter and one to the FOAM admin.)
     244
     245Confirm that the sliver now shows up in FlowVisor, with two flowspace rules:
     246
     247{{{
     248ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     249ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     250}}}
     251
     252(Don't worry about the ouptut saying that it can't connect to the controller; this is expected if your rspec didn't include a controller that's actually running, which the example one doesn't.)
     253
     254Delete the sliver:
     255
     256{{{
     257omni -a $am deletesliver $slicename
     258}}}
     259
     260(That should generate a "sliver deleted" e-mail message, one to the experimenter and one to the FOAM admin.)
     261
     262Confirm that Omni thinks it's gone:
     263
     264{{{
     265omni -a $am listresources $slicename
     266omni -a $am sliverstatus $slicename
     267}}}
     268
     269(Expect an "unknown slice" error for each of those.)
     270
     271Confirm that the sliver no longer shows up in FOAM:
     272
     273{{{
     274ssh $foamserver foamctl list-slivers --passwd-file=/opt/foam/etc/foampasswd | grep $slice_urn
     275ssh $foamserver foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     276}}}
     277
     278(Expect no output for the first, and 'deleted' to be "True" for the second; note that 'status' will still be "Approved", which is fine, it's just tracking what the status was when it was deleted.)
     279
     280Confirm that the sliver no longer shows up in FlowVisor:
     281
     282{{{
     283ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     284ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     285}}}
     286
     287(Expect a "slice does not exist" error for the first, and no output for the second.)
     288
     289== Complex management ==
     290
     291NOTE: Do the [wiki:OpenFlow/FOAM/Testing#Creation Creation] section immediately before starting this section.
     292
     293The steps in this section look at a newly-created sliver, run through a sequence of approve/disable/reject actions to confirm that it can transition from any of those states to the others, and check the FlowVisor after each change; then delete the sliver, and confirm that it vanishes from the FlowVisor.
     294
     295NOTE: These steps are run directly on the FOAM/FlowVisor server, rather than on your Omni client system. If those aren't the same server, do the 'foamctl' commands on the FOAM server, and the 'fvctl' commands on the FV server.
     296
     297Repeat the setup steps from above, but on the server, so you've got the right variables set there:
     298
     299{{{
     300slicename=${USER}foamtest
     301slice_urn=urn:publicid:IDN+pgeni.gpolab.bbn.com+slice+$slicename
     302slice_urn_egrep=$(echo $slice_urn | sed -e 's/+/\\+'/g)
     303sliver_urn=$(foamctl list-slivers --passwd-file=/opt/foam/etc/foampasswd | egrep sliver_urn.+$slice_urn_egrep | sed -e 's/ *"sliver_urn": "\(.*\)".*/\1/')
     304fv_slicename=$(echo $sliver_urn | awk -F : '{print $NF}')
     305}}}
     306
     307Show the sliver, and confirm that 'status' is "Pending":
     308
     309{{{
     310foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     311}}}
     312
     313Confirm that the sliver doesn't yet show up in FlowVisor:
     314
     315{{{
     316fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     317}}}
     318
     319(Expect a "slice does not exist" error; and likewise every time you do a "confirm that the sliver doesn't show up in FlowVisor" step below.)
     320
     321Add a temporary cron job to tell FOAM to generate e-mail with a list of pending slivers:
     322
     323{{{
     324sudo sh -c "echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/daily-queue ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest"
     325}}}
     326
     327(Within a minute (when the cron job fires), that should generate e-mail to the FOAM admin with a list of pending slivers, including your test sliver; and a message to gpo-ops saying that the cron job ran.)
     328
     329Approve the sliver, confirm that 'status' is now "Approved", and confirm that the sliver now shows up in FlowVisor, with two flowspace rules:
     330
     331{{{
     332foamctl approve-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     333foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     334fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     335fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     336}}}
     337
     338(Don't worry about the ouptut saying that it can't connect to the controller; this is expected if your rspec didn't include a controller that's actually running, which the example one doesn't. Likewise every time you confirm that the sliver shows up in Flowvisor below.)
     339
     340(That should generate a "sliver approved" e-mail message, one to the experimenter and one to the FOAM admin.)
     341
     342Add a temporary cron job to tell FOAM to generate e-mail with a list of pending slivers:
     343
     344{{{
     345sudo sh -c "echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/daily-queue ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest"
     346}}}
     347
     348(Within a minute (when the cron job fires), either (a) if there were other slivers in the previous mail, that should generate a message to the FOAM admin listing only those slivers, and not your test sliver, or otherwise (b) not send any message to the FOAM admin; and a message to gpo-ops saying that the cron job ran.)
     349
     350Clean up the cron job:
     351
     352{{{
     353sudo rm /etc/cron.d/foamtest
     354}}}
     355
     356This next set of tests will generate a bunch of e-mail; check at the end that it all showed up as expected.
     357
     358Disable the sliver, confirm that 'status' is now "Pending", and confirm that the sliver now does not show up in FlowVisor, and has no flowspace rules:
     359
     360{{{
     361foamctl disable-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     362foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     363fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     364fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     365}}}
     366
     367Reject the sliver, confirm that 'status' is now "Rejected", and confirm that the sliver now does not show up in FlowVisor, and has no flowspace rules:
     368
     369{{{
     370foamctl reject-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     371foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     372fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     373fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     374}}}
     375
     376Approve the sliver, confirm that 'status' is now "Approved", and confirm that the sliver now shows up in FlowVisor, with two flowspace rules:
     377
     378{{{
     379foamctl approve-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     380foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     381fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     382fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     383}}}
     384
     385Reject the sliver, confirm that 'status' is now "Rejected", and confirm that the sliver now does not show up in FlowVisor, and has no flowspace rules:
     386
     387{{{
     388foamctl reject-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     389foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     390fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     391fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     392}}}
     393
     394Disable the sliver, confirm that 'status' is now "Pending", and confirm that the sliver now does not show up in FlowVisor, and has no flowspace rules:
     395
     396{{{
     397foamctl disable-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     398foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     399fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     400fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     401}}}
     402
     403Approve the sliver, confirm that 'status' is now "Approved", and confirm that the sliver now shows up in FlowVisor, with two flowspace rules:
     404
     405{{{
     406foamctl approve-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     407foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     408fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     409fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     410}}}
     411
     412Delete the sliver, confirm that 'deleted' is now "True", and confirm that the sliver now does not show up in FlowVisor, and has no flowspace rules:
     413
     414{{{
     415foamctl delete-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     416foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     417fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     418fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     419}}}
     420
     421That set of tests should generate seven e-mail messages to the experimenter and seven to the FOAM admin: There should be a "sliver disabled" message, then "sliver rejected", then approved, rejected, disabled, approved, and deleted. Probably in that order, although e-mail is sometimes delivered out of sequence, so don't worry too much if they're not in order.
     422
     423== Expiration ==
     424
     425NOTE: Do the [wiki:OpenFlow/FOAM/Testing#Creation Creation] section immediately before starting this section.
     426
     427The steps in this section look at a newly-created sliver, and test expiration in FOAM, by changing its expiration date and, then running the scripts that expire slivers and notify about soon-to-expire ones.
     428
     429First, review and approve the sliver.
     430
     431Show the sliver, and confirm that 'status' is "Pending":
     432
     433{{{
     434ssh $foamserver foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     435}}}
     436
     437Confirm that the sliver doesn't yet show up in FlowVisor:
     438
     439{{{
     440ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     441}}}
     442
     443(Expect a "slice does not exist" error.)
     444
     445Show the sliver's rspec:
     446
     447{{{
     448ssh $foamserver foamctl show-sliver -r -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     449}}}
     450
     451Show the sliver's flowspec:
     452
     453{{{
     454ssh $foamserver foamctl show-sliver -s -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     455}}}
     456
     457Show the sliver's flowspace rules:
     458
     459{{{
     460ssh $foamserver foamctl show-sliver -f -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     461}}}
     462
     463Approve the sliver, and confirm that 'status' is now "Approved":
     464
     465{{{
     466ssh $foamserver foamctl approve-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     467ssh $foamserver foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     468}}}
     469
     470(That should generate a "sliver approved" e-mail message, one to the experimenter and one to the FOAM admin.)
     471
     472Confirm that the sliver now shows up in FlowVisor, with two flowspace rules:
     473
     474{{{
     475ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     476ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     477}}}
     478
     479(Don't worry about the ouptut saying that it can't connect to the controller; this is expected if your rspec didn't include a controller that's actually running, which the example one doesn't.)
     480
     481Now, do some tests to make sure FOAM notifies you about a sliver that will expire within a day, but only once.
     482
     483Change the expiration date of your slice to be nine days away, since otherwise you can't extend the sliver expiration date very far:
     484
     485{{{
     486omni renewslice $slicename "$(date -d 'now + 9 days')" -f gpolab
     487}}}
     488
     489Change the expiration date of your sliver to be twelve hours away, and confirm that the sliver has the new expiration date:
     490
     491{{{
     492omni -a $am renewsliver $slicename "$(date -d 'now + 12 hours')"
     493omni -a $am sliverstatus $slicename
     494}}}
     495
     496(That should generate a "sliver renewed" e-mail message, one to the experimenter and one to the FOAM admin.)
     497
     498Add a temporary cron job to tell FOAM to send mail about slivers that are expiring soon and remove any expired slivers:
     499
     500{{{
     501ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     502}}}
     503
     504(Within a minute (when the cron job fires), that should generate a "sliver expiring shortly" e-mail message, one to the experimenter and one to the FOAM admin; no messages about expired slivers being deleted; and one message to gpo-ops saying that the cron job ran.)
     505
     506Add the cron job again, to confirm that it doesn't send a second notification:
     507
     508{{{
     509ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     510}}}
     511
     512(Within a minute (when the cron job fires), that should generate no messages about slivers expiring in the future; no messages about expired slivers being deleted; and one message to gpo-ops saying that the cron job ran.)
     513
     514Next, test to make sure FOAM notifies you again if you change the expiration date.
     515
     516Change the expiration date of your sliver to be one day away, and confirm that the sliver has the new expiration date:
     517
     518{{{
     519omni -a $am renewsliver $slicename "$(date -d 'now + 1 day')"
     520omni -a $am sliverstatus $slicename
     521}}}
     522
     523(That should generate a "sliver renewed" e-mail message, one to the experimenter and one to the FOAM admin.)
     524
     525Add the cron job again, to confirm that it does notify you again now that the expiration date has changed:
     526
     527{{{
     528ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     529}}}
     530
     531(Within a minute (when the cron job fires), that should generate a "sliver expiring shortly" e-mail message, one to the experimenter and one to the FOAM admin; no messages about expired slivers being deleted; and one message to gpo-ops saying that the cron job ran.)
     532
     533Next, do some tests to make sure that FOAM notifies you about a sliver that will expire within a week, but only once.
     534
     535Change the expiration date of your sliver to be two days away, and confirm that the sliver has the new expiration date:
     536
     537{{{
     538omni -a $am renewsliver $slicename "$(date -d 'now + 2 days')"
     539omni -a $am sliverstatus $slicename
     540}}}
     541
     542(That should generate a "sliver renewed" e-mail message, one to the experimenter and one to the FOAM admin.)
     543
     544Add the cron job again, to confirm that it now sends a "within a week" message:
     545
     546{{{
     547ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     548}}}
     549
     550(Within a minute (when the cron job fires), that should generate a "sliver expiring soon" e-mail message, one to the experimenter and one to the FOAM admin; no messages about expired slivers being deleted; and one message to gpo-ops saying that the cron job ran.)
     551
     552Add the cron job again, to confirm that it doesn't send a second notification:
     553
     554{{{
     555ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     556}}}
     557
     558(Within a minute (when the cron job fires), that should generate no messages about slivers expiring in the future; no messages about expired slivers being deleted; and one message to gpo-ops saying that the cron job ran.)
     559
     560Next, test to make sure FOAM doesn't notify you at all if your sliver is expiring more than a week from now.
     561
     562Change the expiration date of your sliver to be eight days away, and confirm that the sliver has the new expiration date:
     563
     564{{{
     565omni -a $am renewsliver $slicename "$(date -d 'now + 8 days')"
     566omni -a $am sliverstatus $slicename
     567}}}
     568
     569(That should generate a "sliver renewed" e-mail message, one to the experimenter and one to the FOAM admin.)
     570
     571Add the cron job again, to confirm that it doesn't send a notification:
     572
     573{{{
     574ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     575}}}
     576
     577(Within a minute (when the cron job fires), that should generate no messages about slivers expiring in the future; no messages about expired slivers being deleted; and one message to gpo-ops saying that the cron job ran.)
     578
     579Finally, test to make sure FOAM deletes a sliver if its expiration date is in the past.
     580
     581Change the expiration date of your sliver to be right now, and confirm that the sliver has the new expiration date:
     582
     583{{{
     584omni -a $am renewsliver $slicename "$(date -d 'now')"
     585omni -a $am sliverstatus $slicename
     586}}}
     587
     588(That should generate a "sliver renewed" e-mail message, one to the experimenter and one to the FOAM admin.)
     589
     590Add the cron job again, to confirm that it deletes the sliver:
     591
     592{{{
     593ssh -t $foamserver "sudo sh -c \"echo $(date +'%M %H' -d 'now + 1 min') '* * *  www-data  /opt/foam/bin/expire ; /opt/foam/bin/expire-emails ; echo foamtest cron job ran at $(date)' > /etc/cron.d/foamtest\""
     594}}}
     595
     596(Within a minute (when the cron job fires), that should generate a "sliver expiring shortly" e-mail message, one to the experimenter and one to the FOAM admin; a "sliver expired" message, one to the experimenter and one to the FOAM admin; and one message to gpo-ops saying that the cron job ran.)
     597
     598Confirm that the sliver no longer shows up in FOAM:
     599
     600{{{
     601ssh $foamserver foamctl list-slivers --passwd-file=/opt/foam/etc/foampasswd | grep $slice_urn
     602ssh $foamserver foamctl show-sliver -u $sliver_urn --passwd-file=/opt/foam/etc/foampasswd
     603}}}
     604
     605(Expect no output for the first, and 'deleted' to be "True" for the second.)
     606
     607Confirm that the sliver no longer shows up in FlowVisor:
     608
     609{{{
     610ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd getSliceInfo $fv_slicename
     611ssh $fvserver fvctl --passwd-file=/etc/flowvisor/fvpasswd listFlowSpace | grep $fv_slicename
     612}}}
     613
     614(Expect a "slice does not exist" error for the first, and no output for the second.)
     615
     616Clean up the last cron job:
     617
     618{{{
     619ssh -t $foamserver sudo rm /etc/cron.d/foamtest
     620}}}