Commit a15da2ad authored by lavado's avatar lavado
Browse files

minor corrections to walkthrough

parent fef64c5f
Loading
Loading
Loading
Loading
+134 −19
Original line number Diff line number Diff line
@@ -374,12 +374,14 @@ cd $LAYER_PATH
charm create spgwcharm
cd spgwcharm
```

```
# Modify the layer.yaml file
includes:
    - layer:basic
    - layer:vnfproxy
```

```
# Modify the metadata.yaml file
name: spgwcharm
@@ -394,6 +396,7 @@ series:
    - trusty
    - xenial
```

```
# Create and modify the actions.yaml file
configure-spgw:
@@ -403,9 +406,14 @@ configure-spgw:
            description: "HSS IP"
            type: string
            default: "0.0.0.0"
        spgw-ip:
            description: "SPGW IP"
            type: string
            default: "0.0.0.0"
restart-spgw:
    description: "Restarts the service of the VNF"
```

```
# Create the 'actions' folder and populate executable files for each action, with the same content:
mkdir actions
@@ -431,6 +439,7 @@ except Exception as e:
EOF
chmod +x actions/configure-spgw
```

```
# Same procedure for the 'restart-spgw' action
cat <<'EOF' >> actions/restart-spgw
@@ -455,6 +464,7 @@ except Exception as e:
EOF
chmod +x actions/restart-spgw
```

```
# Fill in the contents of the 'reactive' file (reactive/spgwcharm.py)
from charms.reactive import when, when_not, set_flag
@@ -500,6 +510,100 @@ def restart_spgw():

- Proceed in a similar way for the HSS, and provide the following contents to the reactive file:

```
cd $LAYER_PATH
charm create hsscharm
```

```
# Modify the layer.yaml file
includes:
    - layer:basic
    - layer:vnfproxy
```

```
# Modify the metadata.yaml file
name: hsscharm
summary: NextEPC HSS Charm
maintainer: Your name <youremail@yourdomain.com>
description: |
  This is an example of a proxy charm deployed by Open Source Mano.
tags:
  - nfv
subordinate: false
series:
    - trusty
    - xenial
```

```
# Create and modify the actions.yaml file
configure-hss:
    description: "Configures the HSS"
    params:
        hss-ip:
            description: "HSS IP"
            type: string
            default: "0.0.0.0"
        spgw-ip:
            description: "SPGW IP"
            type: string
            default: "0.0.0.0"            
restart-hss:
    description: "Restarts the service of the VNF"
```

```
# Create the 'actions' folder and populate executable files for each action, with the same content:
mkdir actions
cat <<'EOF' >> actions/configure-hss
#!/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))
EOF
chmod +x actions/configure-hss
```
```
# Same procedure for the 'restart-hss' action
cat <<'EOF' >> actions/restart-hss
#!/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))
EOF
chmod +x actions/restart-hss
```

```
from charms.reactive import when, when_not, set_flag

@@ -616,13 +720,13 @@ def add_route():
- Build both charms and copy them to the VNF folder

```
cd ~/charms/layers/spgw-charm
cd ~/charms/layers/spgwcharm
charm build
cp ~/charms/builds/spgw-charm ~/vEPC/vEPC_vnfd/charms/
cp -r ~/charms/builds/spgwcharm ~/vEPC/vEPC_vnfd/charms/

cd ~/charms/layers/hss-charm
cd ~/charms/layers/hsscharm
charm build
cp ~/charms/builds/hss-charm ~/vEPC/vEPC_vnfd/charms/
cp -r ~/charms/builds/hsscharm ~/vEPC/vEPC_vnfd/charms/
```

- We also defined monitoring as part of our day-2 operations. Modify the descriptor to monitor CPU and Memory metrics of the SPGW.
@@ -663,15 +767,15 @@ Note that, for this example, we are setting some IP address values, to be reques
```
nsd:nsd-catalog:
    nsd:
    -   id: vepc_nsd
        name: vepc_nsd
        short-name: vepc_nsd
    -   id: vEPC_nsd
        name: vEPC_nsd
        short-name: vEPC_nsd
        description: Generated by OSM package generator
        vendor: OSM_VNFONB_TF
        version: '1.0'
        constituent-vnfd:
        -   member-vnf-index: 1
            vnfd-id-ref: vepc_vnfd                                 
            vnfd-id-ref: vEPC_vnfd                                 
        vld:
        -   id: management
            name: management
@@ -681,10 +785,10 @@ nsd:nsd-catalog:
            vim-network-name: osm-ext
            vnfd-connection-point-ref:
            -   member-vnf-index-ref: 1
                vnfd-id-ref: vepc_vnfd
                vnfd-id-ref: vEPC_vnfd
                vnfd-connection-point-ref: spgwmme-mgmt
            -   member-vnf-index-ref: 1
                vnfd-id-ref: vepc_vnfd
                vnfd-id-ref: vEPC_vnfd
                vnfd-connection-point-ref: hss-mgmt                
        -   id: s1
            name: s1
@@ -693,7 +797,7 @@ nsd:nsd-catalog:
            vim-network-name: s1
            vnfd-connection-point-ref:
            -   member-vnf-index-ref: 1
                vnfd-id-ref: vepc_vnfd
                vnfd-id-ref: vEPC_vnfd
                vnfd-connection-point-ref: spgwmme-s1
                ip-address: 192.168.0.11
        -   id: sgi
@@ -703,21 +807,32 @@ nsd:nsd-catalog:
            vim-network-name: sgi
            vnfd-connection-point-ref:
            -   member-vnf-index-ref: 1
                vnfd-id-ref: vepc_vnfd
                vnfd-id-ref: vEPC_vnfd
                vnfd-connection-point-ref: spgwmme-sgi
                ip-address: 192.168.2.11
```

- Compress both packages and upload them to OSM.
- Now, validate your descriptors against the OSM's Information Model, using the tool in the devops repository. For example:

```
# Validating the VNFD
./devops/descriptor-packages/tools/validate_descriptor.py vEPC/vEPC_vnfd/vEPC_vnfd.yaml

# Validating the NSD
./devops/descriptor-packages/tools/validate_descriptor.py vEPC/vEPC_nsd/vEPC_nsd.yaml
```

- Now that you now your descriptors are valid, compress both packages and upload them to OSM.

```
tar -cvzf vepc_vnfd.tar.gz vepc_vnfd/
tar -cvzf vepc_nsd.tar.gz vepc_nsd/
osm vnfd-create vepc_vnfd.tar.gz
osm nsd-create vepc_nsd.tar.gz
cd ~/vEPC
tar -cvzf vEPC_vnfd.tar.gz vEPC_vnfd/
tar -cvzf vEPC_nsd.tar.gz vEPC_nsd/
osm vnfd-create vEPC_vnfd.tar.gz
osm nsd-create vEPC_nsd.tar.gz
```

- Prepare a file with the instantiaton parameters. Note that it also includes a 'vnf' block that modifies the internal VLD at instantiation time to set its IP addresses (at VIM IPAM level) so they match with the ones we are providing.
- Prepare a file, which you could call 'params.yaml', with the instantiaton parameters. Note that it also includes a 'vnf' block that modifies the internal VLD at instantiation time to set its IP addresses (at VIM IPAM level) so they match with the ones we are providing.

```
additionalParamsForVnf:
@@ -741,7 +856,7 @@ vnf:
- Instantiate the VNF! Make sure you have registered a VIM with the compute and EPA requirements you need for the VNF.

```
osm ns-create --ns_name epc1 --nsd_name vepc_nsd --ssh_keys ~/.ssh/id_rsa.pub --vim_account [VIM_ACCOUNT] --config_file params.yaml
osm ns-create --ns_name EPC1 --nsd_name vEPC_nsd --ssh_keys ~/.ssh/id_rsa.pub --config_file params.yaml --vim_account [VIM_ACCOUNT]
```

- Monitor the primitives execution status and NS status with the following commands. Remember that the instantiation flow from Release 6 onwards is as follows: (1) Charm execution enviroment preparation, (2) VM Instantiation, (3) Primitives execution