mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-01-23 01:21:31 +01:00
BGPSpeaker: Support Python3 on SSH console
Currently, SSH console of BGPSpeaker fails to recieve commands from user when it is running on Python3 due to the binary conversion. This patch fixes this problem and enables to use SSH console on Python3. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
c51c46b584
commit
aeda7ae4c5
@ -41,7 +41,7 @@ class RouteFormatterMixin(object):
|
||||
prefix = path.get('prefix')
|
||||
|
||||
# Append path info to String buffer.
|
||||
buff.write(cls.fmtstr.format(path_status, prefix, labels,
|
||||
buff.write(cls.fmtstr.format(path_status, prefix, str(labels),
|
||||
next_hop, bpr, str(med),
|
||||
str(localpref),
|
||||
' '.join(map(str, aspath))))
|
||||
|
||||
@ -152,6 +152,7 @@ Hello, this is Ryu BGP speaker (version %s).
|
||||
|
||||
def _handle_csi_seq(self):
|
||||
c = self.chan.recv(1)
|
||||
c = c.decode() # For Python3 compatibility
|
||||
if c == 'A':
|
||||
self._lookup_hist_up()
|
||||
elif c == 'B':
|
||||
@ -165,13 +166,14 @@ Hello, this is Ryu BGP speaker (version %s).
|
||||
|
||||
def _handle_esc_seq(self):
|
||||
c = self.chan.recv(1)
|
||||
c = c.decode() # For Python3 compatibility
|
||||
if c == '[':
|
||||
self._handle_csi_seq()
|
||||
else:
|
||||
LOG.error("non CSI sequence. do nothing")
|
||||
|
||||
def _send_csi_seq(self, cmd):
|
||||
self.chan.send(b'\x1b[' + cmd)
|
||||
self.chan.send('\x1b[' + cmd)
|
||||
|
||||
def _movcursor(self, curpos):
|
||||
if self.prompted and curpos < len(self.PROMPT):
|
||||
@ -347,6 +349,7 @@ Hello, this is Ryu BGP speaker (version %s).
|
||||
|
||||
while True:
|
||||
c = self.chan.recv(1)
|
||||
c = c.decode() # For Python3 compatibility
|
||||
|
||||
if len(c) == 0:
|
||||
break
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user