VNF Primitive Upgrade: Difference between revisions

From OSM Public Wiki
Jump to: navigation, search
(Created page with "The purpose of the Upgrade primitive is to perform an upgrade of operational software on your VNF. Implementing the primitive is optional. <code> <pre> @when('actions.upgrad...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
The purpose of the Upgrade primitive is to perform an upgrade of operational software on your VNF.
The purpose of the Upgrade primitive is to perform an upgrade of operational software on your VNF.


Implementing the primitive is optional.
{|class="wikitable"
!colspan="3" style="text-align:center;" | Config
!colspan="1" rowspan="2" | Required
|-
! style="text-align:left;" | Day 0
! Day 1
! Day 2
|-
| style="text-align:center;" | No
| style="text-align:center;" | Yes
| style="text-align:center;" | Yes
| style="text-align:center;" | No
|}


<code>
Example code:
<pre>
<pre>
@when('actions.upgrade')
@when('actions.upgrade')
Line 9: Line 21:
     err = ''
     err = ''
     try:
     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")
         result, err = charms.sshproxy._run("/srv/myvnf/upgrade.sh")
     except:
     except:
         action_fail('command failed:' + err)
         action_fail('Upgrade failed:' + err)
     else:
     else:
         action_set({'outout': result})
         action_set({'outout': result})
Line 17: Line 42:
         clear_flag('actions.upgrade')
         clear_flag('actions.upgrade')
</pre>
</pre>
</code>
 
For a full example of creating a VNF charm, please see [[Creating your own VNF charm (Release FOUR)]].

Latest revision as of 12:33, 26 June 2018

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).