NSX|V3: fix short-name notation
Backend platform now supports '.'. So lets move to that format! Change-Id: I746c80e7303e6a34c72c230329a0b78b612079b1
This commit is contained in:
parent
037a8963d9
commit
b8f6034bd8
@ -200,7 +200,6 @@ def read_file(path):
|
|||||||
|
|
||||||
|
|
||||||
def get_name_and_uuid(name, uuid, maxlen=80):
|
def get_name_and_uuid(name, uuid, maxlen=80):
|
||||||
# TODO(garyk):the second '_' should be '...'. Pending backend support
|
short_uuid = '_' + uuid[:5] + '...' + uuid[-5:]
|
||||||
short_uuid = '_' + uuid[:5] + '_' + uuid[-5:]
|
|
||||||
maxlen = maxlen - len(short_uuid)
|
maxlen = maxlen - len(short_uuid)
|
||||||
return name[:maxlen] + short_uuid
|
return name[:maxlen] + short_uuid
|
||||||
|
@ -439,3 +439,15 @@ class TestNsxV3Utils(NsxV3PluginTestCaseMixin):
|
|||||||
|
|
||||||
expect_true = utils.is_internal_resource({'tags': internal_tag})
|
expect_true = utils.is_internal_resource({'tags': internal_tag})
|
||||||
self.assertTrue(expect_true)
|
self.assertTrue(expect_true)
|
||||||
|
|
||||||
|
def test_get_name_and_uuid(self):
|
||||||
|
uuid = 'afc40f8a-4967-477e-a17a-9d560d1786c7'
|
||||||
|
suffix = '_afc40...786c7'
|
||||||
|
expected = 'maldini%s' % suffix
|
||||||
|
short_name = utils.get_name_and_uuid('maldini', uuid)
|
||||||
|
self.assertEqual(expected, short_name)
|
||||||
|
|
||||||
|
name = 'X' * 255
|
||||||
|
expected = '%s%s' % ('X' * (80 - len(suffix)), suffix)
|
||||||
|
short_name = utils.get_name_and_uuid(name, uuid)
|
||||||
|
self.assertEqual(expected, short_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user