# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2011 Cisco Systems, Inc. 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. # # @author: Shweta Padubidri, Cisco Systems, Inc. # import logging import unittest from quantum.plugins.cisco.ucs import cisco_ucs_network_driver LOG = logging.getLogger('quantum.tests.test_ucs_driver') CREATE_VLAN_OUTPUT = (' ' ' ' ' ') CREATE_PROFILE_OUTPUT = (' ' ' ' ' ') CHANGE_VLAN_OUTPUT = (' ' ' ' ' ' ' ') DELETE_VLAN_OUTPUT = (' ' ' ' ' ') DELETE_PROFILE_OUTPUT = (' ' ' ') ASSOC_PROFILE_OUTPUT = (' ' ' ') class TestUCSDriver(unittest.TestCase): def setUp(self): """ Set up function""" self.ucsm_driver = cisco_ucs_network_driver.CiscoUCSMDriver() self.vlan_name = 'New Vlan' self.vlan_id = '200' self.profile_name = 'New Profile' self.old_vlan_name = 'Old Vlan' self.profile_client_name = 'New Profile Client' def test_create_vlan_post_data(self, expected_output=CREATE_VLAN_OUTPUT): """ Tests creation of vlan post Data """ LOG.debug("test_create_vlan") vlan_details = self.ucsm_driver._create_vlan_post_data( self.vlan_name, self.vlan_id) self.assertEqual(vlan_details, expected_output) LOG.debug("test_create_vlan - END") def test_create_profile_post_data(self, expected_output=CREATE_PROFILE_OUTPUT): """ Tests creation of profile post Data """ LOG.debug("test_create_profile_post_data - START") profile_details = self.ucsm_driver._create_profile_post_data( self.profile_name, self.vlan_name) self.assertEqual(profile_details, expected_output) LOG.debug("test_create_profile_post - END") def test_change_vlan_profile_data(self, expected_output=CHANGE_VLAN_OUTPUT): """ Tests creation of change vlan in profile post Data """ LOG.debug("test_create_profile_post_data - START") profile_details = self.ucsm_driver._change_vlaninprof_post_data( self.profile_name, self.old_vlan_name, self.vlan_name) self.assertEqual(profile_details, expected_output) LOG.debug("test_create_profile_post - END") def test_delete_vlan_post_data(self, expected_output=DELETE_VLAN_OUTPUT): """ Tests deletion of vlan post Data """ LOG.debug("test_create_profile_post_data - START") self.ucsm_driver._create_vlan_post_data( self.vlan_name, self.vlan_id) vlan_delete_details = self.ucsm_driver._delete_vlan_post_data( self.vlan_name) self.assertEqual(vlan_delete_details, expected_output) LOG.debug("test_create_profile_post - END") def test_delete_profile_post_data(self, expected_output=DELETE_PROFILE_OUTPUT): """ Tests deletion of profile post Data """ LOG.debug("test_create_profile_post_data - START") self.ucsm_driver._create_profile_post_data( self.profile_name, self.vlan_name) profile_delete_details = self.ucsm_driver._delete_profile_post_data( self.profile_name) self.assertEqual(profile_delete_details, expected_output) LOG.debug("test_create_profile_post - END") def test_create_profile_client_data(self, expected_output=ASSOC_PROFILE_OUTPUT): """ Tests creation of profile client post Data """ LOG.debug("test_create_profile_client_data - START") profile_details = self.ucsm_driver._create_pclient_post_data( self.profile_name, self.profile_client_name) self.assertEqual(profile_details, expected_output) LOG.debug("test_create_profile_post - END")