@@ -47,14 +47,13 @@ def test_create_firewall_rule_with_mandatory_params(self):
47
47
protocol = protocol , action = action ,
48
48
enabled = True , tenant_id = tenant_id )
49
49
50
- def test_create_firewall_rule_with_all_params (self ):
50
+ def _setup_create_firewall_rule_with_all_params (self , protocol = 'tcp' ):
51
51
"""firewall-rule-create with all params set."""
52
52
resource = 'firewall_rule'
53
53
cmd = firewallrule .CreateFirewallRule (test_cli20 .MyApp (sys .stdout ),
54
54
None )
55
55
name = 'my-name'
56
56
description = 'my-desc'
57
- protocol = 'tcp'
58
57
source_ip = '192.168.1.0/24'
59
58
destination_ip = '192.168.2.0/24'
60
59
source_port = '0:65535'
@@ -75,6 +74,8 @@ def test_create_firewall_rule_with_all_params(self):
75
74
'--tenant-id' , tenant_id ]
76
75
position_names = []
77
76
position_values = []
77
+ if protocol == 'any' :
78
+ protocol = None
78
79
self ._test_create_resource (resource , cmd , name , my_id , args ,
79
80
position_names , position_values ,
80
81
description = description , shared = True ,
@@ -86,6 +87,12 @@ def test_create_firewall_rule_with_all_params(self):
86
87
action = action , enabled = True ,
87
88
tenant_id = tenant_id )
88
89
90
+ def test_create_firewall_rule_with_all_params (self ):
91
+ self ._setup_create_firewall_rule_with_all_params ()
92
+
93
+ def test_create_firewall_rule_with_proto_any (self ):
94
+ self ._setup_create_firewall_rule_with_all_params (protocol = 'any' )
95
+
89
96
def test_list_firewall_rules (self ):
90
97
"""firewall-rule-list."""
91
98
resources = "firewall_rules"
@@ -144,6 +151,15 @@ def test_update_firewall_rule(self):
144
151
['myid' , '--name' , 'newname' ],
145
152
{'name' : 'newname' , })
146
153
154
+ def test_update_firewall_rule_protocol (self ):
155
+ """firewall-rule-update myid --protocol any."""
156
+ resource = 'firewall_rule'
157
+ cmd = firewallrule .UpdateFirewallRule (test_cli20 .MyApp (sys .stdout ),
158
+ None )
159
+ self ._test_update_resource (resource , cmd , 'myid' ,
160
+ ['myid' , '--protocol' , 'any' ],
161
+ {'protocol' : None , })
162
+
147
163
def test_delete_firewall_rule (self ):
148
164
"""firewall-rule-delete my-id."""
149
165
resource = 'firewall_rule'
0 commit comments