VNF Primitive Restart

From OSM Public Wiki
Revision as of 09:19, 26 June 2018 by Israelad (talk | contribs) (Created page with "'''DISCLAIMER: This page is being updated to reflect changes required for Release FOUR.''' The purpose of the Restart primitive is to restart your VNF application. {|class="...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

DISCLAIMER: This page is being updated to reflect changes required for Release FOUR.

The purpose of the Restart primitive is to restart your VNF application.

Config Required
Day 0 Day 1 Day 2
No Yes Yes No

Example code:

@when('actions.restart')
def restart_vnf():
    err = ''
    try:
        """
        Run the command(s) necessary to perform a safe stop of your VNF
        This could be a single command that encapsulates your stop process...
        Or a series of commands for each step, such as:
         - stop accepting live traffic
         - perform cool-down operations
         - stop your vnf
        """
        result, err = charms.sshproxy._run("/srv/myvnf/restart.sh")

        """
        Or, call the stop and start functions to reuse previously defined primitives
        """
        stop_vnf()
        start_vnf()
    except:
        action_fail('Restart failed:' + err)
    else:
        action_set({'outout': result})
    finally:
        clear_flag('actions.restart')

For a full example of creating a VNF charm, please see Creating your own VNF charm (Release FOUR).