From a97627ac513c1775c656fdb4b6acdec8b4de2f05 Mon Sep 17 00:00:00 2001
From: Gary Kotton <gkotton@vmware.com>
Date: Mon, 5 Feb 2018 06:49:55 -0800
Subject: [PATCH] NSX|V3: only allow physical network to be confogured for
 external net

External network type or segmentation ID is not support so we throw
an exception if one of these is configured at external network
creation.

An external network is just associated to a edge cluster.

Change-Id: I0a7f265f4af4be9a37169fe07cefe574f49d4401
---
 vmware_nsx/plugins/nsx_v3/plugin.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py
index ae4316a6db..24c673256d 100644
--- a/vmware_nsx/plugins/nsx_v3/plugin.py
+++ b/vmware_nsx/plugins/nsx_v3/plugin.py
@@ -901,6 +901,11 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
             tier0_uuid = self._default_tier0_router
         else:
             tier0_uuid = net_data[pnet.PHYSICAL_NETWORK]
+        if ((validators.is_attr_set(net_data.get(pnet.NETWORK_TYPE)) and
+             net_data.get(pnet.NETWORK_TYPE) != utils.NetworkTypes.L3_EXT) or
+            validators.is_attr_set(net_data.get(pnet.SEGMENTATION_ID))):
+            msg = _("Invalid provider network configuration")
+            raise n_exc.InvalidInput(error_message=msg)
         self.nsxlib.router.validate_tier0(self.tier0_groups_dict, tier0_uuid)
         return (True, utils.NetworkTypes.L3_EXT, tier0_uuid, 0)