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, showPartial
connection_id, createSubscription, getCapas, getConnectionId, getStatsCapas, getSystemStateData, getTimeInPool, getTransactionIdMode, getUseStoredCapas, getWantRevertDiff, initialize, isAlive, keepAlive, setCapabilities, setConnectionData, setPlatformData, showStatsPath, uninitialize, useStoredCapabilities
public 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)
NedConnectionBase
reconnect
in class NedConnectionBase
worker
- 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()
NedConnectionBase
device_id
in class NedConnectionBase
public String type()
NedConnectionBase
type
in class NedConnectionBase
public String[] modules()
NedConnectionBase
modules
in class NedConnectionBase
public String identity()
NedConnectionBase
identity
in class NedConnectionBase
public void applyConfig(NedWorker worker, int cmd, String data) throws NedException, IOException, SSHSessionException, NedCliBaseTemplate.ApplyException
public void prepare(NedWorker worker, String data) throws Exception
NedCliBase
prepare
in class NedCliBase
worker
- 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.Exception
public void prepareDry(NedWorker worker, String data) throws Exception
NedCliBase
prepareDryResponse()
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 NedCliBase
worker
- 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.Exception
public void abort(NedWorker worker, String data) throws Exception
NedCliBase
abort
in class NedCliBase
worker
- 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.Exception
public void revert(NedWorker worker, String data) throws Exception
NedCliBase
revert
in class NedCliBase
worker
- 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.Exception
public void commit(NedWorker worker, int timeout) throws Exception
NedConnectionBase
commit
in class NedConnectionBase
worker
- 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.Exception
public void persist(NedWorker worker) throws Exception
NedConnectionBase
persist
in class NedConnectionBase
worker
- 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.Exception
public void close(NedWorker worker) throws NedException, IOException
NedConnectionBase
close
in class NedConnectionBase
worker
- 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.NedException
IOException
public void close()
NedConnectionBase
close
in class NedConnectionBase
public boolean isAlive()
isAlive
in class NedConnectionBase
public void getTransId(NedWorker worker) throws Exception
NedConnectionBase
getTransId
in class NedConnectionBase
worker
- 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.Exception
public void show(NedWorker worker, String toptag) throws Exception
NedCliBase
show
in class NedCliBase
worker
- 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.Exception
public 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)
NedCliBase
isConnection
in class NedCliBase
device_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
NedConnectionBase
command
in class NedConnectionBase
worker
- 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?)Exception
public void showStats(NedWorker worker, int th, ConfPath path) throws Exception
NedConnectionBase
showStats
in class NedConnectionBase
worker
- 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 requestedException
public void showStatsList(NedWorker worker, int th, ConfPath path) throws Exception
NedConnectionBase
showStatsList
in class NedConnectionBase
worker
- 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 requestedException
public 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)
NedCliBase
newConnection
in class NedCliBase
device_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.