func NewOvsdbProbeFromConfig(g *graph.Graph, n *graph.Node) *OvsdbProbe { address := config.GetConfig().GetString("ovs.ovsdb") var protocol string var target string if strings.HasPrefix(address, "unix://") { target = strings.TrimPrefix(address, "unix://") protocol = "unix" } else if strings.HasPrefix(address, "tcp://") { target = strings.TrimPrefix(address, "tcp://") protocol = "tcp" } else { // fallback to the original address format addr:port addr, port, err := config.GetHostPortAttributes("ovs", "ovsdb") if err != nil { logging.GetLogger().Errorf("Configuration error: %s", err.Error()) return nil } protocol = "tcp" target = fmt.Sprintf("%s:%d", addr, port) } return NewOvsdbProbe(g, n, protocol, target) }
func NewSFlowAgentFromConfig(u string, ft *flow.Table) (*SFlowAgent, error) { addr, port, err := config.GetHostPortAttributes("sflow", "listen") if err != nil { return nil, err } return NewSFlowAgent(u, addr, port, ft), nil }
func NewServerFromConfig(s string) (*Server, error) { auth, err := NewAuthenticationBackendFromConfig() if err != nil { return nil, err } addr, port, err := config.GetHostPortAttributes(s, "listen") if err != nil { return nil, errors.New("Configuration error: " + err.Error()) } return NewServer(s, addr, port, auth), nil }