This directory contains an example proxy component (in proxy.c) for
non-pre-instantiable proxied components.

proxy.xml contains the AMF model for the proxy component in IMM XML format.

proxied.xml contains the AMF model with two proxied components in IMM XML
format. Two sample healthchecks "shallow" and "deep" are configured.

The proxy starts the healthchecks for each proxied component. The healthcheck
keys are hardcoded in the proxy. The proxy registers proxied components getting
DNs from environment variables. This introduces a dependency between proxy.xml
and proxied.xml. 

Steps to test on the local host (assuming opensaf is started):
$ cd samples
$ ./bootstrap.sh
$ ./configure
$ cd amf/proxy
$ make
$ sudo make install

Optionally source the test script:
$ source test.sh
press any key to lock proxied and proxy SU

$

results in syslog:
Feb 27 18:09:42 Vostro opensafd: OpenSAF(4.5.M0 - 4800:31d94f7f0cea) services successfully started
Feb 27 18:09:47 Vostro osafimmnd[5925]: NO Ccb 2 COMMITTED (immcfg_Vostro_6127)
Feb 27 18:09:47 Vostro osafimmnd[5925]: NO Ccb 3 COMMITTED (immcfg_Vostro_6130)
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxy' Presence State UNINSTANTIATED => INSTANTIATING
Feb 27 18:09:47 Vostro proxy[6141]: 'safComp=1,safSu=1,safSg=2N,safApp=Proxy' started
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxy' Presence State INSTANTIATING => INSTANTIATED
Feb 27 18:09:47 Vostro proxy[6141]: Registered with AMF and HC started
Feb 27 18:09:47 Vostro proxy[6141]: proxy_healthcheck_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxy', key 'default'
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO Assigning 'safSi=1,safApp=Proxy' ACTIVE to 'safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:47 Vostro proxy[6141]: proxy_csi_set_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxy' ADD 'safCsi=1,safSi=1,safApp=Proxy' HAState Active
Feb 27 18:09:47 Vostro proxy[6141]: registering proxied 'X' with DN 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro proxy[6141]: registering proxied 'Y' with DN 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO Assigned 'safSi=1,safApp=Proxy' ACTIVE to 'safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO Assigning 'safSi=1,safApp=Proxied' ACTIVE to 'safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro proxy[6141]: proxied_csi_set_callback: 'safComp=2,safSu=1,safSg=2N,safApp=Proxied' ADD 'safCsi=2,safSi=1,safApp=Proxied' HAState Active
Feb 27 18:09:47 Vostro proxy[6141]: instantiate_proxied_comp 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro proxy[6141]: start_hc_for_proxied_comp 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxied' Presence State UNINSTANTIATED => INSTANTIATING
Feb 27 18:09:47 Vostro proxy[6141]: proxied_healthcheck_callback: 'safComp=2,safSu=1,safSg=2N,safApp=Proxied', key 'shallow'
Feb 27 18:09:47 Vostro proxy[6141]: proxied_healthcheck_callback: 'safComp=2,safSu=1,safSg=2N,safApp=Proxied', key 'deep'
Feb 27 18:09:47 Vostro proxy[6141]: proxied_csi_set_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxied' ADD 'safCsi=1,safSi=1,safApp=Proxied' HAState Active
Feb 27 18:09:47 Vostro proxy[6141]: instantiate_proxied_comp 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro proxy[6141]: start_hc_for_proxied_comp 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:47 Vostro proxy[6141]: proxied_healthcheck_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxied', key 'shallow'
Feb 27 18:09:47 Vostro proxy[6141]: proxied_healthcheck_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxied', key 'deep'
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxied' Presence State INSTANTIATING => INSTANTIATED
Feb 27 18:09:47 Vostro osafamfnd[5986]: NO Assigned 'safSi=1,safApp=Proxied' ACTIVE to 'safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Assigning 'safSi=1,safApp=Proxied' QUIESCED to 'safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro proxy[6141]: proxied_csi_remove_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro proxy[6141]: stop_hc_for_proxied_comp 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxied' Presence State INSTANTIATED => TERMINATING
Feb 27 18:09:55 Vostro proxy[6141]: terminate_proxied_comp 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro proxy[6141]: proxied_csi_remove_callback: 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro proxy[6141]: stop_hc_for_proxied_comp 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro proxy[6141]: terminate_proxied_comp 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxied' Presence State TERMINATING => UNINSTANTIATED
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Assigned 'safSi=1,safApp=Proxied' QUIESCED to 'safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Removed 'safSi=1,safApp=Proxied' from 'safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Assigning 'safSi=1,safApp=Proxy' QUIESCED to 'safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:55 Vostro proxy[6141]: proxy_csi_set_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxy' CHANGE HAState to Quiesced for all assigned CSIs
Feb 27 18:09:55 Vostro proxy[6141]: unregistering: 'X' with DN 'safComp=1,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro proxy[6141]: unregistering: 'Y' with DN 'safComp=2,safSu=1,safSg=2N,safApp=Proxied'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Assigned 'safSi=1,safApp=Proxy' QUIESCED to 'safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Removing 'safSi=1,safApp=Proxy' from 'safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:55 Vostro proxy[6141]: proxy_csi_remove_callback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO Removed 'safSi=1,safApp=Proxy' from 'safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:55 Vostro proxy[6141]: componentTerminateCallback: 'safComp=1,safSu=1,safSg=2N,safApp=Proxy'
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxy' Presence State INSTANTIATED => TERMINATING
Feb 27 18:09:55 Vostro osafamfnd[5986]: NO 'safSu=1,safSg=2N,safApp=Proxy' Presence State TERMINATING => UNINSTANTIATED
Feb 27 18:09:55 Vostro proxy[6141]: exiting

TODO
- hardcoded healthcheck names in proxy
- fix redundant 2N proxy (add another SU in proxy.xml)

