| |
| # Copyright 2017-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # This file is intended to be pasted as input into an `xossh` session. |
| |
| # Creates a TrustDomain, Principal, Slice, Image (if it does not exist), and |
| # then brings up an openstack VM attached to the management network. |
| |
| t=TrustDomain(owner=OpenStackService.objects.first(), name="demo-trust") |
| t.save() |
| |
| p=Principal(trust_domain=t, name="demo-user") |
| p.save() |
| |
| s=Slice(trust_domain=t, name="demo-slice", site=Site.objects.first()) |
| s.save() |
| |
| ns=NetworkSlice(slice=s, network=Network.objects.get(name="management")) |
| ns.save() |
| |
| img=Image.objects.filter(name="cirros-0.3.5") |
| if img: |
| img=img[0] |
| else: |
| 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") |
| img.save() |
| |
| i=OpenStackServiceInstance(slice=s, image=img, name="demo-instance", owner=OpenStackService.objects.first(), flavor=Flavor.objects.get(name="m1.medium"), node=Node.objects.first()) |
| i.save() |