1
|
|
|
from st2tests.base import BaseActionAliasTestCase |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
class NcmConfigDownloadActionAliasTestCase(BaseActionAliasTestCase): |
5
|
|
|
action_alias_name = 'ncm_config_download' |
6
|
|
|
|
7
|
|
|
def test_ncm_config_download_alias(self): |
8
|
|
|
format_string = self.action_alias_db.formats[0]['representation'][0] |
9
|
|
|
|
10
|
|
|
command = "orion ncm config-download orion router1" |
11
|
|
|
expected_parameters = { |
12
|
|
|
'platform': 'orion', |
13
|
|
|
'node': 'router1' |
14
|
|
|
} |
15
|
|
|
self.assertExtractedParametersMatch(format_string=format_string, |
16
|
|
|
command=command, |
17
|
|
|
parameters=expected_parameters) |
18
|
|
|
|
19
|
|
|
class NodeStatusActionAliasTestCase(BaseActionAliasTestCase): |
20
|
|
|
action_alias_name = 'node_status' |
21
|
|
|
|
22
|
|
|
def test_node_status_alias(self): |
23
|
|
|
format_string = self.action_alias_db.formats[0]['representation'][0] |
24
|
|
|
format_strings = self.action_alias_db.formats[0]['representation'] |
25
|
|
|
|
26
|
|
|
command = "orion node status orion router1" |
27
|
|
|
expected_parameters = { |
28
|
|
|
'platform': 'orion', |
29
|
|
|
'node': 'router1' |
30
|
|
|
} |
31
|
|
|
self.assertExtractedParametersMatch(format_string=format_string, |
32
|
|
|
command=command, |
33
|
|
|
parameters=expected_parameters) |
34
|
|
|
|
35
|
|
|
self.assertCommandMatchesExactlyOneFormatString( |
36
|
|
|
format_strings=format_strings, |
37
|
|
|
command=command) |
38
|
|
|
|
39
|
|
|
class NodeCreateActionAliasTestCase(BaseActionAliasTestCase): |
40
|
|
|
action_alias_name = 'node_create' |
41
|
|
|
|
42
|
|
|
def test_node_create_alias(self): |
43
|
|
|
format_strings = self.action_alias_db.formats[1]['representation'] |
44
|
|
|
format_string = self.action_alias_db.formats[1]['representation'][3] |
45
|
|
|
|
46
|
|
|
command = "create orion node router1 at 192.168.0.1" |
47
|
|
|
expected_parameters = { |
48
|
|
|
'ip_address': "192.168.0.1", |
49
|
|
|
'node': 'router1' |
50
|
|
|
} |
51
|
|
|
self.assertExtractedParametersMatch(format_string=format_string, |
52
|
|
|
command=command, |
53
|
|
|
parameters=expected_parameters) |
54
|
|
|
|
55
|
|
|
self.assertCommandMatchesExactlyOneFormatString( |
56
|
|
|
format_strings=format_strings, |
57
|
|
|
command=command) |
58
|
|
|
|