blob: a4f6c94156741c3f5809f818cdbdfc52b5d56cb7 [file] [log] [blame]
Jan Kundrátcf5c6362020-01-16 22:54:47 +01001import netconf_cli_py as nc
2
3c = nc.NetconfAccess(socketPath = "@NETOPEER_SOCKET_PATH@")
4data = c.getItems("/ietf-netconf-server:netconf-server")
5for (k, v) in data.items():
6 print(f"{k}: {type(v)} {v}", flush=True)
7
8if len(data) == 0:
9 print("ERROR: No data returned from NETCONF")
10 exit(1)
11
12hello_timeout_xp = "/ietf-netconf-server:netconf-server/session-options/hello-timeout"
13for EXPECTED in (599, 59, "61"):
14 c.setLeaf(hello_timeout_xp, EXPECTED)
15 c.commitChanges()
16 data = c.getItems(hello_timeout_xp)
17 if (data[hello_timeout_xp] != EXPECTED):
18 if isinstance(EXPECTED, str):
19 if str(data[hello_timeout_xp]) != EXPECTED:
20 print(f"ERROR: hello-timeout not updated (via string) to {EXPECTED}")
21 exit(1)
22 else:
23 print(f"ERROR: hello-timeout not updated to {EXPECTED}")
24 exit(1)
25try:
26 c.setLeaf(hello_timeout_xp, "blesmrt")
27 c.commitChanges()
28 print("ERROR: setting integer to a string did not error out")
29 exit(1)
30except RuntimeError:
31 pass
32
33exit(0)