base/app_manager: RyuApp initialization race at startup

There is a race between RyuApp instantiation and starting its thread.
Each RyuApp spawns an event-loop thread which handles events and may
generate events when a RyuApp instance is created.
Currently on startup, necessary RyuApps are created, and event-loop
thread is created at the same time. Then event-piping (which events are
delivered to which RyuApp) is done. This causes missing events if
RyuApp which was create early generates events before finishing event-piping.

To address it, split RyuApp startup into three phases from two phase.
- create RyuApp instances
- event piping
- then, start event-loop threads.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
base/app_manager: introduce singleton pattern to AppManager

Later VRRP service creates/deletes RyuApp dynamically as VRRP router
is enabled/disabled.
When creating/deleting RyuApp, unique RyuManager should be used.
There needs a way to get a unique RyuApp. So introduce singleton pattern

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
base/app_manager: create/destroy RyuApp instances dynamically

allow RyuManager to create/destroy RyuApp instances dynamically
and register/unregister event observer dynamically.

Cc: yuta-hamada <yuta.hamada.z02@gimal.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
base/app_manager: context might be RyuApp

The class used for context might be RyuApp. So methods of RyuApp needs
to be called.

Reported-by: YAMADA Hideki <yamada.hideki@po.ntts.co.jp>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
packet.vrrp: some convenient routines

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
vrrp service

services.protocols.vrrp
    utils: util functions for vrrp service
    event: VRRP related events and classes
    monitor:  interface monitor
    router: VRRP router
    manager: a class that manages VRRP routers
    api: API for VRRP service
    dumper: vrrp event dumper (a sample application)

the directory structure (services.protocols.vrrp) was
suggested by FUJITA Tomonori.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
test apps for VRRP service

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
a script to set up an environment for test_vrrp_linux_multi.py

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
a script to set up an environment for test_vrrp_multi.py

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>