VNF Primitive Upgrade

From OSM Public Wiki
Jump to: navigation, search

The purpose of the Upgrade primitive is to perform an upgrade of operational software on your VNF.

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

Example code:

@when('actions.upgrade')
def upgrade_vnf():
    err = ''
    try:
        """
        Run the command(s) necessary to perform a safe software upgrade of your VNF
        This could be a single command that encapsulates your upgrade process...
        Or a series of commands for each step, such as:
         - check if update is available
         - remove vnf from service
         - download
         - upgrade
         - install
         - verify or fail
         - rollback
         - return vnf to service
        """
        result, err = charms.sshproxy._run("/srv/myvnf/upgrade.sh")
    except:
        action_fail('Upgrade failed:' + err)
    else:
        action_set({'outout': result})
    finally:
        clear_flag('actions.upgrade')

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