Skip to content

Commit a689c10

Browse files
committed
Remove module/origin parsing in update generation
1 parent 0bb267f commit a689c10

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/cisco_gnmi/builder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ def set_os(self, name=None):
119119
name : str
120120
"IOS XR" maps to the XRClient class.
121121
"NX-OS" maps to the NXClient class.
122+
"IOS XE" maps to the XEClient class.
122123
None maps to the base Client class which simply wraps the gNMI stub.
123-
["IOS XR", "NX-OS", None]
124+
["IOS XR", "NX-OS", "IOS XE", None]
124125
125126
Returns
126127
-------
@@ -273,7 +274,7 @@ def construct(self):
273274
274275
Returns
275276
-------
276-
Client or XRClient
277+
Client or NXClient or XEClient or XRClient
277278
"""
278279
channel = None
279280
channel_ssl_creds = None

src/cisco_gnmi/xe.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,9 @@ def create_updates(name, configs):
159159
if len(config.keys()) > 1:
160160
raise Exception("config should only target one YANG module!")
161161
top_element = next(iter(config.keys()))
162-
top_element_split = top_element.split(":")
163-
if len(top_element_split) < 2:
164-
raise Exception(
165-
"Top level config element {} should be module prefixed!".format(
166-
top_element
167-
)
168-
)
169-
if len(top_element_split) > 2:
170-
raise Exception(
171-
"Top level config element {} appears malformed!".format(
172-
top_element
173-
)
174-
)
175-
origin = top_element_split[0]
176-
element = top_element_split[1]
177-
config = config.pop(top_element)
178162
update = proto.gnmi_pb2.Update()
179-
update.path.CopyFrom(self.parse_xpath_to_gnmi_path(element, origin))
163+
update.path.CopyFrom(self.parse_xpath_to_gnmi_path(top_element))
164+
config = config.pop(top_element)
180165
if ietf:
181166
update.val.json_ietf_val = json.dumps(config).encode("utf-8")
182167
else:

0 commit comments

Comments
 (0)