#!/bin/bash
set_versions () {
DOCKER_VERSION=17.12.1.ce-1.fc27
DOCKER_COMPOSE_VERSION=1.22.0
}
enable_root_ssh () {
sed -i 's/PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
service sshd restart
echo -e "arthur\narthur" | passwd root
}
update_os () {
dnf -y install fedora-upgrade
}
docker_install_configure () {
dnf -y remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
dnf -y install dnf-plugins-core
dnf config-manager \
--add-repo \
https://download.docker.com/linux/fedora/docker-ce.repo
dnf -y install docker-ce-$DOCKER_VERSION
systemctl start docker
mkdir -p /etc/systemd/system/docker.service.d/
cat > /etc/systemd/system/docker.service.d/override.confg<< EOF
[Service]
Environment="http_proxy=http://10.144.1.10:8080/"
Environment="https_proxy=http://10.144.1.10:8080/"
Environment="no_proxy=10.157.167.132,127.0.0.1,localhost,.noklab.net,.int.net.nokia.com,.ext.net.nokia.com,.int.nokia.com,.nsn-rdnet.com,.nsn-net.net,.inside.nokiasiemensnetworks.com,.access.nokiasiemensnetworks.com,.nsn-intra.net,.inside.nsn.com,.access.nsn.com"
EOF
systemctl daemon-reload
systemctl restart docker
docker login -u docker -p docker nexus3.onap.org:10003
}
docker_compose_install () {
curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
}
pnf_sim_file_checkout () {
mkdir ~/sim/
mkdir ~/sim/config
cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/config/config.json;hb=HEAD" -O config.json
cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/config/netconf.env;hb=HEAD" -O netconf.env
mkdir ~/sim/json_schema
cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/json_schema/input_validator.json;hb=HEAD" -O input_validator.json
cd ~/sim/config/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/json_schema/output_validator.json;hb=HEAD" -O output_validator.json
mkdir ~/sim/netconf
cd ~/sim/netconf/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/netconf/pnf-simulator.data.xml;hb=HEAD" -O pnf-simulator.data.xml
cd ~/sim/netconf/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/netconf/pnf-simulator.yang;hb=HEAD" -O pnf-simulator.yang
cd ~/sim/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/docker-compose.yml;hb=HEAD" -O docker-compose.yml
cd ~/sim/;wget "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=test/mocks/pnfsimulator/simulator.sh;hb=HEAD" -O simulator.sh
chmod 654 ~/sim/simulator.sh
}
start_simulator (){
~/sim/simulator.sh start
}
set_versions
enable_root_ssh
update_os
docker_install_configure
docker_compose_install
pnf_sim_file_checkout
start_simulator |