Enabled naming nat rules
The following methods now have the ability to name nat rules: - add_fip_nat_rules - add_gw_snat_rule - add_nat_rule Change-Id: I62b36fcec1a53b6d2c0c0b64c9dcb4200c9b0ae9
This commit is contained in:
parent
c1a775e492
commit
734270d9e9
@ -715,9 +715,11 @@ class LogicalRouterTestCase(BaseTestResource):
|
||||
router = self.get_mocked_resource()
|
||||
translated_net = '1.1.1.1'
|
||||
priority = 10
|
||||
display_name = 'fake_name'
|
||||
|
||||
data = {
|
||||
'action': action,
|
||||
'display_name': display_name,
|
||||
'enabled': True,
|
||||
'translated_network': translated_net,
|
||||
'rule_priority': priority
|
||||
@ -734,7 +736,8 @@ class LogicalRouterTestCase(BaseTestResource):
|
||||
action=action,
|
||||
translated_network=translated_net,
|
||||
rule_priority=priority,
|
||||
bypass_firewall=False)
|
||||
bypass_firewall=False,
|
||||
display_name=display_name)
|
||||
except exceptions.InvalidInput as e:
|
||||
if expect_failure:
|
||||
return
|
||||
|
@ -532,7 +532,8 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
|
||||
match_ports=None, match_protocol=None,
|
||||
match_resource_type=None,
|
||||
bypass_firewall=True,
|
||||
tags=None):
|
||||
tags=None,
|
||||
display_name=None):
|
||||
self._validate_nat_rule_action(action)
|
||||
resource = 'logical-routers/%s/nat/rules' % logical_router_id
|
||||
body = {'action': action,
|
||||
@ -561,6 +562,8 @@ class NsxLibLogicalRouter(utils.NsxLibApiBase):
|
||||
"this feature is not supported.", logical_router_id)
|
||||
if tags is not None:
|
||||
body['tags'] = tags
|
||||
if display_name:
|
||||
body['display_name'] = display_name
|
||||
return self.client.create(resource, body)
|
||||
|
||||
def add_static_route(self, logical_router_id, dest_cidr, nexthop):
|
||||
|
@ -153,14 +153,15 @@ class RouterLib(object):
|
||||
skip_not_found=True, strict_mode=False)
|
||||
|
||||
def add_gw_snat_rule(self, logical_router_id, gw_ip, source_net=None,
|
||||
bypass_firewall=True, tags=None):
|
||||
bypass_firewall=True, tags=None, display_name=None):
|
||||
return self.nsxlib.logical_router.add_nat_rule(
|
||||
logical_router_id, action="SNAT",
|
||||
translated_network=gw_ip,
|
||||
source_net=source_net,
|
||||
rule_priority=GW_NAT_PRI,
|
||||
bypass_firewall=bypass_firewall,
|
||||
tags=tags)
|
||||
tags=tags,
|
||||
display_name=display_name)
|
||||
|
||||
def update_router_edge_cluster(self, nsx_router_id, edge_cluster_uuid):
|
||||
return self._router_client.update(nsx_router_id,
|
||||
@ -200,14 +201,15 @@ class RouterLib(object):
|
||||
|
||||
def add_fip_nat_rules(self, logical_router_id, ext_ip, int_ip,
|
||||
match_ports=None, bypass_firewall=True,
|
||||
tags=None):
|
||||
tags=None, display_name=None):
|
||||
self.nsxlib.logical_router.add_nat_rule(
|
||||
logical_router_id, action="SNAT",
|
||||
translated_network=ext_ip,
|
||||
source_net=int_ip,
|
||||
rule_priority=FIP_NAT_PRI,
|
||||
bypass_firewall=bypass_firewall,
|
||||
tags=tags)
|
||||
tags=tags,
|
||||
display_name=display_name)
|
||||
self.nsxlib.logical_router.add_nat_rule(
|
||||
logical_router_id, action="DNAT",
|
||||
translated_network=int_ip,
|
||||
@ -215,7 +217,8 @@ class RouterLib(object):
|
||||
rule_priority=FIP_NAT_PRI,
|
||||
match_ports=match_ports,
|
||||
bypass_firewall=bypass_firewall,
|
||||
tags=tags)
|
||||
tags=tags,
|
||||
display_name=display_name)
|
||||
|
||||
def delete_fip_nat_rules_by_internal_ip(self, logical_router_id, int_ip):
|
||||
self.nsxlib.logical_router.delete_nat_rule_by_values(
|
||||
|
Loading…
Reference in New Issue
Block a user