Scott Baker | ab23fa9 | 2013-08-25 16:53:49 -0700 | [diff] [blame] | 1 | """ |
| 2 | Basic Sliver Test |
| 3 | |
| 4 | 1) Create a slice1 |
| 5 | 2) Create sliver1 on slice1 |
| 6 | """ |
| 7 | |
| 8 | import os |
| 9 | import json |
| 10 | import sys |
| 11 | import time |
| 12 | |
Scott Baker | eaeabad | 2015-02-09 11:18:46 -0800 | [diff] [blame] | 13 | sys.path.append("/opt/xos") |
Scott Baker | ab23fa9 | 2013-08-25 16:53:49 -0700 | [diff] [blame] | 14 | |
| 15 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings") |
| 16 | from openstack.manager import OpenStackManager |
| 17 | from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice |
| 18 | |
| 19 | from planetstacktest import PlanetStackTest, fail_unless |
| 20 | |
| 21 | class SliverTest(PlanetStackTest): |
| 22 | def __init__(self): |
| 23 | PlanetStackTest.__init__(self) |
| 24 | |
| 25 | def run_sliver1(self): |
| 26 | slice1Name = self.make_slice_name() |
| 27 | slice1 = Slice(name = slice1Name, |
| 28 | omf_friendly=True, |
| 29 | site=self.testSite, |
| 30 | creator=self.testUser) |
| 31 | slice1=self.save_and_wait_for_enacted(slice1, nonempty_fields=["tenant_id"]) |
| 32 | |
| 33 | sliver1 = Sliver(image = self.testImage, |
| 34 | creator=self.testUser, |
| 35 | slice=slice1, |
| 36 | node=self.testNode, |
| 37 | deploymentNetwork=self.testDeployment) |
| 38 | sliver1=self.save_and_wait_for_enacted(sliver1, nonempty_fields=["instance_id", "ip"]) |
| 39 | |
| 40 | def run(self): |
| 41 | self.setup() |
| 42 | try: |
| 43 | self.run_sliver1() |
| 44 | finally: |
| 45 | self.cleanup() |
| 46 | |
| 47 | def main(): |
| 48 | SliverTest().run() |
| 49 | |
| 50 | if __name__=="__main__": |
| 51 | main() |