def _get_veths(net_data):
 if isinstance(net_data, dict):
  net_data = list(net_data.items())
 nics = salt.utils.odict.OrderedDict()
 current_nic = salt.utils.odict.OrderedDict()
 no_names = True
 for item in net_data:
  if (item and isinstance(item, dict)):
   item = list(item.items())[0]
  elif isinstance(item, six.string_types):
   sitem = item.strip()
   if (sitem.startswith('#') or (not sitem)):
    continue
   elif ('=' in item):
    item = tuple([a.strip() for a in item.split('=', 1)])
  if (item[0] == 'lxc.network.type'):
   current_nic = salt.utils.odict.OrderedDict()
  if (item[0] == 'lxc.network.name'):
   no_names = False
   nics[item[1].strip()] = current_nic
  current_nic[item[0].strip()] = item[1].strip()
 if (no_names and current_nic):
  nics[DEFAULT_NIC] = current_nic
 return nics

def _get_veths ( net_data ) : if isinstance ( net_data , dict ) : net_data = list ( net_data . items ( ) ) nics = salt . utils . odict . OrderedDict ( ) current_nic = salt . utils . odict . OrderedDict ( ) no_names = True for item in net_data : if ( item and isinstance ( item , dict ) ) : item = list ( item . items ( ) ) [ 0 ] elif isinstance ( item , six . string_types ) : sitem = item . strip ( ) if ( sitem . startswith ( '#' ) or ( not sitem ) ) : continue elif ( '=' in item ) : item = tuple ( [ a . strip ( ) for a in item . split ( '=' , 1 ) ] ) if ( item [ 0 ] == 'lxc.network.type' ) : current_nic = salt . utils . odict . OrderedDict ( ) if ( item [ 0 ] == 'lxc.network.name' ) : no_names = False nics [ item [ 1 ] . strip ( ) ] = current_nic current_nic [ item [ 0 ] . strip ( ) ] = item [ 1 ] . strip ( ) if ( no_names and current_nic ) : nics [ DEFAULT_NIC ] = current_nic return nics
parse the nic setup inside lxc conf tuples back to a dictionary indexed by network interface .