diff --git a/vmware_nsx/plugins/nsx_v/md_proxy.py b/vmware_nsx/plugins/nsx_v/md_proxy.py index b39d67cf17..64b609ac72 100644 --- a/vmware_nsx/plugins/nsx_v/md_proxy.py +++ b/vmware_nsx/plugins/nsx_v/md_proxy.py @@ -68,7 +68,9 @@ def get_router_fw_rules(): str_ports = [str(p) for p in int_ports] # the list of ports can be extended by configuration if cfg.CONF.nsxv.metadata_service_allowed_ports: - str_ports = str_ports + cfg.CONF.nsxv.metadata_service_allowed_ports + str_metadata_ports = [str(p) for p in + cfg.CONF.nsxv.metadata_service_allowed_ports] + str_ports = str_ports + str_metadata_ports separator = ',' dest_ports = separator.join(str_ports) diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index e1b587268e..5e4fc71eb5 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -3135,7 +3135,7 @@ class TestExclusiveRouterTestCase(L3NatTest, L3NatTestCaseBase, """ cfg.CONF.set_override('dhcp_force_metadata', True, group='nsxv') cfg.CONF.set_override('metadata_service_allowed_ports', - ['55', ' 66 ', '55', 'xx'], group='nsxv') + ['55', ' 66 ', '55', '77'], group='nsxv') self.plugin_instance.metadata_proxy_handler = mock.Mock() s1_cidr = '10.0.0.0/24' with self.router() as r,\ @@ -3150,7 +3150,7 @@ class TestExclusiveRouterTestCase(L3NatTest, L3NatTestCaseBase, rule_name = 'MDServiceIP' md_srvip = {'action': 'allow', 'destination_ip_address': dest_srvip, - 'destination_port': '80,443,8775,55, 66 ,55,xx', + 'destination_port': '80,443,8775,55,66,55,77', 'enabled': True, 'name': rule_name, 'protocol': 'tcp'} @@ -3169,7 +3169,7 @@ class TestExclusiveRouterTestCase(L3NatTest, L3NatTestCaseBase, # Ports should be sorted & unique, and ignore non numeric values drv = edge_firewall_driver.EdgeFirewallDriver() rule = drv._convert_firewall_rule(md_srvip) - exp_service = {'service': [{'port': [55, 66, 80, 443, 8775], + exp_service = {'service': [{'port': [55, 66, 77, 80, 443, 8775], 'protocol': 'tcp'}]} exp_rule = {'action': 'accept', 'application': exp_service,