public abstract class NedGenericBase extends NedConnectionBase
Constructor and Description |
---|
NedGenericBase() |
Modifier and Type | Method and Description |
---|---|
abstract void |
abort(NedWorker w,
NedEditOp[] ops)
Is invoked by NCS to abort the current transaction and
bring the configuration back to the state before the
previous
prepare()
invocation. |
NedGenericBase |
initNoConnect(String deviceId,
NedMux mux,
NedWorker w)
Make a new instance of Ned object without establishing a connection
towards the device.
|
abstract boolean |
isConnection(String deviceId,
InetAddress ip,
int port,
String luser,
boolean trace,
int connectTimeout,
int readTimeout,
int writeTimeout)
Used by the connection pool to find a matching connection.
|
abstract NedGenericBase |
newConnection(String deviceId,
InetAddress ip,
int port,
String luser,
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 using the method
setConnectionData()
A new instance representing the new connection should
be returned.
|
abstract void |
prepare(NedWorker w,
NedEditOp[] ops)
Is invoked by NCS to take the configuration to a new state.
|
void |
prepareDry(NedWorker w,
NedEditOp[] ops)
Is invoked by NCS to ask the NED what actions it would take towards
the device if it would do a prepare.
|
abstract void |
revert(NedWorker w,
NedEditOp[] ops)
Is invoked by NCS to undo the changes introduced in the last commit
operation (communicated to the NED in the prepare method invocation).
|
abstract void |
show(NedWorker w,
int th)
Read parts of the configuration and applies it to the transaction
provided in
the method invocation.
|
void |
showOffline(NedWorker w,
int th,
String data)
Read parts of the configuration and applies it to the
transaction, both provided in the method invocation.
|
void |
showPartial(NedWorker w,
int th,
ConfPath[] paths)
Read parts of the configuration and applies it to the transaction
provided in
the method invocation.
|
close, close, command, commit, connection_id, createSubscription, device_id, getCapas, getConnectionId, getStatsCapas, getSystemStateData, getTimeInPool, getTransactionIdMode, getTransId, getUseStoredCapas, getWantRevertDiff, identity, initialize, isAlive, isAlive, keepAlive, modules, persist, reconnect, setCapabilities, setConnectionData, setPlatformData, showStats, showStatsList, showStatsPath, type, uninitialize, useStoredCapabilities
public abstract void prepare(NedWorker w, NedEditOp[] ops) throws Exception
prepareResponse()
in NedWorker w
when the operation is completed.
initialize (prepare transaction)
/ \
/ uninitialize (undo preparations)
v
prepare (send data to device)
/ \
v v
abort | commit(send confirmed commit (ios would do noop))
/ \
v v
revert | persist (send confirming commit)w
- 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.ops
- Edit operations representing the changes to the configuration.Exception
public void prepareDry(NedWorker w, NedEditOp[] ops) throws Exception
prepareDryResponse()
The Ned should invoke the method
prepareDryResponse()
in NedWorker w
when the operation is completed.
If the functionality is not supported this method need not be
implemented. Alternatively the NED can respond with a
NedWorker.prepareDryUnsupportedResponse()
.w
- 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.ops
- Edit operations representing the changes to the configuration.Exception
public abstract void abort(NedWorker w, NedEditOp[] ops) throws Exception
prepare()
invocation. The NCS has calculated the changes needed
to reach that state from the current state. The instance may choose
to use these commands, or use some other mechanism to reach the same
state. When the operation is completed it should invoke the method
abortResponse()
in
in NedWorker w
.w
- 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.ops
- is the edit operations needed for taking the config back to the
previous state.Exception
public abstract void revert(NedWorker w, NedEditOp[] ops) throws Exception
abort()
and revert() is that revert() is invoked after
commit()
(but before persist), whereas abort() is invoked before
the commit(). Once the configuration has been made persistent by
persist()
it can no longer be restored to any previous (potentially saved) state.
When the revert operation has been completed the method
revertResponse
in NedWorker w
should be called.w
- 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.ops
- is the edit operations for taking the config back to the previous
state.Exception
public abstract void show(NedWorker w, int th) throws Exception
showGenericResponse()
in
in the NedWorker w
.w
- 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.th
- is a transaction id that can be used with the Maapi library for
accessing a transaction.Exception
public void showPartial(NedWorker w, int th, ConfPath[] paths) throws Exception
showGenericResponse()
in
in the NedWorker w
.w
- 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.th
- is a transaction id that can be used with the Maapi library for
accessing a transaction.paths
- are paths to filter the various parts of the configuration tree
that are relevant to write into the transaction.Exception
public void showOffline(NedWorker w, int th, String data) throws Exception
showGenericResponse()
in
in the NedWorker w
.w
- 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.th
- is a transaction id that can be used with the Maapi library for
accessing a transaction.data
- are the configuration in native format.Exception
public abstract boolean isConnection(String deviceId, InetAddress ip, int port, String luser, boolean trace, int connectTimeout, int readTimeout, int writeTimeout)
deviceId
- name of deviceip
- address to connect to deviceport
- port to connect toluser
- name of user to connect astrace
- indicates if raw trace messages should be generated or notconnectTimeout
- in millisecondsreadTimeout
- in millisecondswriteTimeout
- in millisecondspublic abstract NedGenericBase newConnection(String deviceId, InetAddress ip, int port, String luser, boolean trace, int connectTimeout, int readTimeout, int writeTimeout, NedMux mux, NedWorker worker)
deviceId
- name of deviceip
- address to connect to deviceport
- port to connect toluser
- name of user to connect astrace
- indicates if raw trace messages should be generated or notconnectTimeout
- in millisecondsreadTimeout
- in millisecondswriteTimeout
- in millisecondsmux
- 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.public NedGenericBase initNoConnect(String deviceId, NedMux mux, NedWorker w) throws NedWorker.NotEnoughDataException
deviceId
- name of devicemux
- w
- 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.NedWorker.NotEnoughDataException