Support ENS transport zone

Change-Id: Iba4fa617c91df9bb1afce4e2612cee9da873a08d
This commit is contained in:
Adit Sarfaty 2017-09-24 13:47:57 +03:00
parent a8e260516e
commit f2cf04fa36
3 changed files with 15 additions and 1 deletions

View File

@ -327,7 +327,8 @@ FAKE_TZ = {
"revision": 0,
"id": FAKE_TZ_UUID,
"display_name": FAKE_NAME,
"transport_type": "OVERLAY"
"transport_type": "OVERLAY",
"host_switch_mode": "STANDARD"
}
FAKE_MD_UUID = uuidutils.generate_uuid()

View File

@ -1118,6 +1118,13 @@ class TransportZone(BaseTestResource):
tz_type = tz.get_transport_type(fake_tz['id'])
self.assertEqual(tz.TRANSPORT_TYPE_OVERLAY, tz_type)
def test_get_host_switch_mode(self):
fake_tz = test_constants.FAKE_TZ.copy()
tz = self.get_mocked_resource()
with mock.patch.object(tz.client, 'url_get', return_value=fake_tz):
tz_mode = tz.get_host_switch_mode(fake_tz['id'])
self.assertEqual(tz.HOST_SWITCH_MODE_STANDARD, tz_mode)
class MetadataProxy(BaseTestResource):

View File

@ -678,6 +678,8 @@ class NsxLibTransportZone(utils.NsxLibApiBase):
TRANSPORT_TYPE_VLAN = 'VLAN'
TRANSPORT_TYPE_OVERLAY = 'OVERLAY'
HOST_SWITCH_MODE_ENS = 'ENS'
HOST_SWITCH_MODE_STANDARD = 'STANDARD'
@property
def uri_segment(self):
@ -691,6 +693,10 @@ class NsxLibTransportZone(utils.NsxLibApiBase):
tz = self.get(uuid)
return tz['transport_type']
def get_host_switch_mode(self, uuid):
tz = self.get(uuid)
return tz.get('host_switch_mode', self.HOST_SWITCH_MODE_STANDARD)
class NsxLibDhcpProfile(utils.NsxLibApiBase):