OpenSAF AMF Control

Now that the the new component is running, we need to do some basic operations such as assigning it to be active (i.e. “unlocking” it in SAF terminology), assigning some configuration data (SAF terminology: create a “component service instance”) and so forth.

To do so, you need to modify the configuration in the IMM database. There are a set of binaries that can manipulate imm called
immadm, immcfg, immdump, immfind, immlist

and a set of wrapper scripts around these called:
amf-adm, amf-find, amf-state

To start/stop components I’ve been using the amf wrapper scripts. If you are unfamiliar with SAF, please note that SAF uses a strange and unusual state machine and nomenclature to start and stop components. If you are unfamiliar with it what is going on below will be very confusing. Please stop here and read the appropriate section of the AMF spec (www.saforum.org). Dig thru it for the terms “lock”,”unlock”,”lock-assignment”, and “lock-instantiation”.

What follows is an example using my component “AmfDemo”.

amf-adm and amf-find examples

Search for the full “DN” name of my component:
root@eceni:/code/opensaf# amf-find su | grep AmfDemo
safSu=SU1,safSg=AmfDemo,safApp=AmfDemo
safSu=SU2,safSg=AmfDemo,safApp=AmfDemo

“Lock” just puts it in a quiescent state:

root@eceni:/code/opensaf# amf-adm lock "safSu=SU1,safSg=AmfDemo,safApp=AmfDemo"
root@eceni:/code/opensaf# ps -efwww | grep AmfDemo
root 11359 1494 0 15:10 pts/0 00:00:00 grep AmfDemo

root@eceni:/code/opensaf# amf-adm unlock "safSu=SU1,safSg=AmfDemo,safApp=AmfDemo"
root@eceni:/code/opensaf# ps -efwww | grep AmfDemo
root 11374 1494 0 15:10 pts/0 00:00:00 grep AmfDemo

The component’s log (in /var/log/messages):

Mar 9 15:10:24 eceni opensaf_scap: 'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo' UNLOCKED => LOCKED
Mar 9 15:10:47 eceni opensaf_scap: 'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo' LOCKED => UNLOCKED

Now I will lock, and then “lock-instantiate” the component, which will have the effect of shutting it down:

root@eceni:/code/opensaf# amf-adm lock "safSu=SU1,safSg=AmfDemo,safApp=AmfDemo"
root@eceni:/code/opensaf# ps -efwww | grep amf_demo
root 5589 1 0 12:13 ? 00:00:00 /opt/amf_demo/amf_demo instantiate comparg1 SC_2_1
root 11430 1494 0 15:11 pts/0 00:00:00 grep amf_demo
root@eceni:/code/opensaf# amf-adm lock-in "safSu=SU1,safSg=AmfDemo,safApp=AmfDemo"
root@eceni:/code/opensaf# ps -efwww | grep amf_demo
root 11445 1494 0 15:12 pts/0 00:00:00 grep amf_demo

And here are the relevant logs:
Mar 9 15:11:45 eceni opensaf_scap: 'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo' UNLOCKED => LOCKED
Mar 9 15:12:02 eceni opensaf_scap: 'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo' LOCKED => LOCKED_INSTANTIATION
Mar 9 15:12:02 eceni amf_demo[5589]: Dispatched 'Component Terminate' in 'safComp=AmfDemo,safSu=SU1,safSg=AmfDemo,safApp=AmfDemo'
Mar 9 15:12:02 eceni opensaf_scap: 'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo' INSTANTIATED => TERMINATING
Mar 9 15:12:02 eceni opensaf_scap: 'safSu=SU1,safSg=AmfDemo,safApp=AmfDemo' TERMINATING => UNINSTANTIATED

amf-adm Errors

Here are a bunch of typical errors and what they mean:

SA_AIS_ERR_NO_OP: You are already in the state that you told it to go to
root@eceni:/code/opensaf# amf-adm unlock safSg=AmfDemo,safApp=AmfDemo
error - saImmOmAdminOperationInvoke_2 FAILED: SA_AIS_ERR_NO_OP (28)

SA_AIS_ERR_NOT_SUPPORTED: OpenSAF does not support this SAF feature
root@eceni:/code/opensaf# amf-adm lock-in safSg=AmfDemo,safApp=AmfDemo
error – saImmOmAdminOperationInvoke_2 FAILED: SA_AIS_ERR_NOT_SUPPORTED (19)

“does not exist”: Oops you gave a bad DN
root@eceni:/code/opensaf# amf-adm lock safSu=SC_2_2,safSg=AmfDemo?,safApp=AmfDemo?
error - saImmOmAdminOwnerSet - object 'safSu=SC_2_2,safSg=AmfDemo?,safApp=AmfDemo?' does not exist

SA_AIS_ERR_BAD_OPERATION: You can’t get there from here!
root@eceni:/code/opensaf# amf-adm lock-in "safSu=SU1,safSg=AmfDemo,safApp=AmfDemo"
error - saImmOmAdminOperationInvoke_2 FAILED: SA_AIS_ERR_BAD_OPERATION (20)

In other words, you tried to move from state A to state C without going through intermediate state B.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: