Commit a6b45264 authored by beierl's avatar beierl
Browse files

Adding primitive to install web ui on HSS

parent c1fb7813
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
configure-hss:
    description: "Configures the HSS"
   description: Configures the HSS
   params:
      hss-ip:
            description: "HSS IP"
         description: HSS IP
         type: string
            default: "0.0.0.0"
         default: 0.0.0.0
      spgw-ip:
            description: "SPGW IP"
         description: SPGW IP
         type: string
            default: "0.0.0.0"            
         default: 0.0.0.0
restart-hss:
    description: "Restarts the service of the VNF"
   description: Restarts the service of the VNF
install-webui:
   description: Downloads and installs the optional WebUI that allows for subscriber management
+18 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
import sys
sys.path.append('lib')

from charms.reactive import main
from charms.reactive import set_state
from charmhelpers.core.hookenv import action_fail, action_name

"""
`set_state` only works here because it's flushed to disk inside the `main()`
loop. remove_state will need to be called inside the action method.
"""
set_state('actions.{}'.format(action_name()))

try:
    main()
except Exception as e:
    action_fail(repr(e))
+18 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ from charms.reactive import (

import charms.sshproxy


@when_not('hsscharm.installed')
def install_hsscharm():
    # Do your setup here.
@@ -31,6 +32,7 @@ def install_hsscharm():
    #
    set_flag('hsscharm.installed')


@when('actions.configure-hss')
def configure_hss():
    spgw_ip = action_get('spgw-ip')
@@ -41,8 +43,24 @@ def configure_hss():
    charms.sshproxy._run(cmd)
    remove_flag('actions.configure-hss')


@when('actions.restart-hss')
def restart_hss():
    cmd = "sudo systemctl restart nextepc-hssd"
    charms.sshproxy._run(cmd)
    remove_flag('actions.restart-hss')


@when('actions.install-webui')
def install_webui():

    for cmd in [
        'sudo apt update',
        'sudo apt install curl',
        'curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -',
        'sudo apt install -y nodejs',
        'curl -sL https://nextepc.org/static/webui/install  | sudo -E bash -'
        ]:
            charms.sshproxy._run(cmd)

    remove_flag('actions.install-webui')
+7 −1
Original line number Diff line number Diff line
@@ -18,4 +18,10 @@ write_files:
                    dhcp4: true
    path: /etc/netplan/51-additional-interfaces.yaml
runcmd:
-   /usr/sbin/netplan apply

-   service nextepc-pgwd stop
-   service nextepc-pcrfd stop
-   netplan generate
-   netplan apply
-   service nextepc-pgwd start
-   service nextepc-pcrfd start
+2 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ vnfd:vnfd-catalog:
               name: restart-hss
            juju:
               charm: hsscharm
            config-primitive:
            -  name: install-webui
#######################################################################################################################
      internal-vld:
      -  id: s6a