Skip to content

Commit

Permalink
do not switch to Netconf 1.1 if the upstream proxy does not support it
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-sahlmann committed Jan 13, 2025
1 parent ca71fe2 commit c410595
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mb_netmgmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with mb-netmgmt. If not, see <https://www.gnu.org/licenses/

"""Network Management Protocols for Mountebank"""
__version__ = "0.0.88"
__version__ = "0.0.89"

import os
import subprocess
Expand Down
5 changes: 3 additions & 2 deletions mb_netmgmt/netconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from mb_netmgmt.ssh import start_server

stopped = False
NETCONF_11 = "urn:ietf:params:netconf:base:1.1"


class Handler(BaseRequestHandler, Protocol):
Expand Down Expand Up @@ -102,8 +103,8 @@ def handle_prompt(self):

self.channel.sendall(to_xml(hello) + MSG_DELIM.decode())

def init_cb(id, capabilities):
if "urn:ietf:params:netconf:base:1.1" in capabilities:
def init_cb(id, client_capabilities):
if NETCONF_11 in client_capabilities and NETCONF_11 in capabilities:
self.session._base = NetconfBase.BASE_11

self.session.add_listener(HelloHandler(init_cb, lambda ex: None))
Expand Down

0 comments on commit c410595

Please sign in to comment.