public class NedCliBaseTemplate extends NedCliBase
| Modifier and Type | Class and Description |
|---|---|
class |
NedCliBaseTemplate.ApplyException |
| Modifier and Type | Field and Description |
|---|---|
SSHConnection |
connection |
int |
connectTimeout |
String |
device_id |
InetAddress |
ip |
static org.apache.logging.log4j.Logger |
LOGGER |
NedMux |
mux |
String |
pass |
int |
port |
String |
proto |
int |
readTimeout |
String |
ruser |
String |
secpass |
CliSession |
session |
boolean |
trace |
NedTracer |
tracer |
int |
writeTimeout |
| Constructor and Description |
|---|
NedCliBaseTemplate() |
NedCliBaseTemplate(String device_id,
InetAddress ip,
int port,
String proto,
String ruser,
String pass,
String secpass,
boolean trace,
int connectTimeout,
int readTimeout,
int writeTimeout,
NedMux mux,
NedWorker worker) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(NedWorker worker,
String data)
Is invoked by NCS to abort the configuration to the state before the
previous prepare() invocation.
|
void |
applyConfig(NedWorker worker,
int cmd,
String data) |
void |
close()
This method is invoked when a connection close is forced and no
NedWorker is involved.
|
void |
close(NedWorker worker)
This method is invoked when the connection is terminated.
|
void |
command(NedWorker worker,
String cmdname,
ConfXMLParam[] p)
This is for any optional commands on the device that are
not part of the yang files config data, but is modeled as
tailf:actions or rpcs in the device yang files.
|
void |
commit(NedWorker worker,
int timeout)
This indicates that the current set of operations should be
committed to the running configuration.
|
String |
device_id()
The device_id is originally provided by NCS to properly identify
the device.
|
void |
getTransId(NedWorker worker)
When this method is invoked the NED should produce a transaction
id that must be changed if any changes has been made to the
configuration since the last time the transaction id was requested.
|
void |
handshake(NedWorker worker) |
String |
identity()
This should return the a unique (among registered NedConnection classes)
identity.
|
boolean |
isAlive() |
boolean |
isConnection(String device_id,
InetAddress ip,
int port,
String proto,
String ruser,
String pass,
String secpass,
String keydir,
boolean trace,
int connectTimeout,
int readTimeout,
int writeTimeout)
Used by the connection pool to find a matching connection.
|
String[] |
modules()
Which YANG modules are covered by the class instance.
|
NedCliBase |
newConnection(String device_id,
InetAddress ip,
int port,
String proto,
String ruser,
String pass,
String secpass,
String publicKeyDir,
boolean trace,
int connectTimeout,
int readTimeout,
int writeTimeout,
NedMux mux,
NedWorker worker)
Establish a new connection to a device and send response to
NCS with information about the device.
|
void |
persist(NedWorker worker)
This method is invoked when the currently committed change set
should be made permanent.
|
void |
prepare(NedWorker worker,
String data)
Is invoked by NCS to take the configuration to a new state.
|
void |
prepareDry(NedWorker worker,
String data)
Is invoked by NCS to tell the NED what actions it should take towards
the device if it should do a prepare.
|
void |
reconnect(NedWorker worker)
Used for resuming a connection found in the connection pool.
|
void |
revert(NedWorker worker,
String data)
Is invoked by NCS to undo the changes introduced in the last commit
operation (communicated to the NED in the prepare method invocation).
|
void |
setupSSH(NedWorker worker) |
void |
setupTelnet(NedWorker worker) |
void |
show(NedWorker worker,
String toptag)
Extract parts of the configuration and send it to NCS.
|
void |
showStats(NedWorker worker,
int th,
ConfPath path)
This method is deprecated.
|
void |
showStatsList(NedWorker worker,
int th,
ConfPath path)
This method is deprecated.
|
String |
string_dequote(String aText) |
String |
string_quote(String aText) |
String |
toString() |
void |
trace(NedWorker worker,
String msg,
String direction) |
String |
type()
The type is one of "cli" and "generic".
|
initNoConnect, showOffline, showPartial, showPartial, showPartialconnection_id, createSubscription, getCapas, getConnectionId, getStatsCapas, getSystemStateData, getTimeInPool, getTransactionIdMode, getUseStoredCapas, getWantRevertDiff, initialize, isAlive, keepAlive, setCapabilities, setConnectionData, setPlatformData, showStatsPath, uninitialize, useStoredCapabilitiespublic String device_id
public SSHConnection connection
public CliSession session
public InetAddress ip
public int port
public String proto
public String ruser
public String pass
public String secpass
public boolean trace
public NedTracer tracer
public int connectTimeout
public int readTimeout
public int writeTimeout
public NedMux mux
public static org.apache.logging.log4j.Logger LOGGER
public void reconnect(NedWorker worker)
NedConnectionBasereconnect in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.public String device_id()
NedConnectionBasedevice_id in class NedConnectionBasepublic String type()
NedConnectionBasetype in class NedConnectionBasepublic String[] modules()
NedConnectionBasemodules in class NedConnectionBasepublic String identity()
NedConnectionBaseidentity in class NedConnectionBasepublic void applyConfig(NedWorker worker, int cmd, String data) throws NedException, IOException, SSHSessionException, NedCliBaseTemplate.ApplyException
public void prepare(NedWorker worker, String data) throws Exception
NedCliBaseprepare in class NedCliBaseworker - The NedWorker instance currently responsible for driving the
communication
between NCS and the device. This NedWorker instance should be
used when communicating with the NCS, ie for sending responses,
errors, and trace messages. It is also implements the NedTracer
API and can be used in, for example, the SSHSession as a tracer.data - is the CLI commands for transforming the configuration to
a new state. The commands are generated using the YANG data
model in combination with the tailf: extensions to guide the
mapping.Exceptionpublic void prepareDry(NedWorker worker, String data) throws Exception
NedCliBaseprepareDryResponse()
when the operation is completed. If no changes needs to be done
just answer prepareDryResponse(data)
If an error is detected answer this through a call to
error()
in NedWorker w.prepareDry in class NedCliBaseworker - The NedWorker instance currently responsible for driving the
communication
between NCS and the device. This NedWorker instance should be
used when communicating with the NCS, ie for sending responses,
errors, and trace messages. It is also implements the
NedTracer
API and can be used in, for example, the SSHSession
as a tracer.data - is the CLI commands for transforming the configuration to
a new state. The commands are generated using the YANG data
model in combination with the tailf: extensions to guide the
mapping.Exceptionpublic void abort(NedWorker worker, String data) throws Exception
NedCliBaseabort in class NedCliBaseworker - The NedWorker instance currently responsible for driving the
communication
between NCS and the device. This NedWorker instance should be
used when communicating with the NCS, ie for sending responses,
errors, and trace messages. It is also implements the NedTracer
API and can be used in, for example, the SSHSession as a tracer.data - is the commands for taking the config back to the previous
state. The commands are generated using the YANG data
model in combination with the tailf: extensions to guide the
mapping.Exceptionpublic void revert(NedWorker worker, String data) throws Exception
NedCliBaserevert in class NedCliBaseworker - The NedWorker instance currently responsible for driving the
communication
between NCS and the device. This NedWorker instance should be
used when communicating with the NCS, ie for sending responses,
errors, and trace messages. It is also implements the NedTracer
API and can be used in, for example, the SSHSession as a tracer.data - is the commands for taking the config back to the previous
state.Exceptionpublic void commit(NedWorker worker, int timeout) throws Exception
NedConnectionBasecommit in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.timeout - If the commit operation does not complete within 'timeout' seconds
the operation should be aborted.Exceptionpublic void persist(NedWorker worker) throws Exception
NedConnectionBasepersist in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.Exceptionpublic void close(NedWorker worker) throws NedException, IOException
NedConnectionBaseclose in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.NedExceptionIOExceptionpublic void close()
NedConnectionBaseclose in class NedConnectionBasepublic boolean isAlive()
isAlive in class NedConnectionBasepublic void getTransId(NedWorker worker) throws Exception
NedConnectionBasegetTransId in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.Exceptionpublic void show(NedWorker worker, String toptag) throws Exception
NedCliBaseshow in class NedCliBaseworker - The NedWorker instance currently responsible for driving the
communication
between NCS and the device. This NedWorker instance should be
used when communicating with the NCS, ie for sending responses,
errors, and trace messages. It is also implements the NedTracer
API and can be used in, for example, the SSHSession as a tracer.toptag - is the top level tag indicating which part of the config
should be extracted.Exceptionpublic boolean isConnection(String device_id, InetAddress ip, int port, String proto, String ruser, String pass, String secpass, String keydir, boolean trace, int connectTimeout, int readTimeout, int writeTimeout)
NedCliBaseisConnection in class NedCliBasedevice_id - name of deviceip - address to connect to deviceport - port to connect toproto - ssh or telnetruser - name of user to connect aspass - password to use when connectingsecpass - secondary password to use when entering config mode,
set to empty string if not configured in the authgrouptrace - indicates if raw trace messages should be generated or notconnectTimeout - in millisecondsreadTimeout - in millisecondswriteTimeout - in millisecondspublic void command(NedWorker worker, String cmdname, ConfXMLParam[] p) throws Exception
NedConnectionBasecommand in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.cmdname - Name of the command (path to action?)Exceptionpublic void showStats(NedWorker worker, int th, ConfPath path) throws Exception
NedConnectionBaseshowStats in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.th - a transaction handler that can be used in Maapipath - a ConfPath indication which element is requestedExceptionpublic void showStatsList(NedWorker worker, int th, ConfPath path) throws Exception
NedConnectionBaseshowStatsList in class NedConnectionBaseworker - The NedWorker instance currently responsible for driving the
communication between NCS and the device. This NedWorker
instance should be used when communicating with NCS, i.e,
for sending responses, errors, and trace messages. It is also
implements the NedTracer API and can be used in, for example,
the SSHSession as a tracer.th - a transaction handler that can be used in Maapipath - a ConfPath indication which list is requestedExceptionpublic NedCliBase newConnection(String device_id, InetAddress ip, int port, String proto, String ruser, String pass, String secpass, String publicKeyDir, boolean trace, int connectTimeout, int readTimeout, int writeTimeout, NedMux mux, NedWorker worker)
NedCliBasenewConnection in class NedCliBasedevice_id - name of deviceip - address to connect to deviceport - port to connect toproto - ssh or telnetruser - name of user to connect aspass - password to use when connectingsecpass - secondary password to use when entering config mode,
set to empty string if not configured in the authgrouppublicKeyDir - directory to read public keys. null if password is
giventrace - indicates if raw trace messages should be generated or notconnectTimeout - in millisecondsreadTimeout - in millisecondswriteTimeout - in millisecondsworker - The NedWorker instance currently responsible for driving the
communication
between NCS and the device. This NedWorker instance should be
used when communicating with the NCS, ie for sending responses,
errors, and trace messages. It is also implements the NedTracer
API and can be used in, for example, the SSHSession as a tracer.