Skip to content

Commit f63a9f4

Browse files
author
Jens Rosenboom
committed
Fix output of ListSecurityGroupRule
The Ethertype column was always left empty because a wrong column name was being used. Change-Id: I7fc0f8d5eb7bac1efb234faba454dad0a45a7e6a Closes-Bug: 1667699
1 parent 1450e8f commit f63a9f4

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

openstackclient/network/v2/security_group_rule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def take_action_network(self, client, parsed_args):
521521
'port_range',
522522
)
523523
if parsed_args.long:
524-
columns = columns + ('direction', 'ethertype',)
524+
columns = columns + ('direction', 'ether_type',)
525525
columns = columns + ('remote_group_id',)
526526

527527
# Get the security group rules using the requested query.

openstackclient/tests/unit/network/v2/fakes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ def create_one_security_group_rule(attrs=None):
11191119
'description': 'security-group-rule-description-' +
11201120
uuid.uuid4().hex,
11211121
'direction': 'ingress',
1122-
'ethertype': 'IPv4',
1122+
'ether_type': 'IPv4',
11231123
'id': 'security-group-rule-id-' + uuid.uuid4().hex,
11241124
'port_range_max': None,
11251125
'port_range_min': None,

openstackclient/tests/unit/network/v2/test_security_group_rule.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
6262
expected_columns = (
6363
'description',
6464
'direction',
65-
'ethertype',
65+
'ether_type',
6666
'id',
6767
'port_range_max',
6868
'port_range_min',
@@ -84,7 +84,7 @@ def _setup_security_group_rule(self, attrs=None):
8484
self.expected_data = (
8585
self._security_group_rule.description,
8686
self._security_group_rule.direction,
87-
self._security_group_rule.ethertype,
87+
self._security_group_rule.ether_type,
8888
self._security_group_rule.id,
8989
self._security_group_rule.port_range_max,
9090
self._security_group_rule.port_range_min,
@@ -184,7 +184,7 @@ def test_create_default_rule(self):
184184

185185
self.network.create_security_group_rule.assert_called_once_with(**{
186186
'direction': self._security_group_rule.direction,
187-
'ethertype': self._security_group_rule.ethertype,
187+
'ethertype': self._security_group_rule.ether_type,
188188
'port_range_max': self._security_group_rule.port_range_max,
189189
'port_range_min': self._security_group_rule.port_range_min,
190190
'protocol': self._security_group_rule.protocol,
@@ -216,7 +216,7 @@ def test_create_proto_option(self):
216216

217217
self.network.create_security_group_rule.assert_called_once_with(**{
218218
'direction': self._security_group_rule.direction,
219-
'ethertype': self._security_group_rule.ethertype,
219+
'ethertype': self._security_group_rule.ether_type,
220220
'protocol': self._security_group_rule.protocol,
221221
'remote_ip_prefix': self._security_group_rule.remote_ip_prefix,
222222
'security_group_id': self._security_group.id,
@@ -249,7 +249,7 @@ def test_create_remote_group(self):
249249

250250
self.network.create_security_group_rule.assert_called_once_with(**{
251251
'direction': self._security_group_rule.direction,
252-
'ethertype': self._security_group_rule.ethertype,
252+
'ethertype': self._security_group_rule.ether_type,
253253
'port_range_max': self._security_group_rule.port_range_max,
254254
'port_range_min': self._security_group_rule.port_range_min,
255255
'protocol': self._security_group_rule.protocol,
@@ -279,7 +279,7 @@ def test_create_source_group(self):
279279

280280
self.network.create_security_group_rule.assert_called_once_with(**{
281281
'direction': self._security_group_rule.direction,
282-
'ethertype': self._security_group_rule.ethertype,
282+
'ethertype': self._security_group_rule.ether_type,
283283
'protocol': self._security_group_rule.protocol,
284284
'remote_group_id': self._security_group_rule.remote_group_id,
285285
'security_group_id': self._security_group.id,
@@ -308,7 +308,7 @@ def test_create_source_ip(self):
308308

309309
self.network.create_security_group_rule.assert_called_once_with(**{
310310
'direction': self._security_group_rule.direction,
311-
'ethertype': self._security_group_rule.ethertype,
311+
'ethertype': self._security_group_rule.ether_type,
312312
'protocol': self._security_group_rule.protocol,
313313
'remote_ip_prefix': self._security_group_rule.remote_ip_prefix,
314314
'security_group_id': self._security_group.id,
@@ -337,7 +337,7 @@ def test_create_remote_ip(self):
337337

338338
self.network.create_security_group_rule.assert_called_once_with(**{
339339
'direction': self._security_group_rule.direction,
340-
'ethertype': self._security_group_rule.ethertype,
340+
'ethertype': self._security_group_rule.ether_type,
341341
'protocol': self._security_group_rule.protocol,
342342
'remote_ip_prefix': self._security_group_rule.remote_ip_prefix,
343343
'security_group_id': self._security_group.id,
@@ -348,7 +348,7 @@ def test_create_remote_ip(self):
348348
def test_create_network_options(self):
349349
self._setup_security_group_rule({
350350
'direction': 'egress',
351-
'ethertype': 'IPv6',
351+
'ether_type': 'IPv6',
352352
'port_range_max': 443,
353353
'port_range_min': 443,
354354
'protocol': '6',
@@ -358,7 +358,7 @@ def test_create_network_options(self):
358358
arglist = [
359359
'--dst-port', str(self._security_group_rule.port_range_min),
360360
'--egress',
361-
'--ethertype', self._security_group_rule.ethertype,
361+
'--ethertype', self._security_group_rule.ether_type,
362362
'--project', self.project.name,
363363
'--project-domain', self.domain.name,
364364
'--protocol', self._security_group_rule.protocol,
@@ -368,7 +368,7 @@ def test_create_network_options(self):
368368
('dst_port', (self._security_group_rule.port_range_min,
369369
self._security_group_rule.port_range_max)),
370370
('egress', True),
371-
('ethertype', self._security_group_rule.ethertype),
371+
('ethertype', self._security_group_rule.ether_type),
372372
('project', self.project.name),
373373
('project_domain', self.domain.name),
374374
('protocol', self._security_group_rule.protocol),
@@ -380,7 +380,7 @@ def test_create_network_options(self):
380380

381381
self.network.create_security_group_rule.assert_called_once_with(**{
382382
'direction': self._security_group_rule.direction,
383-
'ethertype': self._security_group_rule.ethertype,
383+
'ethertype': self._security_group_rule.ether_type,
384384
'port_range_max': self._security_group_rule.port_range_max,
385385
'port_range_min': self._security_group_rule.port_range_min,
386386
'protocol': self._security_group_rule.protocol,
@@ -444,7 +444,7 @@ def test_create_icmp_type(self):
444444

445445
self.network.create_security_group_rule.assert_called_once_with(**{
446446
'direction': self._security_group_rule.direction,
447-
'ethertype': self._security_group_rule.ethertype,
447+
'ethertype': self._security_group_rule.ether_type,
448448
'port_range_min': self._security_group_rule.port_range_min,
449449
'protocol': self._security_group_rule.protocol,
450450
'remote_ip_prefix': self._security_group_rule.remote_ip_prefix,
@@ -455,7 +455,7 @@ def test_create_icmp_type(self):
455455

456456
def test_create_ipv6_icmp_type_code(self):
457457
self._setup_security_group_rule({
458-
'ethertype': 'IPv6',
458+
'ether_type': 'IPv6',
459459
'port_range_min': 139,
460460
'port_range_max': 2,
461461
'protocol': 'ipv6-icmp',
@@ -479,7 +479,7 @@ def test_create_ipv6_icmp_type_code(self):
479479

480480
self.network.create_security_group_rule.assert_called_once_with(**{
481481
'direction': self._security_group_rule.direction,
482-
'ethertype': self._security_group_rule.ethertype,
482+
'ethertype': self._security_group_rule.ether_type,
483483
'port_range_min': self._security_group_rule.port_range_min,
484484
'port_range_max': self._security_group_rule.port_range_max,
485485
'protocol': self._security_group_rule.protocol,
@@ -490,7 +490,7 @@ def test_create_ipv6_icmp_type_code(self):
490490

491491
def test_create_icmpv6_type(self):
492492
self._setup_security_group_rule({
493-
'ethertype': 'IPv6',
493+
'ether_type': 'IPv6',
494494
'port_range_min': 139,
495495
'protocol': 'icmpv6',
496496
})
@@ -512,7 +512,7 @@ def test_create_icmpv6_type(self):
512512

513513
self.network.create_security_group_rule.assert_called_once_with(**{
514514
'direction': self._security_group_rule.direction,
515-
'ethertype': self._security_group_rule.ethertype,
515+
'ethertype': self._security_group_rule.ether_type,
516516
'port_range_min': self._security_group_rule.port_range_min,
517517
'protocol': self._security_group_rule.protocol,
518518
'security_group_id': self._security_group.id,
@@ -539,7 +539,7 @@ def test_create_with_description(self):
539539
self.network.create_security_group_rule.assert_called_once_with(**{
540540
'description': self._security_group_rule.description,
541541
'direction': self._security_group_rule.direction,
542-
'ethertype': self._security_group_rule.ethertype,
542+
'ethertype': self._security_group_rule.ether_type,
543543
'protocol': self._security_group_rule.protocol,
544544
'remote_ip_prefix': self._security_group_rule.remote_ip_prefix,
545545
'security_group_id': self._security_group.id,
@@ -1039,7 +1039,7 @@ class TestListSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
10391039
security_group_rule._format_network_port_range(
10401040
_security_group_rule),
10411041
_security_group_rule.direction,
1042-
_security_group_rule.ethertype,
1042+
_security_group_rule.ether_type,
10431043
_security_group_rule.remote_group_id,
10441044
))
10451045
expected_data_no_group.append((
@@ -1299,7 +1299,7 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
12991299
columns = (
13001300
'description',
13011301
'direction',
1302-
'ethertype',
1302+
'ether_type',
13031303
'id',
13041304
'port_range_max',
13051305
'port_range_min',
@@ -1313,7 +1313,7 @@ class TestShowSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
13131313
data = (
13141314
_security_group_rule.description,
13151315
_security_group_rule.direction,
1316-
_security_group_rule.ethertype,
1316+
_security_group_rule.ether_type,
13171317
_security_group_rule.id,
13181318
_security_group_rule.port_range_max,
13191319
_security_group_rule.port_range_min,

0 commit comments

Comments
 (0)