func (c *Csv) AssetIterByIP() {
	defer close(c.AssetsChan)
	csvAssets := c.readCsv()
	ips := c.Config.FilterParams.Ips
	assets := make([]asset.Asset, 0)
	for _, ip := range strings.Split(ips, ",") {
		a := asset.Asset{IPAddresses: []string{ip}}
		c.Log.Debug("looking up attributes for IP: ", ip)
		for _, item := range csvAssets {
			if item == nil {
				continue
			}
			if item.BmcAddress == "" {
				continue
			}
			if item.BmcAddress == ip {
				a.Serial = item.Serial
				a.Vendor = item.Vendor
				a.Type = item.Type
			}
		}
		assets = append(assets, a)
	}
	c.AssetsChan <- assets
}
AssetIterByIP reads in list of ips passed in via cli,
attempts to lookup any attributes for the IP in the inventory,
and sends an asset for each attribute over the asset channel
package inventory
import (
	"os"
	"strings"
	"github.com/gocarina/gocsv"
	"github.com/sirupsen/logrus"
	"github.com/bmc-toolbox/bmcbutler/pkg/asset"
	"github.com/bmc-toolbox/bmcbutler/pkg/config"
)
type Csv struct {
	Config          *config.Params
	Log             *logrus.Logger
	BatchSize       int  
	AssetsChan      chan<- []asset.Asset
	FilterAssetType []string
}
type CsvAsset struct {
	BmcAddress string `csv:"bmcaddress"`
	Serial     string `csv:"serial"`  
	Vendor     string `csv:"vendor"`  
	Type       string `csv:"type"`    
}
func (c *Csv) readCsv() []*CsvAsset {
	log := c.Log
	var csvAssets []*CsvAsset
	csvFile, err := os.Open(c.Config.Inventory.Csv.File)
	if err != nil {
		log.Error("Error: ", err)
		os.Exit(1)
	}
	err = gocsv.UnmarshalFile(csvFile, &csvAssets)
	if err != nil {
		log.Error("Error: ", err)
		os.Exit(1)
	}
	return csvAssets
}
func (c *Csv) AssetRetrieve() func() {
	switch {
	case c.Config.FilterParams.Chassis:
		c.FilterAssetType = append(c.FilterAssetType, "chassis")
	case c.Config.FilterParams.Servers:
		c.FilterAssetType = append(c.FilterAssetType, "servers")
	case !c.Config.FilterParams.Chassis && !c.Config.FilterParams.Servers:
		c.FilterAssetType = []string{"chassis", "servers"}
	}
	switch {
	case c.Config.FilterParams.Serials != "":
		return c.AssetIterBySerial
	case c.Config.FilterParams.Ips != "":
		return c.AssetIterByIP
	default:
		return c.AssetIter
	}
}
func (c *Csv) AssetIterBySerial() {
	log := c.Log
	csvAssets := c.readCsv()
	serials := c.Config.FilterParams.Serials
	assets := make([]asset.Asset, 0)
	for _, serial := range strings.Split(serials, ",") {
		log.Debug("Fetching asset from csv by serial: ", serial)
		for _, item := range csvAssets {
			if item == nil {
				continue
			}
			if item.BmcAddress == "" {
				continue
			}
			if item.Serial == serial {
				assets = append(assets, asset.Asset{IPAddresses: []string{item.BmcAddress},
					Serial: item.Serial,
					Vendor: item.Vendor,
					Type:   item.Type})
			}
		}
	}
	c.AssetsChan <- assets
	close(c.AssetsChan)
}