+ if not files_only:
+ logger.verbose('net:InitInterfaces bringing up {}'.format(dev))
+ os.system("/sbin/ifup {}".format(dev))
+
+ # Bring up the bridge devices
+ for bridge in bridgeDevices:
+ if not files_only and bridge in newdevs:
+ logger.verbose('net:InitInterfaces bringing up bridge {}'.format(bridge))
+ os.system("/sbin/ifup {}".format(bridge))
+
+##
+# Prepare the interface details.
+#
+def prepDetails(interface, hostname=''):
+ details = {}
+ details['ONBOOT'] = 'yes'
+ details['USERCTL'] = 'no'
+ # starting with f27, it's OK to use NetworkManager
+ # attempt to work around issues seen starting with f23
+ # details['NM_CONTROLLED'] = 'no'
+ if interface['mac']:
+ details['HWADDR'] = interface['mac']
+ if interface['is_primary']:
+ details['PRIMARY'] = 'yes'
+
+ if interface['method'] == "static":
+ details['BOOTPROTO'] = "static"
+ details['IPADDR'] = interface['ip']
+ details['NETMASK'] = interface['netmask']
+ details['GATEWAY'] = interface['gateway']
+ if interface['is_primary']:
+ if interface['dns1']:
+ details['DNS1'] = interface['dns1']
+ if interface['dns2']:
+ details['DNS2'] = interface['dns2']
+
+ elif interface['method'] == "dhcp":
+ details['BOOTPROTO'] = "dhcp"
+ details['PERSISTENT_DHCLIENT'] = "yes"
+ if interface['hostname']:
+ details['DHCP_HOSTNAME'] = interface['hostname']
+ else:
+ details['DHCP_HOSTNAME'] = hostname
+ if not interface['is_primary']:
+ details['DHCLIENTARGS'] = "-R subnet-mask"
+
+ return details
+
+##
+# Remove duplicate entry from the bridged interface's configuration file.
+#
+def removeBridgedIfaceDetails(details):
+ # TD: Also added secondary IPv4 keys and IPv6 keys to the keys to be removed.
+ allKeys = [ 'PRIMARY', 'PERSISTENT_DHCLIENT', 'DHCLIENTARGS', 'DHCP_HOSTNAME',
+ 'BOOTPROTO', 'IPADDR', 'NETMASK', 'GATEWAY', 'DNS1', 'DNS2',
+ 'IPV6ADDR', 'IPV6_DEFAULTGW', 'IPV6ADDR_SECONDARIES',
+ 'IPV6_AUTOCONF', 'IPV6INIT' ]
+ for i in range(1, 256):
+ allKeys.append('IPADDR' + str(i))
+ allKeys.append('NETMASK' + str(i))
+
+ for key in allKeys:
+ if key in details:
+ del details[key]
+
+ # TD: Also turn off IPv6
+ details['IPV6INIT'] = 'no'
+ details['IPV6_AUTOCONF'] = 'no'
+
+ return details
+
+def main():