diff options
Diffstat (limited to 'vnfs')
-rw-r--r-- | vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-dhcp4.conf.example | 8 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/kea-dhcp4-web.conf | 63 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/kea-dhcp4.conf | 9 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf | 14 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_bng_init.sh | 10 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_bng_install.sh | 10 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_gmux_install.sh | 7 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_gw_install.sh | 69 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_web_init.sh | 1 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_web_install.sh | 15 | ||||
-rw-r--r-- | vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch | 57 | ||||
-rw-r--r-- | vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch | 92 | ||||
-rw-r--r-- | vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch | 124 | ||||
-rwxr-xr-x | vnfs/vFW/scripts/update-vfw-op-policy.sh | 74 | ||||
-rwxr-xr-x | vnfs/vLB/scripts/run_streams_dns.sh | 50 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_packetgen_install.sh | 5 |
16 files changed, 484 insertions, 124 deletions
diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-dhcp4.conf.example b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-dhcp4.conf.example index 9faaf870..b5f1a697 100644 --- a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-dhcp4.conf.example +++ b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-dhcp4.conf.example @@ -36,10 +36,10 @@ "pools" : [ { "pool": "10.3.0.2 - 10.3.0.255"} ], "next-server": "10.3.0.1", "option-data": [ - {"name": "tftp-server-name", - "data": "10.4.0.1"}, - {"name": "boot-file-name", - "data": "/dev/null"} + { + "name": "routers", + "data": "10.3.0.1" + } ] } ] diff --git a/vnfs/vCPE/scripts/kea-dhcp4-web.conf b/vnfs/vCPE/scripts/kea-dhcp4-web.conf new file mode 100644 index 00000000..4bf07044 --- /dev/null +++ b/vnfs/vCPE/scripts/kea-dhcp4-web.conf @@ -0,0 +1,63 @@ +{ +"Dhcp4": + { +# For testing, you can use veth pair as described in README.md +# vDHCP needs to lisetn on eth1 + "interfaces-config": { + "interfaces": ["eth1" ] + }, + +# How to load the hook library. + + "lease-database": { + "type": "memfile" + }, + + "expired-leases-processing": { + "reclaim-timer-wait-time": 10, + "flush-reclaimed-timer-wait-time": 25, + "hold-reclaimed-time": 3600, + "max-reclaim-leases": 100, + "max-reclaim-time": 250, + "unwarned-reclaim-cycles": 5 + }, + + "valid-lifetime": 3600, + +# Ensure you set some sensible defaults for the siaddr and option-data, +# otherwise the options won't be added at all. +# Also keep in mind that if kea doesn't receive the desired values for some +# reason, these values will be sent to the client. + "subnet4": [ + { "subnet": "10.2.0.0/24", + "pools" : [ { "pool": "10.2.0.2 - 10.2.0.255"} ], + "next-server": "10.2.0.1", + "option-data": [ + { + "name": "routers", + "data": "10.2.0.1" + } + ] + + } + ] + +}, + +"Logging": +{ + "loggers": [ + { + "name": "kea-dhcp4", + "output_options": [ + { + "output": "/var/log/kea-dhcp4.log" + } + ], + "severity": "DEBUG", + "debuglevel": 0 + }, + ] +} + +} diff --git a/vnfs/vCPE/scripts/kea-dhcp4.conf b/vnfs/vCPE/scripts/kea-dhcp4.conf index 508c0e62..d965072b 100644 --- a/vnfs/vCPE/scripts/kea-dhcp4.conf +++ b/vnfs/vCPE/scripts/kea-dhcp4.conf @@ -36,11 +36,12 @@ "pools" : [ { "pool": "10.3.0.2 - 10.3.0.255"} ], "next-server": "10.3.0.1", "option-data": [ - {"name": "tftp-server-name", - "data": "10.4.0.1"}, - {"name": "boot-file-name", - "data": "/dev/null"} + { + "name": "routers", + "data": "10.3.0.1" + } ] + } ] diff --git a/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf b/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf index 3e2287d1..170b8f3c 100644 --- a/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf +++ b/vnfs/vCPE/scripts/kea-dhcp4_no_hook.conf @@ -26,14 +26,14 @@ # Also keep in mind that if kea doesn't receive the desired values for some # reason, these values will be sent to the client. "subnet4": [ - { "subnet": "10.2.0.0/24", - "pools" : [ { "pool": "10.2.0.2 - 10.2.0.255"} ], - "next-server": "10.2.0.1", + { "subnet": "10.3.0.0/24", + "pools" : [ { "pool": "10.3.0.2 - 10.3.0.255"} ], + "next-server": "10.3.0.1", "option-data": [ - {"name": "tftp-server-name", - "data": "10.2.0.1"}, - {"name": "boot-file-name", - "data": "/dev/null"} + { + "name": "routers", + "data": "10.3.0.1" + } ] } ] diff --git a/vnfs/vCPE/scripts/v_bng_init.sh b/vnfs/vCPE/scripts/v_bng_init.sh index 6fb2eadc..ce20dc57 100644 --- a/vnfs/vCPE/scripts/v_bng_init.sh +++ b/vnfs/vCPE/scripts/v_bng_init.sh @@ -2,3 +2,13 @@ systemctl start vpp +# wait for TAP_DEV to become active before setting a route +TAP_DEV=tap0 +STATUS=$(ip link show $TAP_DEV 2> /dev/null) +while [ -z "$STATUS" ]; do + echo "$(date) v_bng_init.sh: $TAP_DEV is not yet ready..." + sleep 1 + STATUS=$(ip link show $TAP_DEV 2> /dev/null) +done +ip route add 10.3.0.0/24 via 192.168.40.41 dev $TAP_DEV + diff --git a/vnfs/vCPE/scripts/v_bng_install.sh b/vnfs/vCPE/scripts/v_bng_install.sh index e20128c5..49bca161 100644 --- a/vnfs/vCPE/scripts/v_bng_install.sh +++ b/vnfs/vCPE/scripts/v_bng_install.sh @@ -16,6 +16,7 @@ BRGEMU_BNG_NET_CIDR=$(cat /opt/config/brgemu_bng_net_cidr.txt) BRGEMU_BNG_NET_IPADDR=$(cat /opt/config/brgemu_bng_net_ipaddr.txt) CPE_SIGNAL_NET_CIDR=$(cat /opt/config/cpe_signal_net_cidr.txt) CPE_SIGNAL_NET_IPADDR=$(cat /opt/config/cpe_signal_net_ipaddr.txt) +SDNC_IP_ADDR=$(cat /opt/config/sdnc_ip_addr.txt) # Build states are: # 'build' - just build the code @@ -64,6 +65,10 @@ fi # endif BUILD_STATE != "build" if [[ $BUILD_STATE != "done" ]] then + # Enable IPV4 forwarding through kernel + sed -i 's/^.*\(net.ipv4.ip_forward\).*/\1=1/g' /etc/sysctl.conf + sysctl -p /etc/sysctl.conf + # Download required dependencies echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list @@ -250,6 +255,11 @@ set interface ip address ${BNG_GMUX_NIC} ${BNG_GMUX_NET_IPADDR}/${BNG_GMUX_NET_C set vbng dhcp4 remote 10.4.0.1 local ${CPE_SIGNAL_NET_IPADDR} set vbng aaa config /etc/vpp/vbng-aaa.cfg nas-port 5060 +tap connect tap0 address 192.168.40.40/24 +set int state tap-0 up +set int ip address tap-0 192.168.40.41/24 +ip route add ${SDNC_IP_ADDR}/32 via 192.168.40.40 tap-0 + EOF cat > /etc/vpp/vbng-aaa.cfg << EOF diff --git a/vnfs/vCPE/scripts/v_gmux_install.sh b/vnfs/vCPE/scripts/v_gmux_install.sh index 50f754da..5e98fe1b 100644 --- a/vnfs/vCPE/scripts/v_gmux_install.sh +++ b/vnfs/vCPE/scripts/v_gmux_install.sh @@ -14,8 +14,10 @@ LIBEVEL_PATCH_URL=$(cat /opt/config/libevel_patch_url.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) MUX_GW_IP=$(cat /opt/config/mux_gw_net_ipaddr.txt) MUX_GW_CIDR=$(cat /opt/config/mux_gw_net_cidr.txt) -BNG_MUX_IP=$(cat /opt/config/bng_mux_net_ipaddr.txt) +MUX_TO_BNG_IP=$(cat /opt/config/mux_to_bng_net_ipaddr.txt) BNG_MUX_CIDR=$(cat /opt/config/bng_mux_net_cidr.txt) +BRG_BNG_CIDR=$(cat /opt/config/brg_bng_net_cidr.txt) +BNG_TO_MUX_IP=$(cat /opt/config/bng_to_mux_net_ipaddr.txt) # Build states are: # 'build' - just build the code @@ -234,10 +236,11 @@ EOF cat > /etc/vpp/setup.gate << EOF set int state ${BNG_MUX_NIC} up -set int ip address ${BNG_MUX_NIC} ${BNG_MUX_IP}/${BNG_MUX_CIDR#*/} +set int ip address ${BNG_MUX_NIC} ${MUX_TO_BNG_IP}/${BNG_MUX_CIDR#*/} set int state ${MUX_GW_NIC} up set int ip address ${MUX_GW_NIC} ${MUX_GW_IP}/${MUX_GW_CIDR#*/} +ip route add ${BRG_BNG_CIDR} via ${BNG_TO_MUX_IP} ${BNG_MUX_NIC} EOF fi # endif BUILD_STATE != "build" diff --git a/vnfs/vCPE/scripts/v_gw_install.sh b/vnfs/vCPE/scripts/v_gw_install.sh index 6074cdfa..53ac6903 100644 --- a/vnfs/vCPE/scripts/v_gw_install.sh +++ b/vnfs/vCPE/scripts/v_gw_install.sh @@ -11,6 +11,8 @@ HC2VPP_SOURCE_REPO_BRANCH=$(cat /opt/config/hc2vpp_source_repo_branch.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) MUX_GW_IP=$(cat /opt/config/mux_gw_private_net_ipaddr.txt) MUX_GW_CIDR=$(cat /opt/config/mux_gw_private_net_cidr.txt) +MUX_IP_ADDR=$(cat /opt/config/mux_ip_addr.txt) +VG_VGMUX_TUNNEL_VNI=$(cat /opt/config/vg_vgmux_tunnel_vni.txt) # Build states are: # 'build' - just build the code @@ -207,20 +209,14 @@ EOF MUX_GW_NIC=GigabitEthernet`echo ${NICS} | cut -d " " -f 2` # second interface in list GW_PUB_NIC=GigabitEthernet`echo ${NICS} | cut -d " " -f 4` # fourth interface in list -touch /etc/vpp/setup.gate cat > /etc/vpp/setup.gate << EOF set int state ${MUX_GW_NIC} up -set int ip address ${MUX_GW_NIC} 10.5.0.21/24 +set int ip address ${MUX_GW_NIC} ${MUX_GW_IP}/${MUX_GW_CIDR#*/} set int state ${GW_PUB_NIC} up set dhcp client intfc ${GW_PUB_NIC} hostname vg-1 -tap connect lstack address 192.168.1.1/24 -set int state tap-0 up - -create vxlan tunnel src 10.5.0.21 dst 10.5.0.20 vni 100 - -set interface l2 bridge tap-0 10 0 +create vxlan tunnel src ${MUX_GW_IP} dst ${MUX_IP_ADDR} vni ${VG_VGMUX_TUNNEL_VNI} set interface l2 bridge vxlan_tunnel0 10 1 set bridge-domain arp term 10 @@ -238,7 +234,7 @@ fi # endif BUILD_STATE != "build" if [[ $BUILD_STATE != "done" ]] then - # Download and install HC2VPP from source + # Download and install HC2VPP from source cd /opt git clone ${HC2VPP_SOURCE_REPO_URL} -b ${HC2VPP_SOURCE_REPO_BRANCH} hc2vpp @@ -361,6 +357,12 @@ EOF mv vpp-integration/minimal-distribution/target/vpp-integration-distribution-${l_version}-hc/vpp-integration-distribution-${l_version} /opt/honeycomb sed -i 's/127.0.0.1/0.0.0.0/g' /opt/honeycomb/config/honeycomb.json + # Disable automatic upgrades + if [[ $CLOUD_ENV != "rackspace" ]] + then + echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic + sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades + fi fi # endif BUILD_STATE != "done if [[ $BUILD_STATE != "build" ]] @@ -396,15 +398,46 @@ subnet 192.168.1.0 netmask 255.255.255.0 { } EOF - # Download DHCP config files - cd /opt - wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_gw_init.sh - wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_gw.sh +echo '#!/bin/bash +STATUS=$(ip link show lstack) +if [ -z "$STATUS" ] +then + vppctl tap connect lstack address 192.168.1.1/24 + vppctl set int state tap-0 up + vppctl set interface l2 bridge tap-0 10 0 +fi +IP=$(/sbin/ifconfig lstack | grep "inet addr:" | cut -d: -f2 | awk "{ print $1 }") +if [ ! -z "$STATUS" ] && [ -z "$IP" ] +then + ip link delete lstack + vppctl tap delete tap-0 + vppctl tap connect lstack address 192.168.1.1/24 + vppctl set int state tap-0 up + vppctl set interface l2 bridge tap-0 10 0 +fi' > /opt/v_gw_init.sh + chmod +x v_gw_init.sh - chmod +x v_gw.sh - mv v_gw.sh /etc/init.d - sed "s/Provides:/$/ v_gw" /etc/init.d/v_gw.sh - update-rc.d v_gw.sh defaults + + cat > /etc/systemd/system/vgw.service << EOF +[Unit] +Description=vGW service to run after honeycomb service +Requires=honeycomb.service +After=honeycomb.service + +[Service] +ExecStart=/opt/v_gw_init.sh +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF + + systemctl enable /etc/systemd/system/vgw.service + + cp /etc/systemd/system/multi-user.target.wants/isc-dhcp-server.service /etc/systemd/system/ + sed -i '/Documentation/a Wants=vgw.service\nAfter=vgw.service' /etc/systemd/system/isc-dhcp-server.service + sed -i '/exec dhcpd/a Restart=always\nRestartSec=10' /etc/systemd/system/isc-dhcp-server.service # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes if [[ $CLOUD_ENV != "rackspace" ]] @@ -414,9 +447,7 @@ EOF sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg - echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic reboot fi - ./v_gw_init.sh fi # endif BUILD_STATE != "build" diff --git a/vnfs/vCPE/scripts/v_web_init.sh b/vnfs/vCPE/scripts/v_web_init.sh index a9bf588e..fce6aaf6 100644 --- a/vnfs/vCPE/scripts/v_web_init.sh +++ b/vnfs/vCPE/scripts/v_web_init.sh @@ -1 +1,2 @@ #!/bin/bash +service kea-dhcp4-server start diff --git a/vnfs/vCPE/scripts/v_web_install.sh b/vnfs/vCPE/scripts/v_web_install.sh index e207dd09..685d675a 100644 --- a/vnfs/vCPE/scripts/v_web_install.sh +++ b/vnfs/vCPE/scripts/v_web_install.sh @@ -51,13 +51,22 @@ fi echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list apt-get update -apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev +apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates kea-dhcp4-server g++ libcurl4-gnutls-dev sleep 1 -# Download DHCP config files +# Download DHCP config and init files cd /opt +wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/kea-dhcp4-web.conf wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_web_init.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_web.sh + + + +# Configure DHCP +cp kea-dhcp4-web.conf /etc/kea-dhcp4-server.conf +mv kea-dhcp4-web.conf /etc/kea/kea-dhcp4.conf + + chmod +x v_web_init.sh chmod +x v_web.sh mv v_web.sh /etc/init.d @@ -88,4 +97,4 @@ then reboot fi -./v_web_init.sh
\ No newline at end of file +./v_web_init.sh diff --git a/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch b/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch index 8c2e31b7..7899ed9a 100644 --- a/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch +++ b/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add VES agent configuration for vG-MUX Signed-off-by: Johnson Li <johnson.li@intel.com> diff --git a/pom.xml b/pom.xml -index 538a5d98..581bedfc 100644 +index 538a5d9..581bedf 100644 --- a/pom.xml +++ b/pom.xml @@ -44,13 +44,14 @@ @@ -28,7 +28,7 @@ index 538a5d98..581bedfc 100644 \ No newline at end of file diff --git a/ves/asciidoc/Readme.adoc b/ves/asciidoc/Readme.adoc new file mode 100644 -index 00000000..682e7555 +index 0000000..682e755 --- /dev/null +++ b/ves/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ @@ -37,7 +37,7 @@ index 00000000..682e7555 +Overview of ves-agent diff --git a/ves/pom.xml b/ves/pom.xml new file mode 100644 -index 00000000..1ded0109 +index 0000000..1ded010 --- /dev/null +++ b/ves/pom.xml @@ -0,0 +1,56 @@ @@ -99,7 +99,7 @@ index 00000000..1ded0109 +</project> diff --git a/ves/ves-api/asciidoc/Readme.adoc b/ves/ves-api/asciidoc/Readme.adoc new file mode 100644 -index 00000000..b561268c +index 0000000..b561268 --- /dev/null +++ b/ves/ves-api/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ @@ -109,7 +109,7 @@ index 00000000..b561268c \ No newline at end of file diff --git a/ves/ves-api/pom.xml b/ves/ves-api/pom.xml new file mode 100644 -index 00000000..78bf47b9 +index 0000000..78bf47b --- /dev/null +++ b/ves/ves-api/pom.xml @@ -0,0 +1,52 @@ @@ -167,10 +167,10 @@ index 00000000..78bf47b9 +</project> diff --git a/ves/ves-api/src/main/yang/vesagent.yang b/ves/ves-api/src/main/yang/vesagent.yang new file mode 100644 -index 00000000..a3c79797 +index 0000000..dde09c2 --- /dev/null +++ b/ves/ves-api/src/main/yang/vesagent.yang -@@ -0,0 +1,71 @@ +@@ -0,0 +1,77 @@ +module vesagent { + + yang-version 1; @@ -235,6 +235,12 @@ index 00000000..a3c79797 + description + "VES Working Mode, Demo Or Real Only."; + } ++ ++ leaf source-name { ++ type string; ++ description ++ "Override for the sourceName field in the VES event"; ++ } + } + } + @@ -244,7 +250,7 @@ index 00000000..a3c79797 +} diff --git a/ves/ves-impl/asciidoc/Readme.adoc b/ves/ves-impl/asciidoc/Readme.adoc new file mode 100644 -index 00000000..e07fb05f +index 0000000..e07fb05 --- /dev/null +++ b/ves/ves-impl/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ @@ -254,7 +260,7 @@ index 00000000..e07fb05f \ No newline at end of file diff --git a/ves/ves-impl/pom.xml b/ves/ves-impl/pom.xml new file mode 100644 -index 00000000..5ed2c1b4 +index 0000000..5ed2c1b --- /dev/null +++ b/ves/ves-impl/pom.xml @@ -0,0 +1,157 @@ @@ -417,7 +423,7 @@ index 00000000..5ed2c1b4 +</project> diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/VesModule.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/VesModule.java new file mode 100644 -index 00000000..0cd60068 +index 0000000..0cd6006 --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/VesModule.java @@ -0,0 +1,67 @@ @@ -490,7 +496,7 @@ index 00000000..0cd60068 +} diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/jvpp/JVppVesProvider.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/jvpp/JVppVesProvider.java new file mode 100644 -index 00000000..8afed84e +index 0000000..8afed84 --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/jvpp/JVppVesProvider.java @@ -0,0 +1,59 @@ @@ -555,7 +561,7 @@ index 00000000..8afed84e + diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/read/VesReaderFactory.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/read/VesReaderFactory.java new file mode 100644 -index 00000000..bef652fd +index 0000000..bef652f --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/read/VesReaderFactory.java @@ -0,0 +1,50 @@ @@ -611,7 +617,7 @@ index 00000000..bef652fd +} diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesConfigCustomizer.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesConfigCustomizer.java new file mode 100644 -index 00000000..e06afa73 +index 0000000..e06afa7 --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesConfigCustomizer.java @@ -0,0 +1,127 @@ @@ -733,7 +739,7 @@ index 00000000..e06afa73 + throws WriteFailedException { + final VesAgentConfig request = new VesAgentConfig(); + -+ request.serverPort = config.getServerPort().byteValue(); ++ request.serverPort = config.getServerPort().intValue(); + request.readInterval = config.getReadInterval().byteValue(); + request.isAdd = config.getIsAdd().byteValue(); + request.serverAddr = ipv4AddressNoZoneToArray(config.getServerAddr().getValue()); @@ -744,10 +750,10 @@ index 00000000..e06afa73 +} diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesModeCustomizer.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesModeCustomizer.java new file mode 100644 -index 00000000..8b6d5a9a +index 0000000..248d819 --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesModeCustomizer.java -@@ -0,0 +1,97 @@ +@@ -0,0 +1,99 @@ +/* + * Copyright (c) 2017 Intel Corp and/or its affiliates. + * @@ -804,7 +810,7 @@ index 00000000..8b6d5a9a + @Nonnull final WriteContext writeContext) throws WriteFailedException { + LOG.debug("Writing VES Agent Working Mode {} dataAfter={}", iid, dataAfter); + -+ checkArgument(dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100, ++ checkArgument(dataAfter.getSourceName() != null && dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100, + "VES Agent Working Mode need to be correctly configured."); + + setVesAgentMode(iid, dataAfter); @@ -816,7 +822,7 @@ index 00000000..8b6d5a9a + throws WriteFailedException { + LOG.debug("Writing VES Agent Working Mode {} {}-->{}", iid, dataBefore, dataAfter); + -+ checkArgument(dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100, ++ checkArgument(dataAfter.getSourceName() != null && dataAfter.getWorkingMode() != null && dataAfter.getBasePacketLoss() <= 100, + "VES Agent Working Mode need to be correctly configured."); + + setVesAgentMode(iid, dataAfter); @@ -829,7 +835,8 @@ index 00000000..8b6d5a9a + LOG.debug("Restoring VES Mode {} dataBefore={} to default.", iid, dataBefore); + + modeBuilder.setWorkingMode("Real") -+ .setBasePacketLoss(0L); ++ .setBasePacketLoss(0L) ++ .setSourceName(""); + + setVesAgentMode(iid, modeBuilder.build()); + } @@ -840,6 +847,7 @@ index 00000000..8b6d5a9a + + request.pktLossRate = mode.getBasePacketLoss().byteValue(); + request.workMode = mode.getWorkingMode().getBytes(); ++ request.sourceName = mode.getSourceName().getBytes(); + + LOG.debug("VES agent working mode change id={} request={}", id, request); + getReplyForWrite(jvppVes.vesAgentMode(request).toCompletableFuture(), id); @@ -847,7 +855,7 @@ index 00000000..8b6d5a9a +} diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesWriterFactory.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesWriterFactory.java new file mode 100644 -index 00000000..581f0460 +index 0000000..581f046 --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesWriterFactory.java @@ -0,0 +1,54 @@ @@ -907,7 +915,7 @@ index 00000000..581f0460 +} diff --git a/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesagentCustomizer.java b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesagentCustomizer.java new file mode 100644 -index 00000000..62e46cdb +index 0000000..62e46cd --- /dev/null +++ b/ves/ves-impl/src/main/java/io/fd/hc2vpp/ves/write/VesagentCustomizer.java @@ -0,0 +1,131 @@ @@ -1033,7 +1041,7 @@ index 00000000..62e46cdb + throws WriteFailedException { + final VesAgentConfig request = new VesAgentConfig(); + -+ request.serverPort = config.getServerPort().byteValue(); ++ request.serverPort = config.getServerPort().intValue(); + request.readInterval = config.getReadInterval().byteValue(); + request.isAdd = config.getIsAdd().byteValue(); + request.serverAddr = ipv4AddressNoZoneToArray(config.getServerAddr().getValue()); @@ -1043,7 +1051,7 @@ index 00000000..62e46cdb + } +} diff --git a/vpp-integration/minimal-distribution/pom.xml b/vpp-integration/minimal-distribution/pom.xml -index e126114a..ca0e5b24 100644 +index e126114..ca0e5b2 100644 --- a/vpp-integration/minimal-distribution/pom.xml +++ b/vpp-integration/minimal-distribution/pom.xml @@ -40,6 +40,7 @@ @@ -1074,6 +1082,3 @@ index e126114a..ca0e5b24 100644 <groupId>io.fd.hc2vpp.management</groupId> <artifactId>vpp-management-impl</artifactId> <version>${vpp-management-impl.version}</version> --- -2.12.2.windows.2 - diff --git a/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch b/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch index 7aed63f1..9d6233c4 100644 --- a/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch +++ b/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch @@ -4,13 +4,14 @@ Date: Fri, 22 Sep 2017 08:58:40 +0800 Subject: [PATCH] Add VES Agent to report statistics Change Log: +v3: Add option to configure source name for VES event v2: Use VES 5.x as agent library v1: Add VES agent to report statistics Signed-off-by: Johnson Li <johnson.li@intel.com> diff --git a/src/configure.ac b/src/configure.ac -index fb2ead6d..ea641525 100644 +index fb2ead6..ea64152 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -154,6 +154,7 @@ PLUGIN_ENABLED(lb) @@ -22,7 +23,7 @@ index fb2ead6d..ea641525 100644 ############################################################################### # Dependency checks diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am -index 623892e7..84513755 100644 +index 623892e..8451375 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -69,6 +69,10 @@ if ENABLE_SNAT_PLUGIN @@ -38,7 +39,7 @@ index 623892e7..84513755 100644 # Remove *.la files diff --git a/src/plugins/ves.am b/src/plugins/ves.am new file mode 100644 -index 00000000..10f2194b +index 0000000..10f2194 --- /dev/null +++ b/src/plugins/ves.am @@ -0,0 +1,35 @@ @@ -79,7 +80,7 @@ index 00000000..10f2194b +# vi:syntax=automake diff --git a/src/plugins/ves/include/double_list.h b/src/plugins/ves/include/double_list.h new file mode 100644 -index 00000000..5cf7e1af +index 0000000..5cf7e1a --- /dev/null +++ b/src/plugins/ves/include/double_list.h @@ -0,0 +1,57 @@ @@ -142,7 +143,7 @@ index 00000000..5cf7e1af +#endif diff --git a/src/plugins/ves/include/evel.h b/src/plugins/ves/include/evel.h new file mode 100644 -index 00000000..6aceec30 +index 0000000..d696085 --- /dev/null +++ b/src/plugins/ves/include/evel.h @@ -0,0 +1,4494 @@ @@ -1869,7 +1870,7 @@ index 00000000..6aceec30 + * ::evel_free_event. + * @retval NULL Failed to create the event. + *****************************************************************************/ -+EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id); ++EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id, const char *ev_source_name); + +/**************************************************************************//** + * Free a Measurement. @@ -4642,7 +4643,7 @@ index 00000000..6aceec30 + diff --git a/src/plugins/ves/include/evel_internal.h b/src/plugins/ves/include/evel_internal.h new file mode 100644 -index 00000000..46f71af1 +index 0000000..46f71af --- /dev/null +++ b/src/plugins/ves/include/evel_internal.h @@ -0,0 +1,858 @@ @@ -5506,7 +5507,7 @@ index 00000000..46f71af1 +#endif diff --git a/src/plugins/ves/include/evel_throttle.h b/src/plugins/ves/include/evel_throttle.h new file mode 100644 -index 00000000..c97b3c37 +index 0000000..c97b3c3 --- /dev/null +++ b/src/plugins/ves/include/evel_throttle.h @@ -0,0 +1,214 @@ @@ -5726,7 +5727,7 @@ index 00000000..c97b3c37 +#endif diff --git a/src/plugins/ves/include/hashtable.h b/src/plugins/ves/include/hashtable.h new file mode 100644 -index 00000000..8be17dc1 +index 0000000..8be17dc --- /dev/null +++ b/src/plugins/ves/include/hashtable.h @@ -0,0 +1,97 @@ @@ -5829,7 +5830,7 @@ index 00000000..8be17dc1 +#endif diff --git a/src/plugins/ves/include/jsmn.h b/src/plugins/ves/include/jsmn.h new file mode 100644 -index 00000000..4ae6d9b4 +index 0000000..4ae6d9b --- /dev/null +++ b/src/plugins/ves/include/jsmn.h @@ -0,0 +1,93 @@ @@ -5928,7 +5929,7 @@ index 00000000..4ae6d9b4 +#endif /* __JSMN_H_ */ diff --git a/src/plugins/ves/include/metadata.h b/src/plugins/ves/include/metadata.h new file mode 100644 -index 00000000..1ee44092 +index 0000000..1ee4409 --- /dev/null +++ b/src/plugins/ves/include/metadata.h @@ -0,0 +1,58 @@ @@ -5992,7 +5993,7 @@ index 00000000..1ee44092 +#endif diff --git a/src/plugins/ves/include/ring_buffer.h b/src/plugins/ves/include/ring_buffer.h new file mode 100644 -index 00000000..1236b78b +index 0000000..1236b78 --- /dev/null +++ b/src/plugins/ves/include/ring_buffer.h @@ -0,0 +1,96 @@ @@ -6094,10 +6095,10 @@ index 00000000..1236b78b +#endif diff --git a/src/plugins/ves/ves.api b/src/plugins/ves/ves.api new file mode 100644 -index 00000000..a7106f8d +index 0000000..bae2620 --- /dev/null +++ b/src/plugins/ves/ves.api -@@ -0,0 +1,72 @@ +@@ -0,0 +1,74 @@ +/* + * Copyright (c) 2017 Intel and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6146,6 +6147,7 @@ index 00000000..a7106f8d + @param context - sender context, to match reply w/ request + @param pkt_loss_rate - Base packet loss rate if Demo Mode + @param work_mode[] - Agent's work mode, real or demo ++ @param source_name[] - Agent's source name +*/ +define ves_agent_mode +{ @@ -6153,6 +6155,7 @@ index 00000000..a7106f8d + u32 context; + u32 pkt_loss_rate; + u8 work_mode[8]; ++ u8 source_name[129]; +}; + +/** \brief VES Agent Mode response @@ -6172,7 +6175,7 @@ index 00000000..a7106f8d + */ diff --git a/src/plugins/ves/ves_all_api_h.h b/src/plugins/ves/ves_all_api_h.h new file mode 100644 -index 00000000..72b15697 +index 0000000..72b1569 --- /dev/null +++ b/src/plugins/ves/ves_all_api_h.h @@ -0,0 +1,18 @@ @@ -6196,7 +6199,7 @@ index 00000000..72b15697 +#include <ves/ves.api.h> diff --git a/src/plugins/ves/ves_api.c b/src/plugins/ves/ves_api.c new file mode 100644 -index 00000000..7a9b8004 +index 0000000..06f0a96 --- /dev/null +++ b/src/plugins/ves/ves_api.c @@ -0,0 +1,139 @@ @@ -6283,7 +6286,7 @@ index 00000000..7a9b8004 + || !strcmp((char *)mp->work_mode, "DEMO")) + mode = VES_AGENT_MODE_DEMO; + -+ rv = ves_agent_set_mode(mode, (u32) ntohl(mp->pkt_loss_rate)); ++ rv = ves_agent_set_mode(mode, (u32) ntohl(mp->pkt_loss_rate), (char *) mp->source_name); + + REPLY_MACRO (VL_API_VES_AGENT_MODE_REPLY); +} @@ -6341,7 +6344,7 @@ index 00000000..7a9b8004 + */ diff --git a/src/plugins/ves/ves_msg_enum.h b/src/plugins/ves/ves_msg_enum.h new file mode 100644 -index 00000000..6e8a5dfa +index 0000000..6e8a5df --- /dev/null +++ b/src/plugins/ves/ves_msg_enum.h @@ -0,0 +1,31 @@ @@ -6378,10 +6381,10 @@ index 00000000..6e8a5dfa +#endif /* _VES_MSG_ENUM_H_ */ diff --git a/src/plugins/ves/ves_node.c b/src/plugins/ves/ves_node.c new file mode 100644 -index 00000000..7540dd16 +index 0000000..49d7e87 --- /dev/null +++ b/src/plugins/ves/ves_node.c -@@ -0,0 +1,646 @@ +@@ -0,0 +1,656 @@ +/* + * Copyright (c) 2017 Intel and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6565,7 +6568,7 @@ index 00000000..7540dd16 + packets_out_this_round = 0; + } + -+ vpp_m = evel_new_measurement(vam->config.read_interval, "Measurement_vGMUX", "Generic_traffic"); ++ vpp_m = evel_new_measurement(vam->config.read_interval, "Measurement_vGMUX", "Generic_traffic", (char *) vam->config.source_name); + if(vpp_m != NULL) { + char str_pkt_loss[12]; + MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL; @@ -6912,11 +6915,17 @@ index 00000000..7540dd16 + +int +ves_agent_set_mode(ves_agent_mode_t mode, -+ u32 pkt_loss_rate) ++ u32 pkt_loss_rate, char *source_name) +{ + ves_agent_main_t *vam = &ves_agent_main; + int retval = 0; + ++ if (source_name != NULL) { ++ strncpy((char *) vam->config.source_name, source_name, MAX_SRC_NAME_LEN); ++ vam->config.source_name[MAX_SRC_NAME_LEN] = '\0'; ++ } else { ++ vam->config.source_name[0] = '\0'; ++ } + if (VES_AGENT_MODE_DEMO == mode) { + if (pkt_loss_rate > 100) { + vam->config.mode = VES_AGENT_MODE_REAL; @@ -6941,6 +6950,7 @@ index 00000000..7540dd16 + u32 pkt_loss_rate = 0; + ves_agent_mode_t mode = VES_AGENT_MODE_REAL; + int set_mode = 0; ++ u8 *source_name = NULL; + + while (unformat_check_input(input) != UNFORMAT_END_OF_INPUT) + { @@ -6955,13 +6965,15 @@ index 00000000..7540dd16 + set_mode = 1; + else if (unformat (input, "base %u", &pkt_loss_rate)) + ; ++ else if (unformat (input, "source %s", &source_name)) ++ ; + else + break; + } + + if (set_mode) + { -+ int retval = ves_agent_set_mode(mode, pkt_loss_rate); ++ int retval = ves_agent_set_mode(mode, pkt_loss_rate, (char *)source_name); + if (retval == 0) + return 0; + else @@ -6974,7 +6986,7 @@ index 00000000..7540dd16 + +VLIB_CLI_COMMAND (ves_mode_set_command, static) = { + .path = "set ves mode", -+ .short_help = "set ves mode <demo|real> [base <pkt-loss-rate>]", ++ .short_help = "set ves mode <demo|real> [base <pkt-loss-rate>] [source <name>]", + .function = ves_mode_set_command_fn, +}; + @@ -6983,11 +6995,12 @@ index 00000000..7540dd16 +{ + ves_agent_main_t *vam = &ves_agent_main; + -+ s = format(s, "%=8s %s\n", "Mode", "Base Packet Loss Rate"); ++ s = format(s, "%=8s %s %s\n", "Mode", "Base Packet Loss Rate", "Source Name"); + -+ s = format(s, "%=8s %.1f %%\n", ++ s = format(s, "%=8s %20.1f%% %s\n", + vam->config.mode == VES_AGENT_MODE_DEMO ? "Demo" : "Real", -+ (double) vam->config.base_pkt_loss); ++ (double) vam->config.base_pkt_loss, ++ (strlen((char *)vam->config.source_name) > 0) ? (char *)vam->config.source_name : "[default]"); + + return s; +} @@ -7030,10 +7043,10 @@ index 00000000..7540dd16 + */ diff --git a/src/plugins/ves/ves_node.h b/src/plugins/ves/ves_node.h new file mode 100644 -index 00000000..7b773843 +index 0000000..9a57f34 --- /dev/null +++ b/src/plugins/ves/ves_node.h -@@ -0,0 +1,66 @@ +@@ -0,0 +1,68 @@ +/* + * Copyright (c) 2017 Intel and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7060,6 +7073,7 @@ index 00000000..7b773843 +#define DEFAULT_MEASURE_ETH "eth0" +#define DEFAULT_SERVER_PORT 8080 +#define DEFAULT_READ_INTERVAL 100 ++#define MAX_SRC_NAME_LEN 128 + +typedef enum { + VES_AGENT_MODE_REAL = 0, @@ -7075,6 +7089,7 @@ index 00000000..7b773843 + int is_enabled; + u32 base_pkt_loss; /* For demo only */ + ves_agent_mode_t mode; /* Demo or Real */ ++ u8 source_name[MAX_SRC_NAME_LEN+1]; +} ves_agent_config_t; + +typedef struct { @@ -7097,18 +7112,17 @@ index 00000000..7b773843 + u32 read_interval, int is_del); + +int ves_agent_set_mode(ves_agent_mode_t mode, -+ u32 pkt_loss_rate); ++ u32 pkt_loss_rate, char *source_name); + +#endif /* _VES_NODE_H_ */ diff --git a/src/vpp-api/java/Makefile.am b/src/vpp-api/java/Makefile.am -index f18e0c24..7f4738d8 100644 +index f18e0c2..7f4738d 100644 --- a/src/vpp-api/java/Makefile.am +++ b/src/vpp-api/java/Makefile.am -@@ -148,6 +148,26 @@ jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_js - $(call japigen,snat,JVppSnatImpl) +@@ -149,6 +149,26 @@ jvpp-snat/io_fd_vpp_jvpp_snat_JVppSnatImpl.h: $(jvpp_registry_ok) $(jvpp_snat_js endif -+# + # +# VES Plugin +# +if ENABLE_VES_PLUGIN @@ -7128,12 +7142,13 @@ index f18e0c24..7f4738d8 100644 + $(call japigen,ves,JVppVesImpl) +endif + - # ++# # iOAM Trace Plugin # + if ENABLE_IOAM_PLUGIN diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.c b/src/vpp-api/java/jvpp-ves/jvpp_ves.c new file mode 100644 -index 00000000..60e325b5 +index 0000000..60e325b --- /dev/null +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.c @@ -0,0 +1,108 @@ @@ -7247,7 +7262,7 @@ index 00000000..60e325b5 +} diff --git a/src/vpp-api/java/jvpp-ves/jvpp_ves.h b/src/vpp-api/java/jvpp-ves/jvpp_ves.h new file mode 100644 -index 00000000..642101ca +index 0000000..642101c --- /dev/null +++ b/src/vpp-api/java/jvpp-ves/jvpp_ves.h @@ -0,0 +1,43 @@ @@ -7294,6 +7309,3 @@ index 00000000..642101ca + + +#endif /* __included_jvpp_ves_h__ */ --- -2.14.1.windows.1 - diff --git a/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch b/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch index 639a7c6e..00b1b446 100644 --- a/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch +++ b/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch @@ -1,8 +1,28 @@ +diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h +index 0ae1713..be3ae6c 100644 +--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h ++++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel.h +@@ -1715,13 +1715,14 @@ void evel_fault_type_set(EVENT_FAULT * fault, const char * const type); + * @param measurement_interval + * @param event_name Unique Event Name + * @param event_id A universal identifier of the event for analysis etc ++ * @param event_source_name Optional override of the source name + * + * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT. If the + * event is not used (i.e. posted) it must be released using + * ::evel_free_event. + * @retval NULL Failed to create the event. + *****************************************************************************/ +-EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id); ++EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval,const char* ev_name, const char *ev_id, const char *ev_source_name); + + /**************************************************************************//** + * Free a Measurement. diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c -index ced29b2..892e4b6 100644 +index 4de49bc..de6b362 100644 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_event.c -@@ -166,7 +166,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) +@@ -167,7 +167,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) header->last_epoch_microsec = tv.tv_usec + 1000000 * tv.tv_sec; header->priority = EVEL_PRIORITY_NORMAL; header->reporting_entity_name = strdup(openstack_vm_name()); @@ -12,7 +32,7 @@ index ced29b2..892e4b6 100644 header->sequence = event_sequence; header->start_epoch_microsec = header->last_epoch_microsec; header->major_version = EVEL_HEADER_MAJOR_VERSION; -@@ -180,7 +181,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) +@@ -181,7 +182,8 @@ void evel_init_header(EVENT_HEADER * const header,const char *const eventname) evel_init_option_string(&header->nfcnaming_code); evel_init_option_string(&header->nfnaming_code); evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid()); @@ -22,7 +42,7 @@ index ced29b2..892e4b6 100644 evel_init_option_intheader(&header->internal_field); EVEL_EXIT(); -@@ -215,7 +217,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event +@@ -216,7 +218,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event header->last_epoch_microsec = tv.tv_usec + 1000000 * tv.tv_sec; header->priority = EVEL_PRIORITY_NORMAL; header->reporting_entity_name = strdup(openstack_vm_name()); @@ -32,21 +52,105 @@ index ced29b2..892e4b6 100644 header->sequence = event_sequence; header->start_epoch_microsec = header->last_epoch_microsec; header->major_version = EVEL_HEADER_MAJOR_VERSION; -@@ -229,7 +232,8 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event +@@ -230,7 +233,63 @@ void evel_init_header_nameid(EVENT_HEADER * const header,const char *const event evel_init_option_string(&header->nfcnaming_code); evel_init_option_string(&header->nfnaming_code); evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid()); - evel_force_option_string(&header->source_id, openstack_vm_uuid()); + /* evel_force_option_string(&header->source_id, openstack_vm_uuid()); */ + evel_force_option_string(&header->source_id, openstack_vnf_id()); /* vCPE quick hack */ ++ evel_init_option_intheader(&header->internal_field); ++ ++ EVEL_EXIT(); ++} ++ ++/**************************************************************************//** ++ * Initialize a newly created event header. ++ * ++ * @param header Pointer to the header being initialized. ++ *****************************************************************************/ ++void evel_init_header_source_name(EVENT_HEADER * const header,const char *const eventname, const char *eventid, const char *eventsrcname) ++{ ++ struct timeval tv; ++ ++ EVEL_ENTER(); ++ ++ assert(header != NULL); ++ assert(eventname != NULL); ++ assert(eventid != NULL); ++ ++ gettimeofday(&tv, NULL); ++ ++ /***************************************************************************/ ++ /* Initialize the header. Get a new event sequence number. Note that if */ ++ /* any memory allocation fails in here we will fail gracefully because */ ++ /* everything downstream can cope with NULLs. */ ++ /***************************************************************************/ ++ header->event_domain = EVEL_DOMAIN_HEARTBEAT; ++ header->event_id = strdup(eventid); ++ header->event_name = strdup(eventname); ++ header->last_epoch_microsec = tv.tv_usec + 1000000 * tv.tv_sec; ++ header->priority = EVEL_PRIORITY_NORMAL; ++ header->reporting_entity_name = strdup(openstack_vm_name()); ++ /* header->source_name = strdup(openstack_vm_name()); */ ++ /* vCPE quck hack */ ++ if (strlen(eventsrcname)) { ++ header->source_name = strdup(eventsrcname); ++ } else { ++ header->source_name = strdup(openstack_vnf_id()); ++ } ++ header->sequence = event_sequence; ++ header->start_epoch_microsec = header->last_epoch_microsec; ++ header->major_version = EVEL_HEADER_MAJOR_VERSION; ++ header->minor_version = EVEL_HEADER_MINOR_VERSION; ++ event_sequence++; ++ ++ /***************************************************************************/ ++ /* Optional parameters. */ ++ /***************************************************************************/ ++ evel_init_option_string(&header->event_type); ++ evel_init_option_string(&header->nfcnaming_code); ++ evel_init_option_string(&header->nfnaming_code); ++ evel_force_option_string(&header->reporting_entity_id, openstack_vm_uuid()); ++ /* evel_force_option_string(&header->source_id, openstack_vm_uuid()); */ ++ evel_force_option_string(&header->source_id, openstack_vnf_id()); /* vCPE quick hack */ evel_init_option_intheader(&header->internal_field); EVEL_EXIT(); +diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c +index b73eb97..2446e02 100644 +--- a/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c ++++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/evel_scaling_measurement.c +@@ -40,13 +40,14 @@ + * @param measurement_interval + * @param event_name Unique Event Name confirming Domain AsdcModel Description + * @param event_id A universal identifier of the event for: troubleshooting correlation, analysis, etc ++ * @param event_source_name Optional override of the source name + * + * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT. If the + * event is not used (i.e. posted) it must be released using + * ::evel_free_event. + * @retval NULL Failed to create the event. + *****************************************************************************/ +-EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char* ev_name, const char *ev_id) ++EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char* ev_name, const char *ev_id, const char *ev_source_name) + { + EVENT_MEASUREMENT * measurement = NULL; + +@@ -72,7 +73,7 @@ EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char + /***************************************************************************/ + /* Initialize the header & the measurement fields. */ + /***************************************************************************/ +- evel_init_header_nameid(&measurement->header,ev_name,ev_id); ++ evel_init_header_source_name(&measurement->header,ev_name,ev_id,ev_source_name); + measurement->header.event_domain = EVEL_DOMAIN_MEASUREMENT; + measurement->measurement_interval = measurement_interval; + dlist_initialize(&measurement->additional_info); diff --git a/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c b/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c -index 11fef1b..d82f282 100644 +index 62ea6b5..6c322db 100644 --- a/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c +++ b/vnfs/VES5.0/evel/evel-library/code/evel_library/metadata.c -@@ -59,6 +59,11 @@ static char vm_uuid[MAX_METADATA_STRING+1] = {0}; +@@ -60,6 +60,11 @@ static char vm_uuid[MAX_METADATA_STRING+1] = {0}; static char vm_name[MAX_METADATA_STRING+1] = {0}; /**************************************************************************//** @@ -58,7 +162,7 @@ index 11fef1b..d82f282 100644 * How many metadata elements we allow for in the retrieved JSON. *****************************************************************************/ static const int MAX_METADATA_TOKENS = 128; -@@ -289,6 +294,19 @@ EVEL_ERR_CODES openstack_metadata(int verbosity) +@@ -290,6 +295,19 @@ EVEL_ERR_CODES openstack_metadata(int verbosity) { EVEL_DEBUG("VM Name: %s", vm_name); } @@ -78,7 +182,7 @@ index 11fef1b..d82f282 100644 } exit_label: -@@ -318,6 +336,9 @@ void openstack_metadata_initialize() +@@ -319,6 +337,9 @@ void openstack_metadata_initialize() strncpy(vm_name, "Dummy VM name - No Metadata available", MAX_METADATA_STRING); @@ -88,7 +192,7 @@ index 11fef1b..d82f282 100644 } /**************************************************************************//** -@@ -590,3 +611,13 @@ const char *openstack_vm_uuid() +@@ -591,3 +612,13 @@ const char *openstack_vm_uuid() { return vm_uuid; } diff --git a/vnfs/vFW/scripts/update-vfw-op-policy.sh b/vnfs/vFW/scripts/update-vfw-op-policy.sh new file mode 100755 index 00000000..839250dc --- /dev/null +++ b/vnfs/vFW/scripts/update-vfw-op-policy.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +if [ "$#" -ne 3 ]; then + echo "Usage: $(basename $0) <policy-vm-host> <resource-id> <path-to-Policy-VM-private-key>" + exit 1 +fi + +POLICY_HOST=$1 +RESOURCE_ID=$2 +PATH_TO_PRIVATE_KEY=$3 + +echo +echo "Updating vFW Operational Policy .." +echo + +curl -v -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ + "policyConfigType": "BRMS_PARAM", + "policyName": "com.BRMSParamvFirewall", + "policyDescription": "BRMS Param vFirewall policy", + "policyScope": "com", + "attributes": { + "MATCHING": { + "controller" : "amsterdam" + }, + "RULE": { + "templateName": "ClosedLoopControlName", + "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", + "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+'${RESOURCE_ID}'%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" + } + } +}' http://${POLICY_HOST}:8081/pdp/api/updatePolicy + +sleep 5 + +echo +echo +echo "Pushing the vFW Policy .." +echo +echo + +curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{ + "pdpGroup": "default", + "policyName": "com.BRMSParamvFirewall", + "policyType": "BRMS_Param" +}' http://${POLICY_HOST}:8081/pdp/api/pushPolicy + +sleep 20 + +echo +echo +echo "Restarting PDP-D .." +echo +echo + +ssh -i $PATH_TO_PRIVATE_KEY root@${POLICY_HOST} "docker exec -t -u policy drools bash -c \"source /opt/app/policy/etc/profile.d/env.sh; policy stop; sleep 5; policy start\"" + +sleep 20 + +echo +echo +echo "PDP-D amsterdam maven coordinates .." +echo +echo + +curl -vvv --silent --user @1b3rt:31nst31n -X GET http://${POLICY_HOST}:9696/policy/pdp/engine/controllers/amsterdam/drools | python -m json.tool + + +echo +echo +echo "PDP-D control loop updated .." +echo +echo + +curl -v --silent --user @1b3rt:31nst31n -X GET http://${POLICY_HOST}:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/closedloop-amsterdam/org.onap.policy.controlloop.Params | python -m json.tool diff --git a/vnfs/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh index cf95fa53..b73c9ee7 100755 --- a/vnfs/vLB/scripts/run_streams_dns.sh +++ b/vnfs/vLB/scripts/run_streams_dns.sh @@ -1,9 +1,51 @@ #!/bin/bash +#Disable all the running streams vppctl packet-gen disable + +#Initial configuration: run only two streams vppctl packet-gen enable-stream dns1 vppctl packet-gen enable-stream dns2 -sleep 100 -vppctl packet-gen enable-stream dns3 -vppctl packet-gen enable-stream dns4 -vppctl packet-gen enable-stream dns5 + +sleep 180 + +#Rehash port numbers and re-run five streams every minute +while true; do + vppctl packet-gen disable + vppctl pac del dns1 + vppctl pac del dns2 + vppctl pac del dns3 + vppctl pac del dns4 + vppctl pac del dns5 + + #Update destination (vLB) IP + VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt) + IPADDR1=$(cat /opt/config/local_private_ipaddr.txt) + sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1 + sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2 + sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3 + sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4 + sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5 + + #Update source ports (make them random) + sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1 + sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2 + sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3 + sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4 + sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5 + + vppctl exec /opt/dns_streams/stream_dns1 + vppctl exec /opt/dns_streams/stream_dns2 + vppctl exec /opt/dns_streams/stream_dns3 + vppctl exec /opt/dns_streams/stream_dns4 + vppctl exec /opt/dns_streams/stream_dns5 + + #Resume stream execution + vppctl packet-gen enable-stream dns1 + vppctl packet-gen enable-stream dns2 + vppctl packet-gen enable-stream dns3 + vppctl packet-gen enable-stream dns4 + vppctl packet-gen enable-stream dns5 + + sleep 60 +done
\ No newline at end of file diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh index ca2957a7..6dce05ec 100644 --- a/vnfs/vLB/scripts/v_packetgen_install.sh +++ b/vnfs/vLB/scripts/v_packetgen_install.sh @@ -56,7 +56,6 @@ cd /opt wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/v_packetgen_init.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vpacketgen.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/run_streams_dns.sh -wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vdnspacketgen_change_streams_ports.sh wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/vlb/vlb_dns_streams/$DEMO_ARTIFACTS_VERSION/vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz tar -zmxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz @@ -65,7 +64,6 @@ rm *.tar.gz chmod +x v_packetgen_init.sh chmod +x vpacketgen.sh chmod +x run_streams_dns.sh -chmod +x vdnspacketgen_change_streams_ports.sh # Install VPP export UBUNTU="xenial" @@ -93,7 +91,4 @@ then reboot fi -# Install a cron job that restart streams every minute. This allows to map streams to different vDNSs when we scale out the VNF -echo "* * * * * /opt/vdnspacketgen_change_streams_ports.sh" | crontab - ./v_packetgen_init.sh |