Skip to content

Commit

Permalink
Merge pull request #11 from jalapeno-api-gateway/add-normalized-fields
Browse files Browse the repository at this point in the history
Add normalized fields
  • Loading branch information
severindellsperger authored Jun 13, 2024
2 parents 0c4e32c + b4f8861 commit 214ca46
Show file tree
Hide file tree
Showing 13 changed files with 296 additions and 325 deletions.
44 changes: 23 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
module github.com/jalapeno-api-gateway/jagw

go 1.18
go 1.21

require (
github.com/Shopify/sarama v1.37.2
github.com/arangodb/go-driver v1.4.0
github.com/IBM/sarama v1.43.2
github.com/arangodb/go-driver v1.6.2
github.com/go-redis/redis/v8 v8.11.5
github.com/google/uuid v1.3.0
github.com/google/uuid v1.6.0
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf
github.com/jalapeno-api-gateway/jagw-go v1.3.4
github.com/nqd/flat v0.1.1
github.com/sirupsen/logrus v1.9.0
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.28.1
github.com/nqd/flat v0.2.0
github.com/sirupsen/logrus v1.9.3
google.golang.org/protobuf v1.34.2
)

require (
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/eapache/go-resiliency v1.3.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/go-resiliency v1.6.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
Expand All @@ -33,15 +30,20 @@ require (
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.0.0-20220927171203-f486391704dc // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect
)

require (
github.com/jalapeno-api-gateway/jagw-go v1.3.5
golang.org/x/sys v0.21.0 // indirect
google.golang.org/grpc v1.64.0
)
196 changes: 69 additions & 127 deletions go.sum

Large diffs are not rendered by default.

59 changes: 31 additions & 28 deletions pkg/arango/document-types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,37 @@ type LSNode struct {
}

type LSLink struct {
ID string `json:"_id,omitempty"`
Key string `json:"_key,omitempty"`
RouterHash string `json:"router_hash,omitempty"`
RouterIP string `json:"router_ip,omitempty"`
DomainID int64 `json:"domain_id,omitempty"`
PeerHash string `json:"peer_hash,omitempty"`
PeerIP string `json:"peer_ip,omitempty"`
PeerASN int32 `json:"peer_asn,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
IGPRouterID string `json:"igp_router_id,omitempty"`
Protocol string `json:"protocol,omitempty"`
AreaID string `json:"area_id,omitempty"`
Nexthop string `json:"nexthop,omitempty"`
MTID *MultiTopologyIdentifier `json:"mt_id_tlv,omitempty"`
LocalLinkIP string `json:"local_link_ip,omitempty"`
RemoteLinkIP string `json:"remote_link_ip,omitempty"`
IGPMetric uint32 `json:"igp_metric,omitempty"`
RemoteNodeHash string `json:"remote_node_hash,omitempty"`
LocalNodeHash string `json:"local_node_hash,omitempty"`
RemoteIGPRouterID string `json:"remote_igp_router_id,omitempty"`
UnidirLinkDelay uint32 `json:"unidir_link_delay,omitempty"`
UnidirLinkDelayMinMax []uint32 `json:"unidir_link_delay_min_max,omitempty"`
MaxLinkBWKbps uint64 `json:"max_link_bw_kbps,omitempty"`
UnidirDelayVariation uint32 `json:"unidir_delay_variation,omitempty"`
UnidirPacketLoss float32 `json:"unidir_packet_loss,omitempty"`
UnidirResidualBW uint32 `json:"unidir_residual_bw,omitempty"`
UnidirAvailableBW uint32 `json:"unidir_available_bw,omitempty"`
UnidirBWUtilization uint32 `json:"unidir_bw_utilization,omitempty"`
ID string `json:"_id,omitempty"`
Key string `json:"_key,omitempty"`
RouterHash string `json:"router_hash,omitempty"`
RouterIP string `json:"router_ip,omitempty"`
DomainID int64 `json:"domain_id,omitempty"`
PeerHash string `json:"peer_hash,omitempty"`
PeerIP string `json:"peer_ip,omitempty"`
PeerASN int32 `json:"peer_asn,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
IGPRouterID string `json:"igp_router_id,omitempty"`
Protocol string `json:"protocol,omitempty"`
AreaID string `json:"area_id,omitempty"`
Nexthop string `json:"nexthop,omitempty"`
MTID *MultiTopologyIdentifier `json:"mt_id_tlv,omitempty"`
LocalLinkIP string `json:"local_link_ip,omitempty"`
RemoteLinkIP string `json:"remote_link_ip,omitempty"`
IGPMetric uint32 `json:"igp_metric,omitempty"`
RemoteNodeHash string `json:"remote_node_hash,omitempty"`
LocalNodeHash string `json:"local_node_hash,omitempty"`
RemoteIGPRouterID string `json:"remote_igp_router_id,omitempty"`
UnidirLinkDelay uint32 `json:"unidir_link_delay,omitempty"`
UnidirLinkDelayMinMax []uint32 `json:"unidir_link_delay_min_max,omitempty"`
MaxLinkBwKbps uint64 `json:"max_link_bw_kbps,omitempty"`
UnidirDelayVariation uint32 `json:"unidir_delay_variation,omitempty"`
UnidirPacketLoss float32 `json:"unidir_packet_loss,omitempty"`
UnidirResidualBw uint32 `json:"unidir_residual_bw,omitempty"`
UnidirAvailableBw uint32 `json:"unidir_available_bw,omitempty"`
UnidirBwUtilization uint32 `json:"unidir_bw_utilization,omitempty"`
NormalizedUnidirLinkDelay float64 `json:"normalized_unidir_link_delay,omitempty"`
NormalizedUnidirDelayVariation float64 `json:"normalized_unidir_delay_variation,omitempty"`
NormalizedUnidirPacketLoss float64 `json:"normalized_unidir_packet_loss,omitempty"`
}

type LSPrefix struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/messages/consume.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package messages
import (
"os"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/messages/eventlisteners.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package messages

import (
"github.com/Shopify/sarama"
"github.com/IBM/sarama"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/messages/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package messages
import (
"encoding/json"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
"github.com/jalapeno-api-gateway/jagw/pkg/model/class"
"github.com/sirupsen/logrus"
)
Expand Down
11 changes: 7 additions & 4 deletions pkg/model/property/class-properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ var AllLsLinkProperties = []string{
RemoteIgpRouterId,
UnidirLinkDelay,
UnidirLinkDelayMinMax,
MaxLinkBWKbps,
MaxLinkBwKbps,
UnidirDelayVariation,
UnidirPacketLoss,
UnidirResidualBW,
UnidirAvailableBW,
UnidirBWUtilization,
UnidirResidualBw,
UnidirAvailableBw,
UnidirBwUtilization,
NormalizedUnidirLinkDelay,
NormalizedUnidirDelayVariation,
NormalizedUnidirPacketLoss,
}

var AllLsPrefixProperties = []string{
Expand Down
103 changes: 53 additions & 50 deletions pkg/model/property/property.go
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
package property

const (
Key = "Key"
Id = "Id"
RouterHash = "RouterHash"
DomainId = "DomainId"
RouterIp = "RouterIp"
PeerHash = "PeerHash"
PeerIp = "PeerIp"
PeerAsn = "PeerASN"
Timestamp = "Timestamp"
IgpRouterId = "IgpRouterId"
Asn = "Asn"
Mtid = "Mtid"
AreaId = "AreaId"
Protocol = "Protocol"
ProtocolId = "ProtocolId"
Name = "Name"
IsPrepolicy = "IsPrepolicy"
IsAdjRibIn = "IsAdjRibIn"
Nexthop = "Nexthop"
LocalLinkIp = "LocalLinkIp"
RemoteLinkIp = "RemoteLinkIp"
IgpMetric = "IgpMetric"
RemoteNodeHash = "RemoteNodeHash"
LocalNodeHash = "LocalNodeHash"
RemoteIgpRouterId = "RemoteIgpRouterId"
Prefix = "Prefix"
PrefixLen = "PrefixLen"
PrefixMetric = "PrefixMetric"
LocalNodeAsn = "LocalNodeAsn"
IgpFlags = "IgpFlags"
Srv6Sid = "Srv6Sid"
DataRate = "DataRate"
PacketsSent = "PacketsSent"
PacketsReceived = "PacketsReceived"
State = "State"
LastStateTransitionTime = "LastStateTransitionTime"
From = "From"
To = "To"
Link = "Link"
LsNodeKey = "LsNodeKey"
Latitude = "Latitude"
Longitude = "Longitude"
UnidirLinkDelay = "UnidirLinkDelay"
UnidirLinkDelayMinMax = "UnidirLinkDelayMinMax"
MaxLinkBWKbps = "MaxLinkBWKbps"
UnidirDelayVariation = "UnidirDelayVariation"
UnidirPacketLoss = "UnidirPacketLoss"
UnidirResidualBW = "UnidirResidualBW"
UnidirAvailableBW = "UnidirAvailableBW"
UnidirBWUtilization = "UnidirBWUtilization"
Key = "Key"
Id = "Id"
RouterHash = "RouterHash"
DomainId = "DomainId"
RouterIp = "RouterIp"
PeerHash = "PeerHash"
PeerIp = "PeerIp"
PeerAsn = "PeerASN"
Timestamp = "Timestamp"
IgpRouterId = "IgpRouterId"
Asn = "Asn"
Mtid = "Mtid"
AreaId = "AreaId"
Protocol = "Protocol"
ProtocolId = "ProtocolId"
Name = "Name"
IsPrepolicy = "IsPrepolicy"
IsAdjRibIn = "IsAdjRibIn"
Nexthop = "Nexthop"
LocalLinkIp = "LocalLinkIp"
RemoteLinkIp = "RemoteLinkIp"
IgpMetric = "IgpMetric"
RemoteNodeHash = "RemoteNodeHash"
LocalNodeHash = "LocalNodeHash"
RemoteIgpRouterId = "RemoteIgpRouterId"
Prefix = "Prefix"
PrefixLen = "PrefixLen"
PrefixMetric = "PrefixMetric"
LocalNodeAsn = "LocalNodeAsn"
IgpFlags = "IgpFlags"
Srv6Sid = "Srv6Sid"
DataRate = "DataRate"
PacketsSent = "PacketsSent"
PacketsReceived = "PacketsReceived"
State = "State"
LastStateTransitionTime = "LastStateTransitionTime"
From = "From"
To = "To"
Link = "Link"
LsNodeKey = "LsNodeKey"
Latitude = "Latitude"
Longitude = "Longitude"
UnidirLinkDelay = "UnidirLinkDelay"
UnidirLinkDelayMinMax = "UnidirLinkDelayMinMax"
MaxLinkBwKbps = "MaxLinkBwKbps"
UnidirDelayVariation = "UnidirDelayVariation"
UnidirPacketLoss = "UnidirPacketLoss"
UnidirResidualBw = "UnidirResidualBw"
UnidirAvailableBw = "UnidirAvailableBw"
UnidirBwUtilization = "UnidirBwUtilization"
NormalizedUnidirLinkDelay = "NormalizedUnidirLinkDelay"
NormalizedUnidirDelayVariation = "NormalizedUnidirDelayVariation"
NormalizedUnidirPacketLoss = "NormalizedUnidirPacketLoss"
)
59 changes: 31 additions & 28 deletions pkg/model/topology/document-converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,37 @@ func ConvertLsNodeCoordinates(doc arango.LSNode_Coordinates) LsNodeCoordinates {

func ConvertLsLink(doc arango.LSLink) LsLink {
return LsLink{
Id: doc.ID,
Key: doc.Key,
RouterHash: doc.RouterHash,
RouterIp: doc.RouterIP,
DomainId: doc.DomainID,
PeerHash: doc.PeerHash,
PeerIp: doc.PeerIP,
PeerAsn: doc.PeerASN,
Timestamp: doc.Timestamp,
IgpRouterId: doc.IGPRouterID,
Protocol: doc.Protocol,
AreaId: doc.AreaID,
Nexthop: doc.Nexthop,
Mtid: convertMtid(doc.MTID),
LocalLinkIp: doc.LocalLinkIP,
RemoteLinkIp: doc.RemoteLinkIP,
IgpMetric: doc.IGPMetric,
RemoteNodeHash: doc.RemoteNodeHash,
LocalNodeHash: doc.LocalNodeHash,
RemoteIgpRouterId: doc.RemoteIGPRouterID,
UnidirLinkDelay: doc.UnidirLinkDelay,
UnidirLinkDelayMinMax: doc.UnidirLinkDelayMinMax,
MaxLinkBWKbps: doc.MaxLinkBWKbps,
UnidirDelayVariation: doc.UnidirDelayVariation,
UnidirPacketLoss: doc.UnidirPacketLoss,
UnidirResidualBW: doc.UnidirResidualBW,
UnidirAvailableBW: doc.UnidirAvailableBW,
UnidirBWUtilization: doc.UnidirBWUtilization,
Id: doc.ID,
Key: doc.Key,
RouterHash: doc.RouterHash,
RouterIp: doc.RouterIP,
DomainId: doc.DomainID,
PeerHash: doc.PeerHash,
PeerIp: doc.PeerIP,
PeerAsn: doc.PeerASN,
Timestamp: doc.Timestamp,
IgpRouterId: doc.IGPRouterID,
Protocol: doc.Protocol,
AreaId: doc.AreaID,
Nexthop: doc.Nexthop,
Mtid: convertMtid(doc.MTID),
LocalLinkIp: doc.LocalLinkIP,
RemoteLinkIp: doc.RemoteLinkIP,
IgpMetric: doc.IGPMetric,
RemoteNodeHash: doc.RemoteNodeHash,
LocalNodeHash: doc.LocalNodeHash,
RemoteIgpRouterId: doc.RemoteIGPRouterID,
UnidirLinkDelay: doc.UnidirLinkDelay,
UnidirLinkDelayMinMax: doc.UnidirLinkDelayMinMax,
MaxLinkBwKbps: doc.MaxLinkBwKbps,
UnidirDelayVariation: doc.UnidirDelayVariation,
UnidirPacketLoss: doc.UnidirPacketLoss,
UnidirResidualBw: doc.UnidirResidualBw,
UnidirAvailableBw: doc.UnidirAvailableBw,
UnidirBwUtilization: doc.UnidirBwUtilization,
NormalizedUnidirLinkDelay: doc.NormalizedUnidirLinkDelay,
NormalizedUnidirDelayVariation: doc.NormalizedUnidirDelayVariation,
NormalizedUnidirPacketLoss: doc.NormalizedUnidirPacketLoss,
}
}

Expand Down
Loading

0 comments on commit 214ca46

Please sign in to comment.