Skip to content

Commit

Permalink
adding support for isis info retrieval of ipv4 prefix and metric
Browse files Browse the repository at this point in the history
  • Loading branch information
vhowdhur committed Nov 18, 2022
1 parent 7558e3b commit cc99989
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
9 changes: 8 additions & 1 deletion internal/ixgnmi/isislsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
package ixgnmi

import (
"golang.org/x/net/context"
"fmt"
"path"

"golang.org/x/net/context"

log "github.com/golang/glog"
"github.com/openconfig/ondatra/binding/ixweb"
"github.com/openconfig/ondatra/internal/ixconfig"
Expand Down Expand Up @@ -108,6 +109,12 @@ func populateISIS(netInst *telemetry.NetworkInstance, learnedISIS []isisLearnedI
lsp.SetIsType(levelNum)
lsp.SetFlags(flags)
lsp.SetSequenceNumber(info.SeqNumber)
// TODO: Populate ipv4 prefixes based on learned info value when IxNetwork provides support.
extV4Prefix := lsp.
GetOrCreateTlv(telemetry.IsisLsdbTypes_ISIS_TLV_TYPE_EXTENDED_IPV4_REACHABILITY).
GetOrCreateExtendedIpv4Reachability().GetOrCreatePrefix(info.IPv4Prefix)
extV4Prefix.SetPrefix(info.IPv4Prefix)
extV4Prefix.SetMetric(uint32(info.Metric))
}
return nil
}
32 changes: 29 additions & 3 deletions internal/ixgnmi/isislsdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ func TestISISLSDBFromIxia(t *testing.T) {
desc: "full data",
getRsps: map[string]string{
isisID + "/learnedInfo/1/table/1": `{
"columns": ["Learned Via", "System ID", "Pseudo Node Index", "LSP Index", "Sequence Number"],
"columns": ["Learned Via", "System ID", "Pseudo Node Index", "LSP Index", "Sequence Number", "IPv4 Prefix", "Metric"],
"values": [
["L1", "01 23 45 67 89 AB", "2", "34", "5"],
["L2", "CD EF 01 23 45 67", "98", "7", "0"]
["L1", "01 23 45 67 89 AB", "2", "34", "5", "1.1.1.1", "20"],
["L2", "CD EF 01 23 45 67", "98", "7", "0", "2.2.2.2", "10"]
]
}`,
},
Expand All @@ -103,6 +103,19 @@ func TestISISLSDBFromIxia(t *testing.T) {
IsType: ygot.Uint8(1),
LspId: ygot.String("0123.4567.89AB.02-34"),
SequenceNumber: ygot.Uint32(5),
Tlv: map[telemetry.E_IsisLsdbTypes_ISIS_TLV_TYPE]*telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv{
telemetry.IsisLsdbTypes_ISIS_TLV_TYPE_EXTENDED_IPV4_REACHABILITY: &telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv{
Type: telemetry.IsisLsdbTypes_ISIS_TLV_TYPE_EXTENDED_IPV4_REACHABILITY,
ExtendedIpv4Reachability: &telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability{
Prefix: map[string]*telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix{
"1.1.1.1": &telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix{
Prefix: ygot.String("1.1.1.1"),
Metric: ygot.Uint32(20),
},
},
},
},
},
},
},
},
Expand All @@ -113,6 +126,19 @@ func TestISISLSDBFromIxia(t *testing.T) {
IsType: ygot.Uint8(2),
LspId: ygot.String("CDEF.0123.4567.98-07"),
SequenceNumber: ygot.Uint32(0),
Tlv: map[telemetry.E_IsisLsdbTypes_ISIS_TLV_TYPE]*telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv{
telemetry.IsisLsdbTypes_ISIS_TLV_TYPE_EXTENDED_IPV4_REACHABILITY: &telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv{
Type: telemetry.IsisLsdbTypes_ISIS_TLV_TYPE_EXTENDED_IPV4_REACHABILITY,
ExtendedIpv4Reachability: &telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability{
Prefix: map[string]*telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix{
"2.2.2.2": &telemetry.NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix{
Prefix: ygot.String("2.2.2.2"),
Metric: ygot.Uint32(10),
},
},
},
},
},
},
},
},
Expand Down

0 comments on commit cc99989

Please sign in to comment.