review SPDR sims nomenclature
[transportpce.git] / tests / Xtesting / DockerSims / dockercmd_profile.sh
1 #!/bin/sh
2
3 DEVICE_VERSION=${1:-all}
4
5 # this file centralizes inb one place parameters needed by docker scripts,
6 # more especially the image lists for 1.2.1 and 2.2.1 devices.
7 # device versions supported as scripts argument are 1.2.1 and 2.2.1 and "all"
8
9 #IMAGE_LIST format is suffix_port : container/image name : config file to fill netconf operational datastore
10
11 IMAGE121_LIST="30:xpdra-1.2.1:1.2.1/oper-XPDRA.xml
12 31:roadma-1.2.1:1.2.1/oper-ROADMA.xml
13 32:roadmb-1.2.1:1.2.1/oper-ROADMB.xml
14 33:roadmc-1.2.1:1.2.1/oper-ROADMC.xml
15 34:xpdrc-1.2.1:1.2.1/oper-XPDRC.xml
16 21:roadma-full-1.2.1:1.2.1/oper-ROADMA-full.xml
17 23:roadmc-full-1.2.1:1.2.1/oper-ROADMC-full.xml
18 "
19
20 IMAGE221_LIST="40:xpdra-2.2.1:2.2.1/oper-XPDRA.xml
21 41:roadma-2.2.1:2.2.1/oper-ROADMA.xml
22 42:roadmb-2.2.1:2.2.1/oper-ROADMB.xml
23 43:roadmc-2.2.1:2.2.1/oper-ROADMC.xml
24 44:xpdrc-2.2.1:2.2.1/oper-XPDRC.xml
25 45:spdra-2.2.1:2.2.1/oper-SPDRA.xml
26 25:spdra_no_interface-2.2.1:2.2.1/oper-SPDRA_no_interface.xml
27 "
28
29 case "$DEVICE_VERSION" in
30     "1.2.1") IMAGE_LIST=$IMAGE121_LIST
31     ;;
32     "2.2.1") IMAGE_LIST=$IMAGE221_LIST
33     ;;
34     "all") IMAGE_LIST=$IMAGE121_LIST" "$IMAGE221_LIST
35     ;;
36     *) echo "unsupported device version"
37     exit 1
38     ;;
39 esac
40
41 DOCKER_CMD=docker
42 DOCKER_IMAGE=honeynode:alpine-jre11
43 RESTCONF_USER=admin
44 RESTCONF_PASSWORD=admin
45 if [ `which podman` ]
46 then DOCKER_CMD=podman
47 else
48     if [ ! `which $DOCKER_CMD` ]
49     then  echo "no docker command available" >&2
50         exit 1
51     fi
52     #if "docker ps" cannot be run without error, prepend sudo
53     if ( ! $DOCKER_CMD ps >/dev/null 2>&1 );then
54         echo "docker command only usable as root, using sudo" >&2
55         DOCKER_CMD="sudo docker"
56     fi
57 fi
58
59