e2e: improve init, implemement more functions

including finalize, create_endpoint, destroy_endpoint.
Add semi-colon after enter/exit macros to avoid tripping up
vim's indentation.