Skip to content

Commit

Permalink
Merge pull request #8 from jalapeno-api-gateway/add-delay-impairments
Browse files Browse the repository at this point in the history
WIP: add bandwidth, packet loss impairments
  • Loading branch information
severindellsperger authored Feb 27, 2024
2 parents 0787651 + 6d9d1b1 commit d6d95eb
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 21 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/google/uuid v1.3.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.3
github.com/jalapeno-api-gateway/jagw-go v1.3.4-beta
github.com/nqd/flat v0.1.1
github.com/sirupsen/logrus v1.9.0
google.golang.org/grpc v1.51.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf h1:7JTmne
github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
github.com/jalapeno-api-gateway/jagw-go v1.3.3 h1:+dBl0it3SxQeKF0VuoiSs/m1INCdcc3FbkjfZX5dTfk=
github.com/jalapeno-api-gateway/jagw-go v1.3.3/go.mod h1:qAWkx3+8xsQj5rvtoEpfaMok6zpgS8VU7Huytf9sybk=
github.com/jalapeno-api-gateway/jagw-go v1.3.4-alpha h1:LzoRb4nAV9fNjo5VslIxHsQgqLX4MWHl4mYT3TGUhJk=
github.com/jalapeno-api-gateway/jagw-go v1.3.4-alpha/go.mod h1:qAWkx3+8xsQj5rvtoEpfaMok6zpgS8VU7Huytf9sybk=
github.com/jalapeno-api-gateway/jagw-go v1.3.4-beta h1:jD8g/ghSfrIsWPZzX8GSvLPAAtQ6CCJSpJnDucb+vfk=
github.com/jalapeno-api-gateway/jagw-go v1.3.4-beta/go.mod h1:qAWkx3+8xsQj5rvtoEpfaMok6zpgS8VU7Huytf9sybk=
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
Expand Down
6 changes: 6 additions & 0 deletions pkg/arango/document-types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ type LSLink struct {
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"`
}

type LSPrefix struct {
Expand Down
6 changes: 6 additions & 0 deletions pkg/model/property/class-properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ var AllLsLinkProperties = []string{
RemoteIgpRouterId,
UnidirLinkDelay,
UnidirLinkDelayMinMax,
MaxLinkBWKbps,
UnidirDelayVariation,
UnidirPacketLoss,
UnidirResidualBW,
UnidirAvailableBW,
UnidirBWUtilization,
}

var AllLsPrefixProperties = []string{
Expand Down
6 changes: 6 additions & 0 deletions pkg/model/property/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,10 @@ const (
Longitude = "Longitude"
UnidirLinkDelay = "UnidirLinkDelay"
UnidirLinkDelayMinMax = "UnidirLinkDelayMinMax"
MaxLinkBWKbps = "MaxLinkBWKbps"
UnidirDelayVariation = "UnidirDelayVariation"
UnidirPacketLoss = "UnidirPacketLoss"
UnidirResidualBW = "UnidirResidualBW"
UnidirAvailableBW = "UnidirAvailableBW"
UnidirBWUtilization = "UnidirBWUtilization"
)
6 changes: 6 additions & 0 deletions pkg/model/topology/document-converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ func ConvertLsLink(doc arango.LSLink) LsLink {
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,
}
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/model/topology/documents.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ type LsLink struct {
RemoteIgpRouterId string
UnidirLinkDelay uint32
UnidirLinkDelayMinMax []uint32
MaxLinkBWKbps uint64
UnidirDelayVariation uint32
UnidirPacketLoss float32
UnidirResidualBW uint32
UnidirAvailableBW uint32
UnidirBWUtilization uint32
}

type LsPrefix struct {
Expand Down
12 changes: 12 additions & 0 deletions pkg/requestservice/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ func convertLsLink(doc interface{}, properties []string) *jagw.LsLink {
lsLink.UnidirLinkDelay = proto.Uint32(document.UnidirLinkDelay)
case property.UnidirLinkDelayMinMax:
lsLink.UnidirLinkDelayMinMax = document.UnidirLinkDelayMinMax
case property.MaxLinkBWKbps:
lsLink.MaxLinkBwKbps = proto.Uint64(document.MaxLinkBWKbps)
case property.UnidirDelayVariation:
lsLink.UnidirDelayVariation = proto.Uint32(document.UnidirDelayVariation)
case property.UnidirPacketLoss:
lsLink.UnidirPacketLoss = proto.Float32(document.UnidirPacketLoss)
case property.UnidirResidualBW:
lsLink.UnidirResidualBw = proto.Uint32(document.UnidirResidualBW)
case property.UnidirAvailableBW:
lsLink.UnidirAvailableBw = proto.Uint32(document.UnidirAvailableBW)
case property.UnidirBWUtilization:
lsLink.UnidirBwUtilization = proto.Uint32(document.UnidirBWUtilization)
}
}

Expand Down
48 changes: 28 additions & 20 deletions pkg/subscriptionservice/topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,34 @@ func convertLsLinkEvent(event messages.TopologyEvent) *jagw.LsLinkEvent {
}

response.LsLink = &jagw.LsLink{
Key: proto.String(document.Key),
Id: proto.String(document.ID),
RouterHash: proto.String(document.RouterHash),
RouterIp: proto.String(document.RouterIP),
DomainId: proto.Int64(document.DomainID),
PeerHash: proto.String(document.PeerHash),
PeerIp: proto.String(document.PeerIP),
PeerAsn: proto.Int32(document.PeerASN),
Timestamp: proto.String(document.Timestamp),
IgpRouterId: proto.String(document.IGPRouterID),
Protocol: proto.String(document.Protocol),
AreaId: proto.String(document.AreaID),
Nexthop: proto.String(document.Nexthop),
Mtid: convertMTID(document.MTID),
LocalLinkIp: proto.String(document.LocalLinkIP),
RemoteLinkIp: proto.String(document.RemoteLinkIP),
IgpMetric: proto.Uint32(document.IGPMetric),
RemoteNodeHash: proto.String(document.RemoteNodeHash),
LocalNodeHash: proto.String(document.LocalNodeHash),
RemoteIgpRouterId: proto.String(document.RemoteIGPRouterID),
Key: proto.String(document.Key),
Id: proto.String(document.ID),
RouterHash: proto.String(document.RouterHash),
RouterIp: proto.String(document.RouterIP),
DomainId: proto.Int64(document.DomainID),
PeerHash: proto.String(document.PeerHash),
PeerIp: proto.String(document.PeerIP),
PeerAsn: proto.Int32(document.PeerASN),
Timestamp: proto.String(document.Timestamp),
IgpRouterId: proto.String(document.IGPRouterID),
Protocol: proto.String(document.Protocol),
AreaId: proto.String(document.AreaID),
Nexthop: proto.String(document.Nexthop),
Mtid: convertMTID(document.MTID),
LocalLinkIp: proto.String(document.LocalLinkIP),
RemoteLinkIp: proto.String(document.RemoteLinkIP),
IgpMetric: proto.Uint32(document.IGPMetric),
RemoteNodeHash: proto.String(document.RemoteNodeHash),
LocalNodeHash: proto.String(document.LocalNodeHash),
RemoteIgpRouterId: proto.String(document.RemoteIGPRouterID),
UnidirLinkDelay: proto.Uint32(document.UnidirLinkDelay),
UnidirLinkDelayMinMax: document.UnidirLinkDelayMinMax,
MaxLinkBwKbps: proto.Uint64(document.MaxLinkBWKbps),
UnidirDelayVariation: proto.Uint32(document.UnidirDelayVariation),
UnidirPacketLoss: proto.Float32(document.UnidirPacketLoss),
UnidirResidualBw: proto.Uint32(document.UnidirResidualBW),
UnidirAvailableBw: proto.Uint32(document.UnidirAvailableBW),
UnidirBwUtilization: proto.Uint32(document.UnidirBWUtilization),
}

return response
Expand Down
6 changes: 6 additions & 0 deletions proto/core/topology.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ message LsLink {
optional string remote_igp_router_id = 22;
optional uint32 unidir_link_delay = 23;
repeated uint32 unidir_link_delay_min_max = 24;
optional uint64 max_link_bw_kbps = 25;
optional uint32 unidir_delay_variation = 26;
optional float unidir_packet_loss = 27;
optional uint32 unidir_residual_bw = 28;
optional uint32 unidir_available_bw = 29;
optional uint32 unidir_bw_utilization = 30;
}

message LsPrefix {
Expand Down

0 comments on commit d6d95eb

Please sign in to comment.