WIP: Babel Version
This commit is contained in:
parent
eefcc272f9
commit
712a41b5fc
|
@ -60,3 +60,7 @@
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/shirou/gopsutil"
|
name = "github.com/shirou/gopsutil"
|
||||||
revision = "01487156ffd97029bd146658b44e4c0d06388d82"
|
revision = "01487156ffd97029bd146658b44e4c0d06388d82"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/Vivena/babelweb2"
|
||||||
|
|
|
@ -32,12 +32,12 @@ func (d *Daemon) updateNeighbours(iface string, resp *data.ResponseData) {
|
||||||
resp.Neighbours.Babel = make(map[string]data.BabelNeighbours)
|
resp.Neighbours.Babel = make(map[string]data.BabelNeighbours)
|
||||||
d.babelData.Iter(func(bu parser.BabelUpdate) error {
|
d.babelData.Iter(func(bu parser.BabelUpdate) error {
|
||||||
sbu := bu.ToSUpdate()
|
sbu := bu.ToSUpdate()
|
||||||
if sbu.TableId != "interface" {
|
if sbu.Table != "interface" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if sbu.EntryData["up"].(bool) {
|
if sbu.EntryData["up"].(bool) {
|
||||||
addr := sbu.EntryData["ipv6"].(string)
|
addr := sbu.EntryData["ipv6"].(string)
|
||||||
resp.Neighbours.Babel[string(sbu.EntryId)] = data.BabelNeighbours{
|
resp.Neighbours.Babel[string(sbu.Entry)] = data.BabelNeighbours{
|
||||||
Protocol: "babel",
|
Protocol: "babel",
|
||||||
LinkLocalAddress: addr,
|
LinkLocalAddress: addr,
|
||||||
Neighbours: make(map[string]data.BabelLink),
|
Neighbours: make(map[string]data.BabelLink),
|
||||||
|
@ -48,7 +48,7 @@ func (d *Daemon) updateNeighbours(iface string, resp *data.ResponseData) {
|
||||||
|
|
||||||
d.babelData.Iter(func(bu parser.BabelUpdate) error {
|
d.babelData.Iter(func(bu parser.BabelUpdate) error {
|
||||||
sbu := bu.ToSUpdate()
|
sbu := bu.ToSUpdate()
|
||||||
if sbu.TableId != "neighbour" {
|
if sbu.Table != "neighbour" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ifname, ok := sbu.EntryData["if"].(string)
|
ifname, ok := sbu.EntryData["if"].(string)
|
||||||
|
|
|
@ -56,6 +56,9 @@ func (d *Daemon) updateNodeinfo(iface string, resp *data.ResponseData) {
|
||||||
if v, err := ioutil.ReadFile("/sys/module/batman_adv/version"); err == nil {
|
if v, err := ioutil.ReadFile("/sys/module/batman_adv/version"); err == nil {
|
||||||
resp.Nodeinfo.Software.BatmanAdv.Version = trim(string(v))
|
resp.Nodeinfo.Software.BatmanAdv.Version = trim(string(v))
|
||||||
}
|
}
|
||||||
|
if babel := d.babelData; babel != nil {
|
||||||
|
resp.Nodeinfo.Software.Babeld.Version = babel.Version
|
||||||
|
}
|
||||||
|
|
||||||
if resp.Nodeinfo.Network.Mac == "" {
|
if resp.Nodeinfo.Network.Mac == "" {
|
||||||
resp.Nodeinfo.Network.Mac = fmt.Sprintf("%s:%s:%s:%s:%s:%s", nodeID[0:2], nodeID[2:4], nodeID[4:6], nodeID[6:8], nodeID[8:10], nodeID[10:12])
|
resp.Nodeinfo.Network.Mac = fmt.Sprintf("%s:%s:%s:%s:%s:%s", nodeID[0:2], nodeID[2:4], nodeID[4:6], nodeID[6:8], nodeID[8:10], nodeID[10:12])
|
||||||
|
@ -96,7 +99,7 @@ func (d *Daemon) updateNodeinfo(iface string, resp *data.ResponseData) {
|
||||||
|
|
||||||
d.babelData.Iter(func(bu babelParser.BabelUpdate) error {
|
d.babelData.Iter(func(bu babelParser.BabelUpdate) error {
|
||||||
sbu := bu.ToSUpdate()
|
sbu := bu.ToSUpdate()
|
||||||
if sbu.TableId != "interface" {
|
if sbu.Table != "interface" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if sbu.EntryData["up"].(bool) {
|
if sbu.EntryData["up"].(bool) {
|
||||||
|
|
Loading…
Reference in New Issue