Skip to content

Commit afd3aa4

Browse files
committed
Added a getRunningConfigAndState call
- Allows for netconf <get> requests - https://datatracker.ietf.org/doc/html/rfc6241#section-7.7 - Allows for a filter to be specified. Filter must be of the form <filter>...</filter> or null/blank.
1 parent 8e3701d commit afd3aa4

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/main/java/net/juniper/netconf/Device.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,14 @@ public XML getRunningConfig(String configTree) throws SAXException,
845845
return this.netconfSession.getRunningConfig(configTree);
846846
}
847847

848+
public XML getRunningConfigAndState(String filter) throws IOException, SAXException {
849+
if (netconfSession == null) {
850+
throw new IllegalStateException("Cannot execute RPC, you need to " +
851+
"establish a connection first.");
852+
}
853+
return this.netconfSession.getRunningConfigAndState(filter);
854+
}
855+
848856
/**
849857
* Retrieve the whole candidate configuration.
850858
*

src/main/java/net/juniper/netconf/NetconfSession.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,17 @@ private String getConfig(String configTree) throws IOException {
278278
return lastRpcReply;
279279
}
280280

281+
public XML getRunningConfigAndState(String filter) throws IOException, SAXException {
282+
String rpc = "<rpc>" +
283+
"<get>" +
284+
(filter == null ? "" : filter) +
285+
"</get>" +
286+
"</rpc>" +
287+
NetconfConstants.DEVICE_PROMPT;
288+
lastRpcReply = getRpcReply(rpc);
289+
return convertToXML(lastRpcReply);
290+
}
291+
281292
private String getConfig(String target, String configTree)
282293
throws IOException {
283294

0 commit comments

Comments
 (0)