diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2017-11-29 23:22:11 -0800 |
---|---|---|
committer | Eric Multanen <eric.w.multanen@intel.com> | 2017-11-29 23:22:11 -0800 |
commit | 9f8f157397a44c8183040902fe1d990336cdb8e6 (patch) | |
tree | bccb7f84f7aaa2610e8fb350fa89c0481585050d /vnfs/vCPE/scripts/v_gmux_install.sh | |
parent | ce34d8a702ab6fe99dab6d6a94b2600bd1464e59 (diff) |
Reset VES packet loss rate to zero on reboot
Adds logic to reset the VES packet loss rate to 0%
when the vg-mux is rebooted.
As part of this change, the VES agent configuration
will only be restored via the honeycomb persistence
mechanism. So, if the VES agent is configured via
the vppctl CLI, that setting will not be saved during
shutdown. In other words, setting of the VES agent
and VES mode should be done via the honeycomb REST
API in order for the configuration to be persisted
across reboot (with the pkt loss rate being reset to
0 %).
Change-Id: I8d1f43316d9608f8d7e7ce919f129ce8fe48aa7f
Issue-ID: INT-63
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Diffstat (limited to 'vnfs/vCPE/scripts/v_gmux_install.sh')
-rw-r--r-- | vnfs/vCPE/scripts/v_gmux_install.sh | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/vnfs/vCPE/scripts/v_gmux_install.sh b/vnfs/vCPE/scripts/v_gmux_install.sh index 5e98fe1b..e1702ee4 100644 --- a/vnfs/vCPE/scripts/v_gmux_install.sh +++ b/vnfs/vCPE/scripts/v_gmux_install.sh @@ -397,6 +397,7 @@ After=vpp.service [Service] ExecStart=/opt/honeycomb/honeycomb +ExecStop=/opt/reset_ves_mode.sh Restart=always RestartSec=10 @@ -405,6 +406,19 @@ WantedBy=multi-user.target EOF systemctl enable /etc/systemd/system/honeycomb.service + # Create script that is used to reset the ves mode configuration + # when the honeycomb service is stopped + cat > /opt/reset_ves_mode.sh << EOF +#!/bin/bash +mode_data=\$(curl -X GET -u admin:admin http://127.0.0.1:8183/restconf/config/vesagent:vesagent/mode 2>/dev/null | sed s/\"base-packet-loss\":[0-9]\*,/\"base-packet-loss\":0,/) +if [[ "\${mode_data}" != "" ]] +then + curl -X DELETE -u admin:admin http://127.0.0.1:8183/restconf/config/vesagent:vesagent/mode + curl -H "Content-Type:application/json" --data "\${mode_data}" -X POST -u admin:admin http://127.0.0.1:8183/restconf/config/vesagent:vesagent +fi +EOF + chmod a+x /opt/reset_ves_mode.sh + #Create a systemd service for auto-save cat > /usr/bin/save_config << EOF #!/bin/bash @@ -463,30 +477,6 @@ write_startup_scripts() fi } -# Saves the VES agent configuration to the startup script. -# -# Get the current VES agent configuration from the bash command: -# \$vppctl show ves agent -# Server Addr Server Port Interval Enabled -# 127.0.0.1 8080 10 True -# Set the VES agent configuration with the bash command: -# \$vppctl set ves agent server 127.0.0.1 port 8080 intval 10 -# -save_ves_config() -{ - local server="" - local port="" - local intval="" - - local ves_config=\`vppctl show ves agent | head -2 | tail -1\` - if [ "\${ves_config}" != "" ] ;then - server=\`echo \${ves_config} | awk '{ print \$1 }'\` - port=\`echo \${ves_config} | awk '{ print \$2 }'\` - intval=\`echo \${ves_config} | awk '{ print \$3 }'\` - write_startup_scripts add "set ves agent server \${server} port \${port} intval \${intval}" - fi -} - # Save the VxLAN Tunnel Configuration to the startup script. # # Get the current VxLAN tunnel configuration with bash command: @@ -551,8 +541,6 @@ save_vxlan_xconnect() ################################# MAIN ################################### -save_ves_config - save_vxlan_tunnel save_vxlan_xconnect |