// XXX This should actually be done at the level of the ovsdb wrapper. // As in, you should only have to get the row once, and then populate a // struct with all necessary fields and have them be picked out into here func populatePortConfig(odb ovsdb.Ovsdb, bridge, port string) ( *ovsPort, error) { config := &ovsPort{ name: port, bridge: bridge, } iface, err := odb.GetDefaultOFInterface(port) if err != nil { return nil, err } itype, err := odb.GetOFInterfaceType(iface) if err != nil && !ovsdb.IsExist(err) { return nil, err } else if err == nil { switch itype { case "patch": config.patch = true } } peer, err := odb.GetOFInterfacePeer(iface) if err != nil && !ovsdb.IsExist(err) { return nil, err } else if err == nil { config.peer = peer } attachedMAC, err := odb.GetOFInterfaceAttachedMAC(iface) if err != nil && !ovsdb.IsExist(err) { return nil, err } else if err == nil { config.attachedMAC = attachedMAC } ifaceID, err := odb.GetOFInterfaceIfaceID(iface) if err != nil && !ovsdb.IsExist(err) { return nil, err } else if err == nil { config.ifaceID = ifaceID } return config, nil }