3 # Copyright (c) 2021 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # CSIT SRIOV VF initialization and isolation.
23 for cnt in $(seq 1 ${2:-1}); do
24 docker network create --driver bridge csit-nw-tg${cnt} || true
25 # If the IMAGE is not already loaded then docker run will pull the
26 # IMAGE, and all image dependencies, before it starts the container.
27 dcr_image="csit_sut-ubuntu2204:local"
28 # Run the container in the background and print the new container
30 dcr_stc_params="--detach=true "
31 # Give extended privileges to this container. A "privileged"
32 # container is given access to all devices and able to run nested
34 dcr_stc_params+="--privileged "
35 # Publish all exposed ports to random ports on the host interfaces.
36 dcr_stc_params+="--publish 600${cnt}:2222 "
37 # Automatically remove the container when it exits.
38 dcr_stc_params+="--rm "
40 dcr_stc_params+="--shm-size 4G "
41 # Mount vfio to be able to bind to see binded interfaces. We cannot
42 # use --device=/dev/vfio as this does not see newly binded
44 dcr_stc_params+="--volume /dev:/dev "
45 # Mount /opt/boot/ where VM kernel and initrd are located.
46 dcr_stc_params+="--volume /opt:/opt "
47 # Mount host hugepages for VMs.
48 dcr_stc_params+="--volume /dev/hugepages:/dev/hugepages "
50 params=(${dcr_stc_params} --name csit-tg-"${cnt}" "${dcr_image}")
51 docker run --network=csit-nw-tg${cnt} "${params[@]}"
55 docker rm --force $(docker ps --all --quiet --filter name=csit)
56 docker network rm $(docker network ls --filter name=csit --quiet)