Enable router interface to have 'centralized' type

This is required when we have a VLAN network that needs to be
attached to a router

Change-Id: I34ae08841158635e10ec4bd4518db4712ba4e984
This commit is contained in:
Gary Kotton 2018-02-02 13:03:36 +02:00
parent 354ea46ac1
commit df13d53903
3 changed files with 8 additions and 3 deletions

View File

@ -42,6 +42,7 @@ ROUTER_TYPE_TIER1 = "TIER1"
LROUTERPORT_UPLINK = "LogicalRouterUplinkPort" LROUTERPORT_UPLINK = "LogicalRouterUplinkPort"
LROUTERPORT_DOWNLINK = "LogicalRouterDownLinkPort" LROUTERPORT_DOWNLINK = "LogicalRouterDownLinkPort"
LROUTERPORT_CENTRALIZED = "LogicalRouterCentralizedServicePort"
LROUTERPORT_LINKONTIER0 = "LogicalRouterLinkPortOnTIER0" LROUTERPORT_LINKONTIER0 = "LogicalRouterLinkPortOnTIER0"
LROUTERPORT_LINKONTIER1 = "LogicalRouterLinkPortOnTIER1" LROUTERPORT_LINKONTIER1 = "LogicalRouterLinkPortOnTIER1"

View File

@ -249,7 +249,8 @@ class LogicalRouterPort(utils.NsxLibApiBase):
if address_groups: if address_groups:
body['subnets'] = address_groups body['subnets'] = address_groups
if resource_type in [nsx_constants.LROUTERPORT_UPLINK, if resource_type in [nsx_constants.LROUTERPORT_UPLINK,
nsx_constants.LROUTERPORT_DOWNLINK]: nsx_constants.LROUTERPORT_DOWNLINK,
nsx_constants.LROUTERPORT_CENTRALIZED]:
body['linked_logical_switch_port_id'] = { body['linked_logical_switch_port_id'] = {
'target_id': logical_port_id} 'target_id': logical_port_id}
elif resource_type == nsx_constants.LROUTERPORT_LINKONTIER1: elif resource_type == nsx_constants.LROUTERPORT_LINKONTIER1:

View File

@ -172,15 +172,18 @@ class RouterLib(object):
logical_switch_port_id, logical_switch_port_id,
address_groups, address_groups,
urpf_mode=None, urpf_mode=None,
relay_service_uuid=None): relay_service_uuid=None,
resource_type=None):
try: try:
port = self._router_port_client.get_by_lswitch_id(ls_id) port = self._router_port_client.get_by_lswitch_id(ls_id)
except exceptions.ResourceNotFound: except exceptions.ResourceNotFound:
if resource_type is None:
resource_type = nsx_constants.LROUTERPORT_DOWNLINK
return self._router_port_client.create( return self._router_port_client.create(
logical_router_id, logical_router_id,
display_name, display_name,
tags, tags,
nsx_constants.LROUTERPORT_DOWNLINK, resource_type,
logical_switch_port_id, logical_switch_port_id,
address_groups, address_groups,
urpf_mode=urpf_mode, urpf_mode=urpf_mode,