Skip to content

Commit d1e34c8

Browse files
atulpatel261194artek-koltun
authored andcommitted
fix(evpn): do not print empty vni/vtep
Signed-off-by: Atul Patel <[email protected]>
1 parent e4af793 commit d1e34c8

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

cmd/network/evpn-utils.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ func ComposeGwIps(comp []*pc.IPPrefix) string {
3737

3838
// PrintLB prints the logical bridge fields in human readable format
3939
func PrintLB(lb *pb.LogicalBridge) {
40-
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(lb.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), lb.GetSpec().GetVtepIpPrefix().GetLen())
4140
log.Println("name:", lb.GetName())
4241
log.Println("status:", lb.GetStatus().GetOperStatus().String())
4342
log.Println("vlan:", lb.GetSpec().GetVlanId())
44-
log.Println("vni:", lb.GetSpec().GetVni())
45-
log.Println("VtepIpPrefix:", Vteip)
43+
if lb.GetSpec().GetVni() != 0 {
44+
log.Println("vni:", lb.GetSpec().GetVni())
45+
}
46+
if lb.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr() != 0 {
47+
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(lb.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), lb.GetSpec().GetVtepIpPrefix().GetLen())
48+
log.Println("vtep ip:", Vteip)
49+
}
50+
4651
log.Println("Component Status:")
4752
log.Println(ComposeComponentsInfo(lb.GetStatus().GetComponents()))
4853
}
@@ -74,12 +79,17 @@ func PrintSvi(svi *pb.Svi) {
7479

7580
// PrintVrf prints the vrf fields in human readable format
7681
func PrintVrf(vrf *pb.Vrf) {
77-
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(vrf.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), vrf.GetSpec().GetVtepIpPrefix().GetLen())
7882
Loopback := fmt.Sprintf("%+v/%+v", ipconv.IntToIPv4(vrf.GetSpec().GetLoopbackIpPrefix().GetAddr().GetV4Addr()), vrf.GetSpec().GetLoopbackIpPrefix().GetLen())
7983
log.Println("name:", vrf.GetName())
8084
log.Println("operation status:", vrf.GetStatus().GetOperStatus().String())
81-
log.Println("vni:", vrf.GetSpec().GetVni())
82-
log.Println("vtep ip:", Vteip)
85+
86+
if vrf.GetSpec().GetVni() != 0 {
87+
log.Println("vni:", vrf.GetSpec().GetVni())
88+
}
89+
if vrf.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr() != 0 {
90+
Vteip := fmt.Sprintf("%+v/%v", ipconv.IntToIPv4(vrf.GetSpec().GetVtepIpPrefix().GetAddr().GetV4Addr()), vrf.GetSpec().GetVtepIpPrefix().GetLen())
91+
log.Println("vtep ip:", Vteip)
92+
}
8393
log.Println("loopback ip:", Loopback)
8494
log.Println("Component Status:")
8595
log.Println(ComposeComponentsInfo(vrf.GetStatus().GetComponents()))

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ services:
142142
- NET_ADMIN
143143
networks:
144144
- opi
145-
command: /opi-evpn-bridge -grpc_port=50151 -http_port=8082 -redis_addr="redis:6379" -frr_addr="frr"
145+
command: /opi-evpn-bridge --grpcport=50151 --httpport=8082 --dbaddress="redis:6379" --database=redis
146146
healthcheck:
147147
test: grpcurl -plaintext localhost:50151 list || exit 1
148148
depends_on:

0 commit comments

Comments
 (0)