@@ -37,12 +37,17 @@ func ComposeGwIps(comp []*pc.IPPrefix) string {
37
37
38
38
// PrintLB prints the logical bridge fields in human readable format
39
39
func PrintLB (lb * pb.LogicalBridge ) {
40
- Vteip := fmt .Sprintf ("%+v/%v" , ipconv .IntToIPv4 (lb .GetSpec ().GetVtepIpPrefix ().GetAddr ().GetV4Addr ()), lb .GetSpec ().GetVtepIpPrefix ().GetLen ())
41
40
log .Println ("name:" , lb .GetName ())
42
41
log .Println ("status:" , lb .GetStatus ().GetOperStatus ().String ())
43
42
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
+
46
51
log .Println ("Component Status:" )
47
52
log .Println (ComposeComponentsInfo (lb .GetStatus ().GetComponents ()))
48
53
}
@@ -74,12 +79,17 @@ func PrintSvi(svi *pb.Svi) {
74
79
75
80
// PrintVrf prints the vrf fields in human readable format
76
81
func PrintVrf (vrf * pb.Vrf ) {
77
- Vteip := fmt .Sprintf ("%+v/%v" , ipconv .IntToIPv4 (vrf .GetSpec ().GetVtepIpPrefix ().GetAddr ().GetV4Addr ()), vrf .GetSpec ().GetVtepIpPrefix ().GetLen ())
78
82
Loopback := fmt .Sprintf ("%+v/%+v" , ipconv .IntToIPv4 (vrf .GetSpec ().GetLoopbackIpPrefix ().GetAddr ().GetV4Addr ()), vrf .GetSpec ().GetLoopbackIpPrefix ().GetLen ())
79
83
log .Println ("name:" , vrf .GetName ())
80
84
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
+ }
83
93
log .Println ("loopback ip:" , Loopback )
84
94
log .Println ("Component Status:" )
85
95
log .Println (ComposeComponentsInfo (vrf .GetStatus ().GetComponents ()))
0 commit comments