Support for port_security extension 99/11499/1
authoruser <user@TRAFCLASS-PACKET1.fuel.local>
Tue, 15 Mar 2016 11:35:29 +0000 (07:35 -0400)
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>
Tue, 22 Mar 2016 13:53:43 +0000 (13:53 +0000)
Change-Id: I5c513eb4024a3cd35c27e3ba6b9ace92af278432
Signed-off-by: user <user@TRAFCLASS-PACKET1.fuel.local>
(cherry picked from commit 224c6b9e8e21c1d445cf7f0e506d1e5ace1f9042)

14 files changed:
yardstick/vTC/apexlake/apexlake.conf
yardstick/vTC/apexlake/experimental_framework/api.py
yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py
yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
yardstick/vTC/apexlake/experimental_framework/common.py
yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py
yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml [new file with mode: 0644]
yardstick/vTC/apexlake/heat_templates/vTC.yaml
yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml [new file with mode: 0644]
yardstick/vTC/apexlake/setup.py
yardstick/vTC/apexlake/tests/conf_file_sections_test.py
yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml [new file with mode: 0644]
yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py

index 9ebbc5d..558bd63 100644 (file)
@@ -1,3 +1,13 @@
+[General]
+debug = true
+
+
+[OpenStack]
+#release = juno
+#release = kilo
+release = liberty
+
+
 [PacketGen]
 packet_generator = dpdk_pktgen
 pktgen_directory = /root/programs/Pktgen-DPDK/dpdk/examples/pktgen/
@@ -11,38 +21,7 @@ name_if_1 = p2p1
 name_if_2 = p2p2
 
 
-[General]
-## template_base is the name of the base template from which generate all the others
-#template_base_name = vTC.yaml
-## Benchmarks to be executed on the VNF under test (uncomment one of the following)
-#benchmarks = instantiation_validation_benchmark.InstantiationValidationBenchmark
-#benchmarks = instantiation_validation_noisy_neighbors_benchmark.InstantiationValidationNoisyNeighborsBenchmark
-#benchmarks = rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark
-#benchmarks = multi_tenancy_throughput_benchmark.MultiTenancyThroughputBenchmark
-## Number of iterations
-#iterations = 1
-#debug = true
-
-
-[OpenStack]
-## ip_controller is the IP address of the OpenStack Controller
-#ip_controller = 10.2.1.1
-## Heat URL is the URL for the Heat endpoint
-#heat_url = http://IP_ADDRESS_CONTROLLER:8004/v1/TENANT_ID
-## user is the OpenStack user name
-#user = admin
-## password is the OpenStack password
-#password = password
-## auth_uri is the authentication URI provided by keystone
-#auth_uri = http://IP_ADDRESS_CONTROLLER:5000/v2.0
-## project is the name of the project on which create the VNF instances
-#project = demo
-
-
 [Experiment-VNF]
-## List of all the variables and the values that will be tested by the framework
-#VNIC_TYPE =   @string "direct", "normal"
-#VTC_FLAVOR =  @string "m1.small" "m1.medium" "m1.large"
 
 
 [InfluxDB]
@@ -52,18 +31,7 @@ influxdb_db_name = database
 
 
 [Deployment-parameters]
-#default_net =        monitoring
-#default_subnet =     monitoring_subnet
-#source_net =         inbound_traffic_network
-#source_subnet =      inbound_traffic_subnet
-#destination_net =    destination_B_network
-#destination_subnet = destination_B_subnet
-#destination_subnet = destination_B_subnet
-#key_name = destination_B_subnet
 
 
 [Testcase-parameters]
-#packet_size = 1280
-#throughput = 1
-#vlan_sender = 1000
-#vlan_receiver = 1001
\ No newline at end of file
+
index 1851f1b..e0209be 100644 (file)
@@ -118,6 +118,10 @@ class FrameworkApi(object):
         credentials = openstack_credentials
 
         msg = 'The provided heat_template does not exist'
+        if common.RELEASE == 'liberty':
+            heat_template = 'vTC_liberty.yaml'
+        else:
+            heat_template = 'vTC.yaml'
         template = "{}{}".format(common.get_template_dir(), heat_template)
         common.InputValidation.validate_file_exist(template, msg)
 
index c85aff5..320beca 100644 (file)
@@ -179,7 +179,12 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
                   self.params[VLAN_RECEIVER]
         # An IP address is required for the interface to receive a multicast
         # flow. The specific address is not important
-        command += ' 10.254.254.254 up'
+        command += ' 10.254.254.254 up netmask 255.255.255.248'
+        common.run_command(command)
+
+        command = "sudo ifconfig "
+        command += self.interface_name + "." + self.params[VLAN_RECEIVER]
+        command += " promisc"
         common.run_command(command)
 
         # configure smcroute
@@ -193,6 +198,7 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
         # run smcroute on the interface
         command = 'sudo smcroute -d'
         common.run_command(command)
+        time.sleep(3)
 
         # Start the packet checker
         current_dir = os.path.dirname(os.path.realpath(__file__))
index cbb4121..1eab70c 100644 (file)
@@ -29,8 +29,14 @@ class InstantiationValidationNoisyNeighborsBenchmark(
 
     def __init__(self, name, params):
         base.InstantiationValidationBenchmark.__init__(self, name, params)
+
+        if common.RELEASE == 'liberty':
+            temp_name = 'stress_workload_liberty.yaml'
+        else:
+            temp_name = 'stress_workload.yaml'
+
         self.template_file = common.get_template_dir() + \
-            'stress_workload.yaml'
+            temp_name
         self.stack_name = 'neighbour'
         self.neighbor_stack_names = list()
 
index ee02bcc..f2a87b2 100644 (file)
@@ -26,8 +26,14 @@ class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
 
     def __init__(self, name, params):
         base.RFC2544ThroughputBenchmark.__init__(self, name, params)
+
+        if common.RELEASE == 'liberty':
+            temp_name = 'stress_workload_liberty.yaml'
+        else:
+            temp_name = 'stress_workload.yaml'
+
         self.template_file = "{}{}".format(common.get_template_dir(),
-                                           'stress_workload.yaml')
+                                           temp_name)
         self.stack_name = 'neighbour'
         self.neighbor_stack_names = list()
 
index e86cc83..4bacd38 100644 (file)
@@ -25,10 +25,13 @@ from experimental_framework.constants import framework_parameters as fp
 # List of common variables
 # ------------------------------------------------------
 
+allowed_releases = ['liberty', 'kilo', 'juno']
+
 LOG = None
 CONF_FILE = None
 DEPLOYMENT_UNIT = None
 ITERATIONS = None
+RELEASE = None
 
 BASE_DIR = None
 RESULT_DIR = None
@@ -87,6 +90,7 @@ def init_general_vars(api=False):
     global TEMPLATE_DIR
     global RESULT_DIR
     global ITERATIONS
+    global RELEASE
 
     TEMPLATE_FILE_EXTENSION = '.yaml'
 
@@ -97,6 +101,12 @@ def init_general_vars(api=False):
             "Section " + cf.CFS_GENERAL +
             "is not present in configuration file")
 
+    InputValidation.\
+        validate_configuration_file_section(
+            cf.CFS_OPENSTACK,
+            "Section " + cf.CFS_OPENSTACK +
+            "is not present in configuration file")
+
     TEMPLATE_DIR = '/tmp/apexlake/heat_templates/'
     # if not os.path.exists(TEMPLATE_DIR):
     #     os.makedirs(TEMPLATE_DIR)
@@ -121,6 +131,11 @@ def init_general_vars(api=False):
     if not os.path.isdir(RESULT_DIR):
         os.mkdir(RESULT_DIR)
 
+    if cf.CFSO_RELEASE in CONF_FILE.get_variable_list(cf.CFS_OPENSTACK):
+        RELEASE = CONF_FILE.get_variable(cf.CFS_OPENSTACK, cf.CFSO_RELEASE)
+        if RELEASE not in allowed_releases:
+            raise ValueError("Release {} is not supported".format(RELEASE))
+
     # Validate and assign Iterations
     if cf.CFSG_ITERATIONS in CONF_FILE.get_variable_list(cf.CFS_GENERAL):
         ITERATIONS = int(CONF_FILE.get_variable(cf.CFS_GENERAL,
@@ -132,7 +147,11 @@ def init_general_vars(api=False):
 def init_log():
     global LOG
     LOG = logging.getLogger()
-    LOG.setLevel(level=logging.INFO)
+    debug = CONF_FILE.get_variable(cf.CFS_GENERAL, cf.CFSG_DEBUG)
+    if debug == 'true' or debug == 'True':
+        LOG.setLevel(level=logging.DEBUG)
+    else:
+        LOG.setLevel(level=logging.INFO)
     log_formatter = logging.Formatter("%(asctime)s --- %(message)s")
     file_handler = logging.FileHandler("{0}/{1}.log".format("./", "benchmark"))
     file_handler.setFormatter(log_formatter)
index f397984..ce46d80 100644 (file)
@@ -44,7 +44,8 @@ def get_sections_api():
     return [
         CFS_PKTGEN,
         CFS_GENERAL,
-        CFS_INFLUXDB
+        CFS_INFLUXDB,
+        CFS_OPENSTACK
         # Add here eventually new sections in configuration file ...
     ]
 
@@ -98,3 +99,4 @@ CFSO_USER = 'user'
 CFSO_PASSWORD = 'password'
 CFSO_AUTH_URI = 'auth_uri'
 CFSO_PROJECT = 'project'
+CFSO_RELEASE = 'release'
diff --git a/yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml b/yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml
new file mode 100644 (file)
index 0000000..bac5701
--- /dev/null
@@ -0,0 +1,71 @@
+heat_template_version: 2014-10-16
+description: HOT template to create a DPI
+
+parameters:
+   name:
+      type: string
+      default: cpu_stress
+   cores:
+       type: string
+   memory:
+       type: string
+   network:
+       type: string
+   subnet:
+       type: string
+
+resources:
+   port:
+      type: OS::Neutron::Port
+      properties:
+         network: { get_param: network }
+         port_security_enabled: false
+         fixed_ips:
+            - subnet: { get_param: subnet }
+
+   vm1:
+      type: OS::Nova::Server
+      properties:
+         name: traffic_vm1
+         image: ubuntu1404
+         user_data:
+            str_replace:
+               template: |
+                  #!/bin/sh
+                  echo "Creating custom user..."
+                  useradd clouduser -g admin -s /bin/bash -m
+                  echo clouduser:secrete | chpasswd
+                  echo "Enabling ssh password login..."
+                  sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
+                  service ssh restart
+                  sleep 1
+
+                  ifconfig eth1 up
+                  dhclient eth1
+
+                  sed -i 's/localhost/localhost traffic_vm1/g' /etc/hosts
+                  touch /etc/resolvconf/resolv.conf.d/tail
+                  echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
+                  resolvconf -u
+                  echo 'nameserver 10.118.32.193' > /etc/resolv.conf
+
+
+                  # Installation of stress
+                  apt-get install -y stress
+
+                  cd /home/clouduser
+
+                  # workload setup
+                  echo 'stress -c $CORES --vm-bytes $MEMORY' > ./stress.sh
+                  chmod +x ./stress.sh
+                  nohup ./stress.sh &
+                  #nohup stress -c #CORES --vm-bytes #MEMORY
+
+               params:
+                  $NAME: { get_param: name }
+                  $CORES: { get_param: cores }
+                  $MEMORY: { get_param: memory }
+
+         flavor: m1.small
+         networks:
+            - port: { get_resource: port }
index 3bc4dcd..3493328 100644 (file)
@@ -81,7 +81,18 @@ resources:
             ifconfig eth2 up
             dhclient eth1
             dhclient eth2
+
+            # Fix Network Confiuration
             sed -i 's/localhost/localhost vtc/g' /etc/hosts
+            touch /etc/resolvconf/resolv.conf.d/tail
+            #echo 'nameserver 192.168.10.1' > /etc/resolvconf/resolv.conf.d/tail
+            #echo 'nameserver 10.20.0.2' > /etc/resolvconf/resolv.conf.d/tail
+            echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
+            resolvconf -u
+
+
+            echo 'nameserver 10.118.32.193' > /etc/resolv.conf
+
 
             # Install vTC Dependencies
             apt-get update
diff --git a/yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml b/yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml
new file mode 100644 (file)
index 0000000..9ae0c26
--- /dev/null
@@ -0,0 +1,183 @@
+heat_template_version: 2014-10-16
+description: HOT template to deploy a virtual Traffic Classifier
+
+parameters:
+  default_net:
+    type: string
+  default_subnet:
+    type: string
+  source_net:
+    type: string
+  source_subnet:
+    type: string
+  destination_net:
+    type: string
+  destination_subnet:
+    type: string
+  timeout:
+    type: number
+    description: Timeout for WaitCondition, depends on your image and environment
+    default: 2000
+
+resources:
+  wait_condition:
+    type: OS::Heat::WaitCondition
+    properties:
+      handle: {get_resource: wait_handle}
+      count: 1
+      timeout: {get_param: timeout}
+
+  wait_handle:
+    type: OS::Heat::WaitConditionHandle
+
+  ### DEFAULT NETWORK FOR MNGM
+  port_1:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: default_net }
+      binding:vnic_type: normal
+      port_security_enabled: true
+      fixed_ips:
+        - subnet: { get_param: default_subnet }
+
+  ### NETWORK FOR RECEIVING TRAFFIC
+  port_2:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: source_net }
+      binding:vnic_type: #vnic_type
+      port_security_enabled: false
+      fixed_ips:
+        - subnet: { get_param: source_subnet }
+
+  ### NETWORK FOR SENDING TRAFFIC
+  port_3:
+    type: OS::Neutron::Port
+    properties:
+      network: { get_param: destination_net }
+      binding:vnic_type: #vnic_type
+      port_security_enabled: false
+      fixed_ips:
+        - subnet: { get_param: destination_subnet }
+
+  server:
+    type: OS::Nova::Server
+    properties:
+      name: vTC
+      #key_name: { get_param: key_name }
+      image: ubuntu1404
+      user_data:
+        str_replace:
+          template: |
+            #!/bin/sh
+            # Creation of a user
+            echo "Creating custom user..."
+            useradd clouduser -g admin -s /bin/bash -m
+            echo clouduser:yardstick | chpasswd
+            echo "Enabling ssh password login..."
+            sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
+            service ssh restart
+            sleep 1
+
+            # wake up interfaces
+            ifconfig eth1 up
+            ifconfig eth2 up
+            dhclient eth1
+            dhclient eth2
+            ifconfig 10.254.254.253 up netmask 255.255.255.248
+
+            # Fix Network Confiuration
+            sed -i 's/localhost/localhost vtc/g' /etc/hosts
+            touch /etc/resolvconf/resolv.conf.d/tail
+            #echo 'nameserver 192.168.10.1' > /etc/resolvconf/resolv.conf.d/tail
+            #echo 'nameserver 10.20.0.2' > /etc/resolvconf/resolv.conf.d/tail
+            echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
+            resolvconf -u
+
+
+            echo 'nameserver 10.118.32.193' > /etc/resolv.conf
+
+
+            # Install vTC Dependencies
+            apt-get update
+            apt-get install -y git build-essential gcc libnuma-dev bison flex byacc libjson0-dev libcurl4-gnutls-dev jq dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
+            apt-get install -y byacc libtool libcurl4-openssl-dev
+
+            cd /home/clouduser
+
+            # Setup multicast
+            echo mgroup from eth1 group 224.192.16.1 > /etc/smcroute.conf
+            git clone https://github.com/troglobit/smcroute.git
+            cd smcroute
+            git reset --hard c3f5c56
+            sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
+            sed -i 's/automake-1.11/automake/g' ./autogen.sh
+            ./autogen.sh
+            ./configure
+            make
+            make install
+            cd ..
+            touch multicast.sh
+            echo "#!/bin/bash" > multicast.sh
+            echo "while [ true ]" >> multicast.sh
+            echo "do" >> multicast.sh
+            echo "  smcroute -k" >> multicast.sh
+            echo "  smcroute -d" >> multicast.sh
+            echo "  sleep 50" >> multicast.sh
+            echo "done" >> multicast.sh
+            chmod +x multicast.sh
+            ./multicast.sh &
+
+            rm resp.json
+            curl -X POST -u "mPkgwvJPsTFS8hYmHk:SDczcrK4cvnkMRWSEchB3ANcWbqFXqPx" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token=38uFQuhEdPvCTbhc7k >> resp.json
+            access_token=`jq -r '.access_token' resp.json`
+            git clone https://x-token-auth:${access_token}@bitbucket.org/akiskourtis/vtc.git
+            cd vtc
+            git checkout -b stable
+            #Build nDPI library
+            cd nDPI
+            NDPI_DIR=$(pwd)
+            echo $NDPI_DIR
+            NDPI_INCLUDE=$(pwd)/src/include
+            echo $NDPI_INCLUDE
+            ./autogen.sh
+            ./configure
+            make
+            make install
+
+            #Build PF_RING library
+            cd ..
+            cd PF_RING
+            make
+            #Build PF_RING examples, including the modified pfbridge, with nDPI integrated.
+            cd userland/examples/
+            sed -i 's#EXTRA_LIBS =#EXTRA_LIBS='"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c#' ./Makefile
+            sed -i 's# -Ithird-party# -Ithird-party/ -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'#' ./Makefile
+            echo $NDPI_DIR
+            make
+            cd ../..
+            cd ..
+            cd ..
+
+            # To use PF_RING driver use the following
+            #sudo rmmod pf_ring
+            #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=16384 enable_debug=1 quick_mode=1 enable_tx_capture=0
+            #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
+            sleep 5
+
+            # To use the Linux kernel driver use the following
+            cd /home/clouduser/
+            sudo nohup ./vtc/nDPI/example/ndpiReader -i eth1 -a eth2 &
+            sleep 5
+
+            curl --data-ascii "{\"classification_rules\":[{\"RuleId\":\"1\",\"ToS\":\"16\"}]}" http://localhost:9999/classifier/classification_rules/224.192.16.1 &
+            wc_notify --data-binary '{"status": "SUCCESS"}'
+          params:
+            wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
+            #$IP_FAMILY: { get_param: ip_family }
+      flavor: #vtc_flavor
+      networks:
+        - port: { get_resource: port_1 }
+        - port: { get_resource: port_2 }
+        - port: { get_resource: port_3 }
+outputs:
index aac363e..188a7f0 100644 (file)
@@ -46,5 +46,9 @@ setup(name='apexlake',
           ('/tmp/apexlake/heat_templates/',
            ['heat_templates/vTC.yaml']),
           ('/tmp/apexlake/heat_templates/',
-           ['heat_templates/stress_workload.yaml'])
+           ['heat_templates/stress_workload.yaml']),
+          ('/tmp/apexlake/heat_templates/',
+           ['heat_templates/vTC_liberty.yaml']),
+          ('/tmp/apexlake/heat_templates/',
+           ['heat_templates/stress_workload_liberty.yaml'])
       ])
index 3266ce6..2b03edb 100644 (file)
@@ -24,6 +24,6 @@ class TestConfFileSection(unittest.TestCase):
         pass
 
     def test_get_sections_api_for_success(self):
-        expected = ['PacketGen', 'General', 'InfluxDB']
+        expected = ['PacketGen', 'General', 'InfluxDB', 'OpenStack']
         output = cfs.get_sections_api()
         self.assertEqual(expected, output)
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml
new file mode 100644 (file)
index 0000000..aa3959f
--- /dev/null
@@ -0,0 +1,199 @@
+heat_template_version: 2014-10-16
+description: HOT template to create a DPI
+
+parameters:
+   default_net:
+      type: string
+   default_subnet:
+      type: string
+   source_net:
+      type: string
+   source_subnet:
+      type: string
+   destination_net:
+      type: string
+   destination_subnet:
+      type: string
+   internal_net:
+      type: string
+   internal_subnet:
+      type: string
+   node:
+      type: string
+      default: compB
+   name:
+      type: string
+      default: vtc
+   ip_family:
+      type: string
+   timeout:
+      type: number
+      description: Timeout for WaitCondition, depends on your image and environment
+      default: 1000
+
+resources:
+   wait_condition:
+      type: OS::Heat::WaitCondition
+      properties:
+         handle: {get_resource: wait_handle}
+         count: 1
+         timeout: {get_param: timeout}
+
+   wait_handle:
+      type: OS::Heat::WaitConditionHandle
+
+
+   ### DEFAULT NETWORK FOR MERLIN DATA
+   port_1:
+      type: OS::Neutron::Port
+      properties:
+         network: { get_param: default_net }
+         binding:vnic_type: normal
+         fixed_ips:
+            - subnet: { get_param: default_subnet }
+
+   ### NETWORK FOR RECEIVING TRAFFIC
+   port_2:
+      type: OS::Neutron::Port
+      properties:
+         network: { get_param: source_net }
+         binding:vnic_type: #vnic_type
+         fixed_ips:
+            - subnet: { get_param: source_subnet }
+
+   ### NETWORK FOR SENDING TRAFFIC
+   port_3:
+      type: OS::Neutron::Port
+      properties:
+         network: { get_param: destination_net }
+         binding:vnic_type: #vnic_type
+         fixed_ips:
+            - subnet: { get_param: destination_subnet }
+
+   flavor:
+      type: OS::Nova::Flavor
+      properties:
+         disk: 20
+         ram: #ram
+         vcpus: #vcpus
+         #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
+         extra_specs: { node: { get_param: node } }
+
+   server:
+      type: OS::Nova::Server
+      properties:
+         name: vTC
+         key_name: test
+         image: ubuntu1404
+         user_data:
+                str_replace:
+                    template: |
+                        #!/bin/sh
+
+                        # Creation of a user
+                        NAME=$name
+                        echo "Creating custom user..."
+                        useradd clouduser -g admin -s /bin/bash -m
+                        echo clouduser:secrete | chpasswd
+                        echo "Enabling ssh password login..."
+                        sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
+                        service ssh restart
+                        sleep 1
+
+                        # wake up interfaces
+                        ifconfig eth1 up
+                        ifconfig eth2 up
+                        dhclient eth1
+                        dhclient eth2
+
+                        sed -i 's/localhost/localhost vtc/g' /etc/hosts
+                        ip route del 0/0
+                        route add default gw 192.168.200.1
+
+                        AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
+                        BB=$(echo $AA | awk '{ print $1 }')
+
+                        # Setup Instrumentation Agent
+                        rm -rf cimmaron
+                        mkdir cimmaron
+                        cd cimmaron
+                        apt-get install -y zip
+                        wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
+                        unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
+                        ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
+                        ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
+                        nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
+                        cd ..
+
+                        # Setup for PF_RING and bridge between interfaces
+                        apt-get update
+                        apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
+
+                        # Setup multicast
+                        echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
+                        cd /home/clouduser/
+                        git clone https://github.com/troglobit/smcroute.git
+                        cd smcroute
+                        sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
+                        sed -i 's/automake-1.11/automake/g' ./autogen.sh
+                        ./autogen.sh
+                        ./configure
+                        make
+                        make install
+                        cd ..
+                        touch multicast.sh
+                        echo "#!/bin/bash" > multicast.sh
+                        echo "while [ true ]" >> multicast.sh
+                        echo "do" >> multicast.sh
+                        echo "  smcroute -k" >> multicast.sh
+                        echo "  smcroute -d" >> multicast.sh
+                        echo "  sleep 50" >> multicast.sh
+                        echo "done" >> multicast.sh
+                        chmod +x multicast.sh
+                        ./multicast.sh &
+
+                        # Setup for PF_RING and bridge between interfaces
+                        # Akis Repository
+                        #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
+                        #cd vtc
+                        #git checkout stable
+
+                        # Intel Repository
+                        git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
+                        cd vtc_master
+
+                        cd nDPI
+                        NDPI_DIR=$(pwd)
+                        echo $NDPI_DIR
+                        NDPI_INCLUDE=$(pwd)/src/include
+                        echo $NDPI_INCLUDE
+                        ./autogen.sh
+                        ./configure
+                        make
+                        make install
+                        cd ..
+                        cd PF_RING
+                        make
+                        cd userland/examples/
+                        sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
+                        sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
+                        make
+                        cd ../..
+                        cd ..
+                        cd ..
+                        #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
+                        #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
+                        insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
+                        ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
+                        wc_notify --data-binary '{"status": "SUCCESS"}'
+                    params:
+                        wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
+                        $name: { get_param: name }
+                        $IP_FAMILY: { get_param: ip_family }
+
+         flavor: { get_resource: flavor }
+         networks:
+            - port: { get_resource: port_1 }
+            - port: { get_resource: port_2 }
+            - port: { get_resource: port_3 }
+outputs:
\ No newline at end of file
index 9d517bc..369129a 100644 (file)
@@ -65,7 +65,8 @@ def dummy_run_command_2(command, get_counters=None):
                   '100 type vlan id 100':
         command_counter[0] += 1
         return
-    elif command == 'sudo ifconfig interface.100 10.254.254.254 up':
+    elif command == 'sudo ifconfig interface.100 10.254.254.254 up' \
+                    ' netmask 255.255.255.248':
         command_counter[1] += 1
         return
     elif command == "sudo echo 'mgroup from interface.100 group" \