2016-10-04 13:02:41 -05:00
|
|
|
# Copyright (c) 2017, Intel Corporation.
|
|
|
|
# All Rights Reserved.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
from openstackclient.tests.functional import base
|
|
|
|
|
|
|
|
|
2017-04-28 12:41:57 -05:00
|
|
|
class ExtensionTests(base.TestCase):
|
|
|
|
"""Functional tests for extension"""
|
2016-10-04 13:02:41 -05:00
|
|
|
|
2017-04-28 12:41:57 -05:00
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
|
|
|
# super(NetworkTests, cls).setUp()
|
|
|
|
cls.haz_network = base.is_service_enabled('network')
|
|
|
|
|
|
|
|
def test_extension_list_compute(self):
|
|
|
|
"""Test compute extension list"""
|
2016-10-04 13:02:41 -05:00
|
|
|
json_output = json.loads(self.openstack(
|
2017-04-28 12:41:57 -05:00
|
|
|
'extension list -f json ' +
|
|
|
|
'--compute'
|
|
|
|
))
|
|
|
|
name_list = [item.get('Name') for item in json_output]
|
|
|
|
self.assertIn(
|
|
|
|
'ImageSize',
|
|
|
|
name_list,
|
2016-10-04 13:02:41 -05:00
|
|
|
)
|
2017-04-28 12:41:57 -05:00
|
|
|
|
|
|
|
def test_extension_list_network(self):
|
|
|
|
"""Test network extension list"""
|
|
|
|
if not self.haz_network:
|
|
|
|
self.skipTest("No Network service present")
|
|
|
|
|
|
|
|
json_output = json.loads(self.openstack(
|
|
|
|
'extension list -f json ' +
|
|
|
|
'--network'
|
|
|
|
))
|
|
|
|
name_list = [item.get('Name') for item in json_output]
|
|
|
|
self.assertIn(
|
2016-10-04 13:02:41 -05:00
|
|
|
'Default Subnetpools',
|
2017-04-28 12:41:57 -05:00
|
|
|
name_list,
|
2016-10-04 13:02:41 -05:00
|
|
|
)
|
|
|
|
|
2017-04-28 12:41:57 -05:00
|
|
|
# NOTE(dtroyer): Only network extensions are currently supported but
|
|
|
|
# I am going to leave this here anyway as a reminder
|
|
|
|
# fix that.
|
|
|
|
# def test_extension_show_compute(self):
|
|
|
|
# """Test compute extension show"""
|
|
|
|
# json_output = json.loads(self.openstack(
|
|
|
|
# 'extension show -f json ' +
|
|
|
|
# 'ImageSize'
|
|
|
|
# ))
|
|
|
|
# self.assertEqual(
|
|
|
|
# 'OS-EXT-IMG-SIZE',
|
|
|
|
# json_output.get('Alias'),
|
|
|
|
# )
|
|
|
|
|
|
|
|
def test_extension_show_network(self):
|
|
|
|
"""Test network extension show"""
|
|
|
|
if not self.haz_network:
|
|
|
|
self.skipTest("No Network service present")
|
|
|
|
|
2016-10-04 13:02:41 -05:00
|
|
|
name = 'agent'
|
|
|
|
json_output = json.loads(self.openstack(
|
2017-04-28 12:41:57 -05:00
|
|
|
'extension show -f json ' +
|
|
|
|
name
|
|
|
|
))
|
2016-10-04 13:02:41 -05:00
|
|
|
self.assertEqual(
|
|
|
|
name,
|
2017-04-28 12:41:57 -05:00
|
|
|
json_output.get('Alias'),
|
|
|
|
)
|