X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=vnfs%2FvCPE%2Fscripts%2Fv_gmux_install.sh;h=e1702ee41d3b74063a99e0b03986c96a6a59bd4e;hb=9f8f157397a44c8183040902fe1d990336cdb8e6;hp=5e98fe1b8b6edc7e42071bc942414258d5f8b015;hpb=ce34d8a702ab6fe99dab6d6a94b2600bd1464e59;p=demo.git 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