MCPcopy Create free account
hub / github.com/deepflowio/deepflow / tableVinterface

Function tableVinterface

cli/ctl/genesis.go:317–352  ·  view source on GitHub ↗
(response *simplejson.Json, table *tablewriter.Table)

Source from the content-addressed store, hash-verified

315}
316
317func tableVinterface(response *simplejson.Json, table *tablewriter.Table) {
318 table.SetHeader([]string{"MAC", "NAME", "TAP_MAC", "TAP_NAME", "IF_TYPE", "DEVICE_TYPE", "DEVICE_NAME", "HOST_IP", "AGENT_ID", "CLUSTER_ID", "NETNS_ID", "TEAM_ID", "IP"})
319
320 tableItems := [][]string{}
321 for i := range response.Get("DATA").MustArray() {
322 data := response.Get("DATA").GetIndex(i)
323 ipsString := data.Get("IPS").MustString()
324 ips := strings.Split(ipsString, ",")
325 if len(ips) == 0 {
326 ips = []string{""}
327 }
328 for index, ip := range ips {
329 if index != 0 && ip == "" {
330 continue
331 }
332 tableItem := []string{}
333 tableItem = append(tableItem, data.Get("MAC").MustString())
334 tableItem = append(tableItem, data.Get("NAME").MustString())
335 tableItem = append(tableItem, data.Get("TAP_MAC").MustString())
336 tableItem = append(tableItem, data.Get("TAP_NAME").MustString())
337 tableItem = append(tableItem, data.Get("IF_TYPE").MustString())
338 tableItem = append(tableItem, data.Get("DEVICE_TYPE").MustString())
339 tableItem = append(tableItem, data.Get("DEVICE_NAME").MustString())
340 tableItem = append(tableItem, data.Get("HOST_IP").MustString())
341 tableItem = append(tableItem, strconv.Itoa(data.Get("VTAP_ID").MustInt()))
342 tableItem = append(tableItem, data.Get("KUBERNETES_CLUSTER_ID").MustString())
343 tableItem = append(tableItem, strconv.Itoa(data.Get("NETNS_ID").MustInt()))
344 tableItem = append(tableItem, strconv.Itoa(data.Get("TEAM_ID").MustInt()))
345 tableItem = append(tableItem, ip)
346 tableItems = append(tableItems, tableItem)
347 }
348 }
349
350 table.AppendBulk(tableItems)
351 table.Render()
352}
353
354func tableProcess(response *simplejson.Json, table *tablewriter.Table) {
355 table.SetHeader([]string{"PID", "AGENT_ID", "NETNS_ID", "NAME", "PROCESS_NAME", "USER", "START_TIME"})

Callers 1

syncInfoFunction · 0.85

Calls 4

SetHeaderMethod · 0.80
AppendBulkMethod · 0.80
RenderMethod · 0.80
GetMethod · 0.65

Tested by

no test coverage detected