Skip to content

Commit

Permalink
Remove testbed port check for binding file (openconfig#2015)
Browse files Browse the repository at this point in the history
* Remove testbed port check for binding file

* removed unit test check for binding port in testbed file
  • Loading branch information
MarcCharlebois authored Aug 15, 2023
1 parent b9b39c0 commit 5c181ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
19 changes: 8 additions & 11 deletions topologies/binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,15 @@ func ports(tports []*opb.Port, bports []*bindpb.Port) (map[string]*binding.Port,
}
}
for _, bport := range bports {
p, ok := portmap[bport.Id]
if !ok {
errs = append(errs, fmt.Errorf("binding port %q not found in testbed", bport.Id))
continue
}
p.Name = bport.Name
// If port speed is empty populate from testbed ports.
if bport.Speed != opb.Port_SPEED_UNSPECIFIED {
if p.Speed != opb.Port_SPEED_UNSPECIFIED && p.Speed != bport.Speed {
return nil, fmt.Errorf("binding port speed %v and testbed port speed %v do not match", bport.Speed, p.Speed)
if p, ok := portmap[bport.Id]; ok {
p.Name = bport.Name
// If port speed is empty populate from testbed ports.
if bport.Speed != opb.Port_SPEED_UNSPECIFIED {
if p.Speed != opb.Port_SPEED_UNSPECIFIED && p.Speed != bport.Speed {
return nil, fmt.Errorf("binding port speed %v and testbed port speed %v do not match", bport.Speed, p.Speed)
}
p.Speed = bport.Speed
}
p.Speed = bport.Speed
}
}
for id, p := range portmap {
Expand Down
1 change: 0 additions & 1 deletion topologies/binding/binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ func TestReservation_Error(t *testing.T) {
`binding DUT "dut.b" not found in testbed`,
`missing binding for ATE "ate.tb"`,
`error binding ATE "ate.both"`,
`binding port "port3" not found in testbed`,
`testbed port "port1" is missing in binding`,
}
errText := err.Error()
Expand Down

0 comments on commit 5c181ad

Please sign in to comment.