blob: ee3b601734d54f6a7653a6365959134651bcb32a [file] [log] [blame]
Scott Baker62c7eaf2018-05-22 15:59:26 -07001
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
21t=TrustDomain(owner=OpenStackService.objects.first(), name="demo-trust")
22t.save()
23
24p=Principal(trust_domain=t, name="demo-user")
25p.save()
26
27s=Slice(trust_domain=t, name="demo-slice", site=Site.objects.first())
28s.save()
29
30ns=NetworkSlice(slice=s, network=Network.objects.get(name="management"))
31ns.save()
32
33img=Image.objects.filter(name="cirros-0.3.5")
34if img:
35 img=img[0]
36else:
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
40i=OpenStackServiceInstance(slice=s, image=img, name="demo-instance", owner=OpenStackService.objects.first(), flavor=Flavor.objects.get(name="m1.medium"), node=Node.objects.first())
41i.save()