class OpenStackPublicKey(mixin.Mixin): scheme = helpers.build_scheme("instance/credentials") term = "public_key" def __init__(self, name=None, data=None): attrs = [ attribute.InmutableAttribute( "org.openstack.credentials.publickey.name", name), attribute.InmutableAttribute( "org.openstack.credentials.publickey.data", data), ] attrs = attribute.AttributeCollection({a.name: a for a in attrs}) super(OpenStackPublicKey, self).__init__(OpenStackPublicKey.scheme, OpenStackPublicKey.term, "Contextualization extension - public_key", attributes=attrs) @property def name(self): attr = "org.openstack.credentials.publickey.name" return self.attributes[attr].value @property def data(self): attr = "org.openstack.credentials.publickey.data" return self.attributes[attr].value
class OpenStackOSTemplate(mixin.Mixin): scheme = helpers.build_scheme("template/os") def __init__(self, uuid, name): super(OpenStackOSTemplate, self).__init__(OpenStackOSTemplate.scheme, uuid, name, related=[templates.os_tpl])
class OpenStackOSTemplate(templates.OCCIOSTemplate): scheme = helpers.build_scheme("template/os") def __init__(self, uuid, name): location = "%s/%s" % (self._location, uuid) super(OpenStackOSTemplate, self).__init__(uuid, name, depends=[templates.os_tpl], location=location)
def __init__(self, pool=None, depends=[]): location = "floatingippool/%s" % pool if pool else "floatingippool/" sch = "network/floatingippool" if pool else "network" scheme = helpers.build_scheme(sch) term = pool if pool else "floatingippool" title = pool if pool else "Floating IP pool base mixin" super(OSFloatingIPPoolBase, self).__init__( scheme, term, title, location=location, depends=depends, applies=[network_link.NetworkInterface.kind])
class OSNetwork(mixin.Mixin): scheme = helpers.build_scheme("infrastructure/network") def __init__(self, pool=None): term = "osnetwork" title = "openstack network" super(OSNetwork, self).__init__(scheme=self.scheme, term=term, title=title, attributes=attr.AttributeCollection( ["org.openstack.network.ip_version"]))
class OpenStackResourceTemplate(templates.OCCIResourceTemplate): scheme = helpers.build_scheme("template/resource") def __init__(self, id, name, cores, memory, disk, ephemeral=0, swap=0): attrs = [ attribute.InmutableAttribute("occi.compute.cores", cores), attribute.InmutableAttribute("occi.compute.memory", memory), attribute.InmutableAttribute("occi.compute.disk", disk), attribute.InmutableAttribute("occi.compute.ephemeral", ephemeral), attribute.InmutableAttribute("occi.compute.swap", swap), attribute.InmutableAttribute("org.openstack.flavor.name", name) ] attrs = attribute.AttributeCollection({a.name: a for a in attrs}) location = "%s/%s" % (self._location, id) super(OpenStackResourceTemplate, self).__init__(id, "Flavor: %s" % name, related=[templates.resource_tpl], attributes=attrs, location=location) @property def cores(self): return self.attributes["occi.compute.cores"].value @property def memory(self): return self.attributes["occi.compute.memory"].value @property def disk(self): return self.attributes["occi.compute.disk"].value @property def ephemeral(self): return self.attributes["occi.compute.ephemeral"].value @property def swap(self): return self.attributes["occi.compute.swap"].value @property def name(self): return self.attributes["org.openstack.flavor.name"].value
class OpenStackUserData(mixin.Mixin): scheme = helpers.build_scheme("compute/instance") term = "user_data" def __init__(self, user_data=None): attrs = [ attribute.InmutableAttribute("org.openstack.compute.user_data", user_data), ] attrs = attribute.AttributeCollection({a.name: a for a in attrs}) super(OpenStackUserData, self).__init__(OpenStackUserData.scheme, OpenStackUserData.term, "Contextualization extension - user_data", attributes=attrs) @property def user_data(self): return self.attributes["org.openstack.compute.user_data"].value
self.attributes["org.openstack.network.ip_version"].value = value @property def address(self): return self.attributes["occi.network.address"].value @address.setter def address(self, value): self.attributes["occi.network.address"].value = value @property def gateway(self): return self.attributes["occi.network.gateway"].value @gateway.setter def gateway(self, value): self.attributes["occi.network.gateway"].value = value @property def allocation(self): return self.attributes["occi.network.allocation"].value @allocation.setter def allocation(self, value): self.attributes["occi.network.allocation"].value = value neutron_network = mixin.Mixin(helpers.build_scheme("infrastructure/network"), "neutron", "Network component", )
class OSFloatingIPPool(mixin.Mixin): scheme = helpers.build_scheme("network/floatingippool") def __init__(self, pool=None): super(OSFloatingIPPool, self).__init__(self.scheme, pool, pool)
@property def address(self): return self.attributes["occi.network.address"].value @address.setter def address(self, value): self.attributes["occi.network.address"].value = value @property def gateway(self): return self.attributes["occi.network.gateway"].value @gateway.setter def gateway(self, value): self.attributes["occi.network.gateway"].value = value @property def allocation(self): return self.attributes["occi.network.allocation"].value @allocation.setter def allocation(self, value): self.attributes["occi.network.allocation"].value = value neutron_network = mixin.Mixin( helpers.build_scheme("infrastructure/network"), "neutron", "Network component", )
self.attributes["org.openstack.network.ip_version"].value = value @property def address(self): return self.attributes["occi.network.address"].value @address.setter def address(self, value): self.attributes["occi.network.address"].value = value @property def gateway(self): return self.attributes["occi.network.gateway"].value @gateway.setter def gateway(self, value): self.attributes["occi.network.gateway"].value = value @property def allocation(self): return self.attributes["occi.network.allocation"].value @allocation.setter def allocation(self, value): self.attributes["occi.network.allocation"].value = value neutron_network = mixin.Mixin(helpers.build_scheme("infrastructure/network"), "neutron", "Network component", )