Add missing location to mixins

Change-Id: I25d3a2ae81c42f24d98ed2536e3dd0acb06b96e3
Closes-Bug: 1687933
This commit is contained in:
Enol Fernandez 2017-08-23 07:49:09 +01:00
parent 8f3a0de485
commit 3647b2bbf0
9 changed files with 37 additions and 13 deletions

View File

@ -36,6 +36,7 @@ class SSHKey(mixin.Mixin):
super(SSHKey, self).__init__(SSHKey.scheme, SSHKey.term, super(SSHKey, self).__init__(SSHKey.scheme, SSHKey.term,
"Credentials mixin", "Credentials mixin",
attributes=attrs, attributes=attrs,
location="ssh_key/",
applies=[compute.ComputeResource.kind]) applies=[compute.ComputeResource.kind])
@property @property
@ -69,6 +70,7 @@ class UserData(mixin.Mixin):
UserData.term, UserData.term,
"Contextualization mixin", "Contextualization mixin",
attributes=attrs, attributes=attrs,
location="user_data/",
applies=[compute.ComputeResource.kind]) applies=[compute.ComputeResource.kind])
@property @property

View File

@ -91,6 +91,7 @@ class NetworkResource(resource.Resource):
ip_network = mixin.Mixin( ip_network = mixin.Mixin(
helpers.build_scheme("infrastructure/network"), helpers.build_scheme("infrastructure/network"),
"ipnetwork", "IP Networking Mixin", "ipnetwork", "IP Networking Mixin",
location="ipnetwork/",
attributes=attr.AttributeCollection({ attributes=attr.AttributeCollection({
"occi.network.address": attr.MutableAttribute( "occi.network.address": attr.MutableAttribute(
"occi.network.address", "occi.network.address",

View File

@ -88,6 +88,7 @@ class NetworkInterface(link.Link):
ip_network_interface = mixin.Mixin( ip_network_interface = mixin.Mixin(
helpers.build_scheme("infrastructure/networkinterface"), helpers.build_scheme("infrastructure/networkinterface"),
"ipnetworkinterface", "IP Network interface Mixin", "ipnetworkinterface", "IP Network interface Mixin",
location="ipnetworkinterface/",
attributes=attr.AttributeCollection({ attributes=attr.AttributeCollection({
"occi.networkinterface.address": attr.MutableAttribute( "occi.networkinterface.address": attr.MutableAttribute(
"occi.networkinterface.address", "occi.networkinterface.address",

View File

@ -33,6 +33,7 @@ class OpenStackUserData(mixin.Mixin):
super(OpenStackUserData, self).__init__( super(OpenStackUserData, self).__init__(
OpenStackUserData.scheme, OpenStackUserData.term, OpenStackUserData.scheme, OpenStackUserData.term,
"Contextualization extension - user_data", "Contextualization extension - user_data",
location="openstack_user_data/",
attributes=attrs) attributes=attrs)
@property @property
@ -59,6 +60,7 @@ class OpenStackPublicKey(mixin.Mixin):
super(OpenStackPublicKey, self).__init__( super(OpenStackPublicKey, self).__init__(
OpenStackPublicKey.scheme, OpenStackPublicKey.term, OpenStackPublicKey.scheme, OpenStackPublicKey.term,
"Contextualization extension - public_key", "Contextualization extension - public_key",
location="openstack_public_key/",
attributes=attrs) attributes=attrs)
@property @property

View File

@ -24,7 +24,9 @@ class OSFloatingIPPool(mixin.Mixin):
scheme = helpers.build_scheme("network/floatingippool") scheme = helpers.build_scheme("network/floatingippool")
def __init__(self, pool=None): def __init__(self, pool=None):
super(OSFloatingIPPool, self).__init__(self.scheme, pool, pool) location = "floatingippool/%s" % pool
super(OSFloatingIPPool, self).__init__(self.scheme, pool, pool,
location=location)
class OSNetworkInterface(network_link.NetworkInterface): class OSNetworkInterface(network_link.NetworkInterface):
@ -94,6 +96,7 @@ class OSNetwork(mixin.Mixin):
scheme=self.scheme, scheme=self.scheme,
term=term, term=term,
title=title, title=title,
location="osnetwork/",
attributes=attr.AttributeCollection([ attributes=attr.AttributeCollection([
"org.openstack.network.ip_version" "org.openstack.network.ip_version"
]) ])
@ -174,4 +177,4 @@ class OSNetworkResource(network.NetworkResource):
neutron_network = mixin.Mixin(helpers.build_scheme("infrastructure/network"), neutron_network = mixin.Mixin(helpers.build_scheme("infrastructure/network"),
"neutron", "Network component", "neutron", "Network component",
) location="neutron/")

View File

@ -467,7 +467,8 @@ def fake_query_results():
cats.append( cats.append(
'ipnetwork; ' 'ipnetwork; '
'scheme="http://schemas.ogf.org/occi/infrastructure/network#"; ' 'scheme="http://schemas.ogf.org/occi/infrastructure/network#"; '
'class="mixin"; title="IP Networking Mixin"') 'class="mixin"; title="IP Networking Mixin"; '
'location="%s/ipnetwork/"' % application_url)
cats.append( cats.append(
'up; ' 'up; '
'scheme="http://schemas.ogf.org/occi/infrastructure/network/action#"; ' 'scheme="http://schemas.ogf.org/occi/infrastructure/network/action#"; '
@ -486,7 +487,8 @@ def fake_query_results():
'ipnetworkinterface; ' 'ipnetworkinterface; '
'scheme="http://schemas.ogf.org/occi/infrastructure/' 'scheme="http://schemas.ogf.org/occi/infrastructure/'
'networkinterface#"; ' 'networkinterface#"; '
'class="mixin"; title="IP Network interface Mixin"') 'class="mixin"; title="IP Network interface Mixin"; '
'location="%s/ipnetworkinterface/"' % application_url)
cats.append( cats.append(
'ipreservation; ' 'ipreservation; '
'scheme="http://schemas.ogf.org/occi/infrastructure#"; ' 'scheme="http://schemas.ogf.org/occi/infrastructure#"; '
@ -532,21 +534,25 @@ def fake_query_results():
cats.append( cats.append(
'user_data; ' 'user_data; '
'scheme="http://schemas.openstack.org/compute/instance#"; ' 'scheme="http://schemas.openstack.org/compute/instance#"; '
'class="mixin"; title="Contextualization extension - user_data"') 'class="mixin"; title="Contextualization extension - user_data"; '
'location="%s/openstack_user_data/"' % application_url)
cats.append( cats.append(
'public_key; ' 'public_key; '
'scheme="http://schemas.openstack.org/instance/credentials#"; ' 'scheme="http://schemas.openstack.org/instance/credentials#"; '
'class="mixin"; title="Contextualization extension - public_key"') 'class="mixin"; title="Contextualization extension - public_key"; '
'location="%s/openstack_public_key/"' % application_url)
# OCCI contextualization # OCCI contextualization
cats.append( cats.append(
'user_data; ' 'user_data; '
'scheme="http://schemas.ogf.org/occi/infrastructure/compute#"; ' 'scheme="http://schemas.ogf.org/occi/infrastructure/compute#"; '
'class="mixin"; title="Contextualization mixin"') 'class="mixin"; title="Contextualization mixin"; '
'location="%s/user_data/"' % application_url)
cats.append( cats.append(
'ssh_key; ' 'ssh_key; '
'scheme="http://schemas.ogf.org/occi/infrastructure/credentials#"; ' 'scheme="http://schemas.ogf.org/occi/infrastructure/credentials#"; '
'class="mixin"; title="Credentials mixin"') 'class="mixin"; title="Credentials mixin"; '
'location="%s/ssh_key/"' % application_url)
result = [] result = []
for c in cats: for c in cats:

View File

@ -354,11 +354,13 @@ def build_occi_network(network):
cats.append('ipnetwork; ' cats.append('ipnetwork; '
'scheme=' 'scheme='
'"http://schemas.ogf.org/occi/infrastructure/network#";' '"http://schemas.ogf.org/occi/infrastructure/network#";'
' class="mixin"; title="IP Networking Mixin"') ' class="mixin"; title="IP Networking Mixin";'
' location="%s/ipnetwork/"' % app_url)
cats.append('osnetwork; ' cats.append('osnetwork; '
'scheme=' 'scheme='
'"http://schemas.openstack.org/infrastructure/network#";' '"http://schemas.openstack.org/infrastructure/network#";'
' class="mixin"; title="openstack network"') ' class="mixin"; title="openstack network";'
' location="%s/osnetwork/"' % app_url)
links = [] links = []
links.append('<%s/network/%s?action=up>; ' links.append('<%s/network/%s?action=up>; '
@ -407,11 +409,13 @@ def build_occi_nova(network):
cats.append('ipnetwork; ' cats.append('ipnetwork; '
'scheme=' 'scheme='
'"http://schemas.ogf.org/occi/infrastructure/network#";' '"http://schemas.ogf.org/occi/infrastructure/network#";'
' class="mixin"; title="IP Networking Mixin"') ' class="mixin"; title="IP Networking Mixin";'
' location="%s/ipnetwork/"' % app_url)
cats.append('osnetwork; ' cats.append('osnetwork; '
'scheme=' 'scheme='
'"http://schemas.openstack.org/infrastructure/network#";' '"http://schemas.openstack.org/infrastructure/network#";'
' class="mixin"; title="openstack network"') ' class="mixin"; title="openstack network";'
' location="%s/osnetwork/"' % app_url)
links = [] links = []
links.append('<%s/network/%s?action=up>; ' links.append('<%s/network/%s?action=up>; '

View File

@ -357,6 +357,7 @@ class TestOCCIUserData(base.TestCase):
self.assertEqual("user_data", mxn.term) self.assertEqual("user_data", mxn.term)
self.assertEqual(user_data, mxn.user_data) self.assertEqual(user_data, mxn.user_data)
self.assertEqual([compute.ComputeResource.kind], mxn.applies) self.assertEqual([compute.ComputeResource.kind], mxn.applies)
self.assertEqual("user_data/", mxn.location)
class TestOCCISSHKey(base.TestCase): class TestOCCISSHKey(base.TestCase):
@ -366,6 +367,7 @@ class TestOCCISSHKey(base.TestCase):
self.assertEqual("ssh_key", mxn.term) self.assertEqual("ssh_key", mxn.term)
self.assertEqual(key_data, mxn.ssh_key) self.assertEqual(key_data, mxn.ssh_key)
self.assertEqual([compute.ComputeResource.kind], mxn.applies) self.assertEqual([compute.ComputeResource.kind], mxn.applies)
self.assertEqual("ssh_key/", mxn.location)
class TestOCCISecurityGRoup(base.TestCase): class TestOCCISecurityGRoup(base.TestCase):

View File

@ -104,6 +104,7 @@ class TestOpenStackUserData(base.TestCase):
self.assertEqual("user_data", mxn.term) self.assertEqual("user_data", mxn.term)
self.assertTrue(mxn.scheme.startswith(helpers._PREFIX)) self.assertTrue(mxn.scheme.startswith(helpers._PREFIX))
self.assertEqual(user_data, mxn.user_data) self.assertEqual(user_data, mxn.user_data)
self.assertEqual("openstack_user_data/", mxn.location)
class TestOpenStackPublicKey(base.TestCase): class TestOpenStackPublicKey(base.TestCase):
@ -117,6 +118,7 @@ class TestOpenStackPublicKey(base.TestCase):
self.assertTrue(mxn.scheme.startswith(helpers._PREFIX)) self.assertTrue(mxn.scheme.startswith(helpers._PREFIX))
self.assertEqual(key_name, mxn.name) self.assertEqual(key_name, mxn.name)
self.assertEqual(key_data, mxn.data) self.assertEqual(key_data, mxn.data)
self.assertEqual("openstack_public_key/", mxn.location)
class TestOSNetworkInterface(base.TestCase): class TestOSNetworkInterface(base.TestCase):
@ -144,6 +146,7 @@ class TestOSNetworkInterface(base.TestCase):
for m in i.mixins: for m in i.mixins:
if isinstance(m, os_network.OSFloatingIPPool): if isinstance(m, os_network.OSFloatingIPPool):
self.assertEqual("foo", m.term) self.assertEqual("foo", m.term)
self.assertEqual("floatingippool/foo", m.location)
has_pool = True has_pool = True
break break
self.assertTrue(has_pool) self.assertTrue(has_pool)