Scott Baker | 62c7eaf | 2018-05-22 15:59:26 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | # This file is intended to be pasted as input into an `xossh` session. |
| 17 | |
| 18 | # Creates a TrustDomain, Principal, Slice, Image (if it does not exist), and |
| 19 | # then brings up an openstack VM attached to the management network. |
| 20 | |
| 21 | t=TrustDomain(owner=OpenStackService.objects.first(), name="demo-trust") |
| 22 | t.save() |
| 23 | |
| 24 | p=Principal(trust_domain=t, name="demo-user") |
| 25 | p.save() |
| 26 | |
| 27 | s=Slice(trust_domain=t, name="demo-slice", site=Site.objects.first()) |
| 28 | s.save() |
| 29 | |
| 30 | ns=NetworkSlice(slice=s, network=Network.objects.get(name="management")) |
| 31 | ns.save() |
| 32 | |
| 33 | img=Image.objects.filter(name="cirros-0.3.5") |
| 34 | if img: |
| 35 | img=img[0] |
| 36 | else: |
| 37 | img=Image(name="cirros-0.3.5", container_format="BARE", disk_format="QCOW2", path="http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img") |
| 38 | img.save() |
| 39 | |
| 40 | i=OpenStackServiceInstance(slice=s, image=img, name="demo-instance", owner=OpenStackService.objects.first(), flavor=Flavor.objects.get(name="m1.medium"), node=Node.objects.first()) |
| 41 | i.save() |