From c6e21c8bf6c80cd0daeec6ed3c6b957dc9ad2e74 Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Fri, 5 Aug 2016 16:16:14 -0400 Subject: Enhance and fix NIC mapping feature The original implementation supported a strictly numeric mapping scheme (e.g. nic1, nic2) that could misbehave if an active NIC was not listed in the user's mapping file. This change fixes the misbehavior, and enhances the feature by not requiring NIC aliases follow the numeric mapping scheme. This allows the user to choose meaningful names for the NIC aliases. NIC mapping now happens in two steps: 1) Process any user supplied mappings - NIC alias does not need to follow the numeric "nicN" scheme - Existing validation rules apply: mappings for inactive NICs are ignored (but logged), and duplicate mappings are rejected 2) Generate default mappings as needed - Only applies to active NICs that aren't already mapped - Follows the numeric scheme (nic1, nic2) using the NIC number based on the list of active NICs - No default mapping is assigned if another NIC is already using that numeric alias Change-Id: I6943623a51702349f6a7dcf2de8a8429078a3ab0 Closes-Bug: 1612723 --- os_net_config/tests/test_impl_ifcfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os_net_config/tests/test_impl_ifcfg.py') diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py index 467db65..9b24717 100644 --- a/os_net_config/tests/test_impl_ifcfg.py +++ b/os_net_config/tests/test_impl_ifcfg.py @@ -429,7 +429,7 @@ class TestIfcfgNetConfig(base.TestCase): self.stubs.Set(utils, 'interface_mac', test_interface_mac) nic_mapping = {'nic1': 'em1'} - self.stubbed_numbered_nics = nic_mapping + self.stubbed_mapped_nics = nic_mapping v4_addr = objects.Address('192.168.1.2/24') interface = objects.Interface('nic1', addresses=[v4_addr], nic_mapping=nic_mapping, -- cgit 1.2.3-korg