Added neutron fields to share network resource.
Adds fields to share network resource, enabling the creation of share networks that use neutron networks and neutron subnets. Change-Id: Ie6cace724bcb2084b71942be35bac79f085215d7
This commit is contained in:
parent
aba2b4179c
commit
692b7f39e3
@ -11,6 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from openstack import resource
|
||||
from openstack.shared_file_system.v2 import share_network_subnet
|
||||
|
||||
|
||||
class ShareNetwork(resource.Resource):
|
||||
@ -48,7 +49,17 @@ class ShareNetwork(resource.Resource):
|
||||
project_id = resource.Body("project_id", type=str)
|
||||
#: A list of share network subnets that pertain to the related share
|
||||
#: network.
|
||||
# share_network_subnets = resource.Body("share_network_subnets", type=list)
|
||||
share_network_subnets = resource.Body(
|
||||
"share_network_subnets",
|
||||
type=list,
|
||||
list_type=share_network_subnet.ShareNetworkSubnet,
|
||||
)
|
||||
#: The UUID of a neutron network when setting up or
|
||||
#: updating a share network subnet with neutron.
|
||||
neutron_net_id = resource.Body("neutron_net_id", type=str)
|
||||
#: The UUID of the neutron subnet when setting up or updating
|
||||
#: a share network subnet with neutron.
|
||||
neutron_subnet_id = resource.Body("neutron_subnet_id", type=str)
|
||||
#: The date and time stamp when the resource was last updated within
|
||||
#: the service’s database.
|
||||
updated_at = resource.Body("updated_at", type=str)
|
||||
|
@ -18,10 +18,28 @@ class ShareNetworkTest(base.BaseSharedFileSystemTest):
|
||||
def setUp(self):
|
||||
super(ShareNetworkTest, self).setUp()
|
||||
|
||||
self.NETWORK_NAME = self.getUniqueString()
|
||||
net = self.user_cloud.network.create_network(name=self.NETWORK_NAME)
|
||||
self.assertIsNotNone(net)
|
||||
self.assertIsNotNone(net.id)
|
||||
self.NETWORK_ID = net.id
|
||||
|
||||
self.SUBNET_NAME = self.getUniqueString()
|
||||
subnet = self.user_cloud.network.create_subnet(
|
||||
name=self.SUBNET_NAME,
|
||||
network_id=self.NETWORK_ID,
|
||||
ip_version=4,
|
||||
cidr='10.0.0.0/24',
|
||||
)
|
||||
self.SUBNET_ID = subnet.id
|
||||
|
||||
self.SHARE_NETWORK_NAME = self.getUniqueString()
|
||||
snt = self.user_cloud.shared_file_system.create_share_network(
|
||||
name=self.SHARE_NETWORK_NAME
|
||||
name=self.SHARE_NETWORK_NAME,
|
||||
neutron_net_id=self.NETWORK_ID,
|
||||
neutron_subnet_id=self.SUBNET_ID,
|
||||
)
|
||||
|
||||
self.assertIsNotNone(snt)
|
||||
self.assertIsNotNone(snt.id)
|
||||
self.SHARE_NETWORK_ID = snt.id
|
||||
@ -31,6 +49,7 @@ class ShareNetworkTest(base.BaseSharedFileSystemTest):
|
||||
self.SHARE_NETWORK_ID, ignore_missing=True
|
||||
)
|
||||
self.assertIsNone(sot)
|
||||
self.user_cloud.network.delete_network(self.NETWORK_ID)
|
||||
super(ShareNetworkTest, self).tearDown()
|
||||
|
||||
def test_get(self):
|
||||
@ -39,6 +58,15 @@ class ShareNetworkTest(base.BaseSharedFileSystemTest):
|
||||
)
|
||||
assert isinstance(sot, _share_network.ShareNetwork)
|
||||
self.assertEqual(self.SHARE_NETWORK_ID, sot.id)
|
||||
self.assertIsNotNone(sot.share_network_subnets)
|
||||
self.assertEqual(
|
||||
self.NETWORK_ID,
|
||||
sot.share_network_subnets[0]['neutron_net_id'],
|
||||
)
|
||||
self.assertEqual(
|
||||
self.SUBNET_ID,
|
||||
sot.share_network_subnets[0]['neutron_subnet_id'],
|
||||
)
|
||||
|
||||
def test_list_share_network(self):
|
||||
share_nets = self.user_cloud.shared_file_system.share_networks(
|
||||
|
Loading…
Reference in New Issue
Block a user