@@ -1115,7 +1115,11 @@ def _process_pipe(cmd, txt):
11151115 )
11161116 )
11171117 raw_txt = self .device .cli (safe_command , warning = False )
1118- cli_output [str (command )] = str (_process_pipe (command , raw_txt ))
1118+ if isinstance (raw_txt , etree ._Element ):
1119+ raw_txt = etree .tostring (raw_txt .get_parent ()).decode ()
1120+ cli_output [str (command )] = raw_txt
1121+ else :
1122+ cli_output [str (command )] = str (_process_pipe (command , raw_txt ))
11191123 return cli_output
11201124
11211125 def get_bgp_config (self , group = "" , neighbor = "" ):
@@ -2061,6 +2065,7 @@ def ping(
20612065 size = C .PING_SIZE ,
20622066 count = C .PING_COUNT ,
20632067 vrf = C .PING_VRF ,
2068+ source_interface = C .PING_SOURCE_INTERFACE ,
20642069 ):
20652070
20662071 ping_dict = {}
@@ -2071,6 +2076,7 @@ def ping(
20712076 size_str = ""
20722077 count_str = ""
20732078 vrf_str = ""
2079+ source_interface_str = ""
20742080
20752081 if source :
20762082 source_str = " source {source}" .format (source = source )
@@ -2084,17 +2090,22 @@ def ping(
20842090 count_str = " count {count}" .format (count = count )
20852091 if vrf :
20862092 vrf_str = " routing-instance {vrf}" .format (vrf = vrf )
2093+ if source_interface :
2094+ source_interface_str = " interface {source_interface}" .format (
2095+ source_interface = source_interface
2096+ )
20872097
20882098 ping_command = (
2089- "ping {destination}{source}{ttl}{timeout}{size}{count}{vrf}" .format (
2090- destination = destination ,
2091- source = source_str ,
2092- ttl = maxttl_str ,
2093- timeout = timeout_str ,
2094- size = size_str ,
2095- count = count_str ,
2096- vrf = vrf_str ,
2097- )
2099+ "ping {destination}{source}{ttl}{timeout}{size}{count}{vrf}{source_interface}"
2100+ ).format (
2101+ destination = destination ,
2102+ source = source_str ,
2103+ ttl = maxttl_str ,
2104+ timeout = timeout_str ,
2105+ size = size_str ,
2106+ count = count_str ,
2107+ vrf = vrf_str ,
2108+ source_interface = source_interface_str ,
20982109 )
20992110
21002111 ping_rpc = E ("command" , ping_command )
0 commit comments