openbaton / NFVO

Repository containing the source code of the NFVO
Apache License 2.0
61 stars 52 forks source link

[Suggestion] Improve passing variables to life-cycle event scripts #21

Closed KLuka closed 6 years ago

KLuka commented 8 years ago

Generic VNFM supports passing of variables to life-cycle event scripts, which is very useful feature. But there are some shortcomings with current implementation. Here are some suggestions what could be improved:

  1. Currently the passed variables are in very limited format (ie: =). This can be problematic in many cases. If we see the Open IMS core example it takes a lot of work, if users wishes to use different network than "mgmt". User would need to modify most of the scripts in VNFD packages, because the network name is hard-coded as a shell variable into the scripts.
  2. If network names contain hyphens (-) there is no easy way to get IP address in shell script, because bash doesn't allow hyphens in variable names.
  3. It would also be nice if passed variables would have some kind of prefix. Like "OB_HOSTNAME" instead of only "hostname" for example. This way it is clear which variables are passed by generic VNFM.
  4. Some other useful information could be passed to scripts, like network masks, gateway ips, etc...

Example of variables passed at INSTANTIATE event for VDU with four connection points:

"env":{"mgmt-net-2":"192.168.245.15","orchestarator-net-1_floatingIp":"192.168.27.64","orchestarator-net-1":"192.168.41.15","test-net-4":"192.168.206.15","hostname":"lkra-wrl-sa-vnfd-862","voip-net-3":"192.168.179.15"}

I was thinking of something like the bellow example.

# Basic info
OB_HOSTNAME=<hostname>

# Network interface 1
OB_INT1_NETNAME=<network name>
OB_INT1_IP=<ip address>
OB_INT1_MASK=<net mask>
OB_INT1_GW=<default gateway>
OB_INT1_FLOAT=<floating ip>

# Network interface 2
OB_INT2_NETNAME=<network name>
OB_INT2_IP=<ip address>
OB_INT2_MASK=<net mask>
OB_INT2_GW=<default gateway>
...

For now you could also keep the current variables so that you don't break backwards compatibility... Any comments?

rjspencer1989 commented 7 years ago

Point 2 is probably a documentation issue because network names can be used as variables by replacing hyphens(-) with underscores(_). The network network-name can be referred to as the variable network_name for example.

marcellom commented 6 years ago

Hi @KLuka, this suggestion has been considered and implemented partially. A new mechanism allows to save the parameters in a file "ob_parameters.sh" locally to the VM which you can read in the script by sourcing it. You can find more info in the "working progress" docs https://github.com/openbaton/docs/blob/master/docs/vnf-parameters.md#how-to-use-parameters-passed-through-a-vnf-dependency. Such mechanism could be extended to other parameters as you suggest.