diff options
author | Marco Platania <platania@research.att.com> | 2017-11-30 15:09:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-11-30 15:09:22 +0000 |
commit | d6524804f5851dd1134c3780d006041fb67fb802 (patch) | |
tree | 070c2c43541a80cd4f7b26579470e52906faaf48 | |
parent | 92fa0656c5ba462192063d894a69d76d565a6970 (diff) | |
parent | 9f8f157397a44c8183040902fe1d990336cdb8e6 (diff) |
Merge "Reset VES packet loss rate to zero on reboot"
-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 |