3d20d5439c99084d17db0bd1965a3c42b9705e52
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_get_server_ip.py
1 ##############################################################################
2 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import unittest
10
11 from yardstick.benchmark.scenarios.lib.get_server_ip import GetServerIp
12
13
14 class GetServerIpTestCase(unittest.TestCase):
15     def test_get_server_ip(self):
16         scenario_cfg = {
17             'options': {
18                 'server': {
19                     'addresses': {
20                         'net1': [
21                             {
22                                 'OS-EXT-IPS:type': 'floating',
23                                 'addr': '127.0.0.1'
24                             }
25                         ]
26                     }
27                 }
28             },
29             'output': 'ip'
30         }
31         obj = GetServerIp(scenario_cfg, {})
32         result = obj.run({})
33         self.assertEqual(result, {'ip': '127.0.0.1'})
34
35
36 def main():
37     unittest.main()
38
39
40 if __name__ == '__main__':
41     main()