summaryrefslogtreecommitdiffstats
path: root/docker/Dockerfile
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-12-06 12:38:14 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-06 12:38:14 +0000
commitba75838bd3e19e902caa826124b35b40bcbb3d78 (patch)
tree10811c8257c50fc6671a7008e1136514dcd6afd1 /docker/Dockerfile
parent570fbf3a0752467cece19518988fd8a7eae68321 (diff)
parent32452119f7532cd7dd0cab7e03c9d3777dd23ca1 (diff)
Merge "Sort multi-line arguments alphanumerically"
Diffstat (limited to 'docker/Dockerfile')
-rw-r--r--docker/Dockerfile26
1 files changed, 13 insertions, 13 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index dc772c5b8..4caf50d1a 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -57,26 +57,26 @@ WORKDIR ${HOME}
# Packaged dependencies
RUN apt-get update && apt-get install -y \
-ssh \
-sshpass \
+build-essential \
+bundler \
+crudini \
curl \
-git \
gcc \
-wget \
+git \
+libffi-dev \
+libgmp3-dev \
+libpq-dev \
+libssl-dev \
+libxml2-dev \
+libxslt-dev \
python-dev \
python-mock \
python-pip \
-bundler \
postgresql \
-build-essential \
-libpq-dev \
-libxslt-dev \
-libssl-dev \
-libgmp3-dev \
-libxml2-dev \
-libffi-dev \
-crudini \
ruby1.9.1-dev \
+ssh \
+sshpass \
+wget \
--no-install-recommends
RUN pip install --upgrade pip
* Literal.String */ .highlight .na { color: #a6e22e } /* Name.Attribute */ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */ .highlight .nc { color: #a6e22e } /* Name.Class */ .highlight .no { color: #66d9ef } /* Name.Constant */ .highlight .nd { color: #a6e22e } /* Name.Decorator */ .highlight .ni { color: #f8f8f2 } /* Name.Entity */ .highlight .ne { color: #a6e22e } /* Name.Exception */ .highlight .nf { color: #a6e22e } /* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/usr/bin/python

##
## Copyright (c) 2020 Intel Corporation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
##     http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

from rapid_log import RapidLog 
from prox_ctrl import prox_ctrl
from rapid_machine import RapidMachine
from math import ceil, log2


class RandomPortBits(object):
    """
    Class to generate PROX bitmaps for random bit generation
    in source & dst UPD ports to emulate mutiple flows
    """
    @staticmethod
    def get_bitmap(flow_number):
        number_of_random_bits = ceil(log2(flow_number))
        if number_of_random_bits > 30:
            raise Exception("Not able to support that many flows")
            # throw exeption since we need the first bit to be 1
            # Otherwise, the randomization could results in all 0's
            # and that might be an invalid UDP port and result in 
            # packets being discarded
        src_number_of_random_bits = number_of_random_bits // 2
        dst_number_of_random_bits = (number_of_random_bits -
                src_number_of_random_bits)
        src_port_bitmap = '1000000000000000'.replace ('0','X',
                src_number_of_random_bits)
        dst_port_bitmap = '1000000000000000'.replace ('0','X',
                dst_number_of_random_bits)
        return [src_port_bitmap, dst_port_bitmap, 1 << number_of_random_bits]

class RapidGeneratorMachine(RapidMachine):
    """
    Class to deal with a generator PROX instance (VM, bare metal, container)
    """
    def __init__(self, key, user, vim, rundir, machine_params, ipv6):
        mac_address_size = 6
        ethertype_size = 2
        FCS_size = 4
        if ipv6:
            ip_header_size = 40
            self.ip_length_offset = 18
            # In IPV6, the IP size is the size of the IP content
            self.frame_size_minus_ip_size = (2 * mac_address_size +
                    ethertype_size + ip_header_size + FCS_size)
        else:
            ip_header_size = 20
            self.ip_length_offset = 16
            # In IPV4, the IP size is the size of the IP header + IP content
            self.frame_size_minus_ip_size = (2 * mac_address_size +
                    ethertype_size + FCS_size)
        self.frame_size_minus_udp_header_and_content = (2 * mac_address_size +
                ethertype_size + ip_header_size + FCS_size )
        udp_header_start_offset = (2 * mac_address_size + ethertype_size +
                ip_header_size)
        self.udp_source_port_offset = udp_header_start_offset 
        self.udp_dest_port_offset = udp_header_start_offset + 2
        self.udp_length_offset = udp_header_start_offset + 4
        self.ipv6 = ipv6
        super().__init__(key, user, vim, rundir, machine_params)

    def get_cores(self):
        return (self.machine_params['gencores'] +
                self.machine_params['latcores'])

    def generate_lua(self, vim):
        appendix = 'gencores="%s"\n'% ','.join(map(str,
            self.machine_params['gencores']))
        appendix = appendix + 'latcores="%s"\n'% ','.join(map(str,
            self.machine_params['latcores']))
        if 'gw_vm' in self.machine_params.keys():
            for index, gw_ip in enumerate(self.machine_params['gw_ips'],
                    start = 1):
                appendix = appendix + 'gw_ip{}="{}"\n'.format(index, gw_ip)
                appendix = (appendix + 'gw_hex_ip{}=convertIPToHex(gw_ip{})\n'.
                        format(index, index))
        if 'bucket_size_exp' in self.machine_params.keys():
            self.bucket_size_exp = self.machine_params['bucket_size_exp']
        else:
            self.bucket_size_exp = 11
        appendix = (appendix +
                'bucket_size_exp="{}"\n'.format(self.bucket_size_exp))
        if 'heartbeat' in self.machine_params.keys():
            appendix = (appendix +
                    'heartbeat="%s"\n'% self.machine_params['heartbeat'])
        else:
            appendix = appendix + 'heartbeat="60"\n'
        super().generate_lua(vim, appendix)

    def start_prox(self):
        # Start the generator with the -e option so that the cores don't
        # start automatically
        super().start_prox('-e')

    def set_generator_speed(self, speed):
        # The assumption is that we only use task 0 for generating
        # We should check the gen.cfg file to make sure there is only task=0
        speed_per_gen_core = speed / len(self.machine_params['gencores']) 
        self.socket.speed(speed_per_gen_core, self.machine_params['gencores'])

    def set_udp_packet_size(self, imix_frame_sizes):
        # We should check the gen.cfg to make sure we only send UDP packets
        # If only 1 packet size, still using the 'old' way of setting the 
        # packet sizes in PROX. Otherwise, using the 'new' way which
        # automatically sets IP and UDP sizes. We should switch to the new way
        # eventually for all cases.
        if len(imix_frame_sizes) == 1:
            # Frame size = PROX pkt size + 4 bytes CRC
            # The set_size function takes the PROX packet size as a parameter
            self.socket.set_size(self.machine_params['gencores'], 0,
                    imix_frame_sizes[0] - 4)
            # Writing length in the ip header
            self.socket.set_value(self.machine_params['gencores'], 0,
                    self.ip_length_offset, imix_frame_sizes[0] - 
                    self.frame_size_minus_ip_size, 2)
            # Writing length in the udp header
            self.socket.set_value(self.machine_params['gencores'], 0,
                    self.udp_length_offset, imix_frame_sizes[0] -
                    self.frame_size_minus_udp_header_and_content, 2)
        else:
            if self.ipv6:
                RapidLog.critical('IMIX not supported for IPV6')
            prox_sizes = [frame_size - 4 for frame_size in imix_frame_sizes]
            self.socket.set_imix(self.machine_params['gencores'], 0,
                    prox_sizes)

    def set_flows(self, number_of_flows):
        source_port, destination_port, actualflows = RandomPortBits.get_bitmap(
                number_of_flows)
        self.socket.set_random(self.machine_params['gencores'],0,
                self.udp_source_port_offset, source_port,2)
        self.socket.set_random(self.machine_params['gencores'],0,
                self.udp_dest_port_offset, destination_port,2)
        return actualflows

    def start_gen_cores(self):
        self.socket.start(self.machine_params['gencores'])

    def stop_gen_cores(self):
        self.socket.stop(self.machine_params['gencores'])

    def start_latency_cores(self):
        self.socket.start(self.machine_params['latcores'])

    def stop_latency_cores(self):
        self.socket.stop(self.machine_params['latcores'])

    def lat_stats(self):
        # Checking all tasks in the cfg file. In this way, we can have more
        # latency tasks on the same core
        return (self.socket.lat_stats(self.machine_params['latcores'],
                self.all_tasks_for_this_cfg))