MCPcopy Create free account
hub / github.com/Edgio/vflow / LoadExtElements

Function LoadExtElements

ipfix/rfc5102_model.go:622–653  ·  view source on GitHub ↗

LoadExtElements loads ipfix elements information through ipfix.elemets file

(cfgPath string)

Source from the content-addressed store, hash-verified

620
621// LoadExtElements loads ipfix elements information through ipfix.elemets file
622func LoadExtElements(cfgPath string) error {
623 var (
624 file = path.Join(cfgPath, "ipfix.elements")
625 ipfixElements map[uint32]map[uint16][]string
626 )
627
628 if _, err := os.Stat(file); os.IsNotExist(err) {
629 return nil
630 }
631
632 b, err := ioutil.ReadFile(file)
633 if err != nil {
634 return err
635 }
636 err = yaml.Unmarshal(b, &ipfixElements)
637 if err != nil {
638 return err
639 }
640
641 InfoModel = make(map[ElementKey]InfoElementEntry)
642
643 for PEN, elements := range ipfixElements {
644 for elementID, prop := range elements {
645 if len(prop) > 1 {
646 InfoModel[ElementKey{PEN, elementID}] =
647 InfoElementEntry{FieldID: elementID, Name: prop[0], Type: FieldTypes[prop[1]]}
648 }
649 }
650 }
651
652 return nil
653}

Callers 1

runMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected