Exemple #1
0
func (g *GremlinQueryHelper) GremlinQuery(t *testing.T, query string, values interface{}) {
	body, err := cmd.SendGremlinQuery(g.authOptions, query)
	if err != nil {
		t.Fatalf("Error while executing query %s: %s", query, err.Error())
	}

	err = json.NewDecoder(body).Decode(values)
	if err != nil {
		t.Fatal(err.Error())
	}
}
Exemple #2
0
func (g *GremlinQueryHelper) GetFlowMetricFromGremlinReply(t *testing.T, query string) flow.FlowMetric {
	body, err := cmd.SendGremlinQuery(g.authOptions, query)
	if err != nil {
		t.Fatalf("%s: %s", query, err.Error())
	}

	var metric flow.FlowMetric
	err = json.NewDecoder(body).Decode(&metric)
	if err != nil {
		t.Fatal(err.Error())
	}

	return metric
}
Exemple #3
0
func (g *GremlinQueryHelper) GetFlowSetBandwidthFromGremlinReply(t *testing.T, query string) flow.FlowSetBandwidth {
	body, err := cmd.SendGremlinQuery(g.authOptions, query)
	if err != nil {
		t.Fatalf("%s: %s", query, err.Error())
	}

	var bw []flow.FlowSetBandwidth
	err = json.NewDecoder(body).Decode(&bw)
	if err != nil {
		t.Fatal(err.Error())
	}

	return bw[0]
}