def all_bonding(vmid):
	vm = get_vm(vmid)
	addr = vm['mgraddr']
	
	result = []
	bond_dic = {}
	
	nics = FabricUtilNFV.getInterfaces(addr, vm['sshid'], vm['sshpw'], None)
	
	logger.debug(json.dumps(nics, indent=4))
	
	nicinfo = FabricUtilNFV.getIfConfig(addr, vm['sshid'], vm['sshpw'], "")
	
	#bonging 정보만 추출.
	for nic in nics:
		if "address" in nic and nic["address"] == 'dhcp':
			nic["ipaddr"] = nicinfo[nic["ethName"]]
				
		
		if nic["ethName"].startswith("bond"):
			nic['ethernets'] = []
			nic['config'] = FabricUtilNFV.get_vyatta_conf(vmid, "$SHOW interfaces")
			bond_dic[nic["ethName"]] = nic
		elif nic.has_key('bond-group'):
			bond_dic[nic["bond-group"]]['ethernets'].append(nic["ethName"])
			
	
	for bond_id in bond_dic:
		result.append(bond_dic[bond_id])
	
	
	return result
def get_bonding(vmid, bondid):
	vm = get_vm(vmid)
	
	addr = vm['mgraddr']

	results = {}
	nics = FabricUtilNFV.getInterfaces(addr, vm['sshid'], vm['sshpw'], None)
	bonding = {}
	nicinfo = FabricUtilNFV.getIfConfig(addr, vm['sshid'], vm['sshpw'], "")
	
	for nic in nics:
		logger.debug(bondid + ": " + nic['ethName'])
		if bondid == nic['ethName']:
			nic['config'] = FabricUtilNFV.get_vyatta_conf(vmid, "$SHOW interfaces")
			
			if "address" in nic and nic["address"] == 'dhcp':
				nic["ipaddr"] = nicinfo[nic['ethName']]
					
			
			bonding[bondid] = nic
			bonding['ethernets'] = []
			bonding['disables'] = []
			results['success'] = 'success'
			
		elif nic.has_key('bond-group') and bondid == nic['bond-group']:
			bonding['ethernets'].append(nic['ethName'])
		elif nic.has_key('bond-group'):
			bonding['disables'].append(nic['ethName'])
		
	if results.has_key('success'):
		results['msg'] = json.dumps(bonding)
	else:
		results['success'] = 'fail'
		results['errmsg'] = 'bonding not found.'

	return results