def _add_nic_to_mapping(self, net, dom, nic):
dom_name = dom['<STR_LIT:name>']<EOL>idx = dom['<STR_LIT>'].index(nic)<EOL>name = '<STR_LIT>'.format(dom_name, idx)<EOL>net['<STR_LIT>'][name] = nic['<STR_LIT>']<EOL>if dom['<STR_LIT>'][idx]['<STR_LIT>'] == dom['<STR_LIT>']:<EOL><INDENT>net['<STR_LIT>'][dom_name] = nic['<STR_LIT>']<EOL><DEDENT>name_by_net = '<STR_LIT>'.format(dom_name, nic['<STR_LIT>'])<EOL>named_nets = sorted(<EOL>[<EOL>net_name for net_name in list(net['<STR_LIT>'].keys())<EOL>if net_name.startswith(name_by_net) and net_name != name_by_net<EOL>]<EOL>)<EOL>if len(named_nets) == <NUM_LIT:0>:<EOL><INDENT>named_idx = <NUM_LIT:0><EOL>net['<STR_LIT>'][name_by_net] = nic['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>named_idx = len(named_nets)<EOL><DEDENT>named_net = '<STR_LIT>'.format(name_by_net, named_idx)<EOL>net['<STR_LIT>'][named_net] = nic['<STR_LIT>']<EOL>
Populates the given net spec mapping entry with the nics of the given
domain, by the following rules:

    * If ``net`` is management, 'domain_name': nic_ip
    * For each interface: 'domain_name-eth#': nic_ip, where # is the
    index of the nic in the *domain* definition.
    * For each interface: 'domain_name-net_name-#': nic_ip,
    where # is a running number of interfaces from that network.
    * For each interface: 'domain_name-net_name', which has an
    identical IP to 'domain_name-net_name-0'


Args:
    net (dict): Network spec to populate
    dom (dict): libvirt domain specification
    nic (str): Name of the interface to add to the net mapping from the
        domain

Returns:
    None