@@ -134,11 +134,14 @@ def read_sessions_info(self):
134
134
self .sessions_db_info = self .configdb .get_table (self .CFG_MIRROR_SESSION_TABLE )
135
135
for key in self .sessions_db_info .keys ():
136
136
state_db_info = self .statedb .get_all (self .statedb .STATE_DB , "{}|{}" .format (self .STATE_MIRROR_SESSION_TABLE , key ))
137
+ monitor_port = ""
137
138
if state_db_info :
138
139
status = state_db_info .get ("status" , "inactive" )
140
+ monitor_port = state_db_info .get ("monitor_port" , "" )
139
141
else :
140
142
status = "error"
141
143
self .sessions_db_info [key ]["status" ] = status
144
+ self .sessions_db_info [key ]["monitor_port" ] = monitor_port
142
145
143
146
def get_sessions_db_info (self ):
144
147
return self .sessions_db_info
@@ -541,7 +544,7 @@ def show_session(self, session_name):
541
544
:param session_name: Optional. Mirror session name. Filter sessions by specified name.
542
545
:return:
543
546
"""
544
- header = ("Name" , "Status" , "SRC IP" , "DST IP" , "GRE" , "DSCP" , "TTL" , "Queue" , "Policer" )
547
+ header = ("Name" , "Status" , "SRC IP" , "DST IP" , "GRE" , "DSCP" , "TTL" , "Queue" , "Policer" , "Monitor Port" )
545
548
546
549
data = []
547
550
for key , val in self .get_sessions_db_info ().iteritems ():
@@ -550,7 +553,8 @@ def show_session(self, session_name):
550
553
551
554
data .append ([key , val ["status" ], val ["src_ip" ], val ["dst_ip" ],
552
555
val .get ("gre_type" , "" ), val .get ("dscp" , "" ),
553
- val .get ("ttl" , "" ), val .get ("queue" , "" ), val .get ("policer" , "" )])
556
+ val .get ("ttl" , "" ), val .get ("queue" , "" ), val .get ("policer" , "" ),
557
+ val .get ("monitor_port" , "" )])
554
558
555
559
print (tabulate .tabulate (data , headers = header , tablefmt = "simple" , missingval = "" ))
556
560
0 commit comments