Skip to content

Commit

Permalink
fix(evpn): do not print empty vni/vtep
Browse files Browse the repository at this point in the history
Signed-off-by: Atul Patel <Atul.Patel@intel.com>
  • Loading branch information
atulpatel261194 committed May 13, 2024
1 parent e4af793 commit d1876ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions cmd/network/evpn-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ func ComposeGwIps(comp []*pc.IPPrefix) string {

// PrintLB prints the logical bridge fields in human readable format
func PrintLB(lb *pb.LogicalBridge) {
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(lb.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), lb.GetSpec().GetVtepIpPrefix().GetLen())
log.Println("name:", lb.GetName())
log.Println("status:", lb.GetStatus().GetOperStatus().String())
log.Println("vlan:", lb.GetSpec().GetVlanId())
log.Println("vni:", lb.GetSpec().GetVni())
log.Println("VtepIpPrefix:", Vteip)
if lb.GetSpec().GetVni() != 0 {
log.Println("vni:", lb.GetSpec().GetVni())
}
if lb.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr() != 0 {
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(lb.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), lb.GetSpec().GetVtepIpPrefix().GetLen())
log.Println("vtep ip:", Vteip)
}

log.Println("Component Status:")
log.Println(ComposeComponentsInfo(lb.GetStatus().GetComponents()))
}
Expand Down Expand Up @@ -74,12 +79,17 @@ func PrintSvi(svi *pb.Svi) {

// PrintVrf prints the vrf fields in human readable format
func PrintVrf(vrf *pb.Vrf) {
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(vrf.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), vrf.GetSpec().GetVtepIpPrefix().GetLen())
Loopback := fmt.Sprintf("%+v/%+v", ipconv.IntToIPv4(vrf.GetSpec().GetLoopbackIpPrefix().GetAddr().GetV4Addr()), vrf.GetSpec().GetLoopbackIpPrefix().GetLen())
log.Println("name:", vrf.GetName())
log.Println("operation status:", vrf.GetStatus().GetOperStatus().String())
log.Println("vni:", vrf.GetSpec().GetVni())
log.Println("vtep ip:", Vteip)

if vrf.GetSpec().GetVni() != 0 {
log.Println("vni:", vrf.GetSpec().GetVni())
}
if vrf.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr() != 0 {
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(vrf.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), vrf.GetSpec().GetVtepIpPrefix().GetLen())
log.Println("vtep ip:", Vteip)
}
log.Println("loopback ip:", Loopback)
log.Println("Component Status:")
log.Println(ComposeComponentsInfo(vrf.GetStatus().GetComponents()))
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ services:
- NET_ADMIN
networks:
- opi
command: /opi-evpn-bridge -grpc_port=50151 -http_port=8082 -redis_addr="redis:6379" -frr_addr="frr"
command: /opi-evpn-bridge --grpcport=50151 --httpport=8082 --dbaddress="redis:6379" --database=redis
healthcheck:
test: grpcurl -plaintext localhost:50151 list || exit 1
depends_on:
Expand Down

0 comments on commit d1876ce

Please sign in to comment.