blob: 31d41b2c8064416fec2d92536045c4f3442cb8aa [file] [log] [blame]
Jessica Wagantall87d26652019-04-01 18:05:03 -07001#!/bin/bash
2# SPDX-License-Identifier: EPL-1.0
3##############################################################################
4# Copyright (c) 2019 The Linux Foundation and others.
5#
6# All rights reserved. This program and the accompanying materials
7# are made available under the terms of the Eclipse Public License v1.0
8# which accompanies this distribution, and is available at
9# http://www.eclipse.org/legal/epl-v10.html
10##############################################################################
11echo "---> nexus3_port_forwarding.sh"
12set +e # DON'T fail build if script fails.
13
14NEXUS3_IP=`host nexus3.onap.org | awk '/has address/ { print $4 ; exit }'`
15OS_ARCH=$(ANSIBLE_STDOUT_CALLBACK=json ANSIBLE_LOAD_CALLBACK_PLUGINS=1 \
16 ansible all -i "localhost," --connection=local -m setup | jq -r \
17 '.. | .ansible_architecture? | select(type != "null")' \
18 | tr '[:upper:]' '[:lower:]')
19
20
21if [[ "${OS_ARCH}" == "aarch64" ]] ;then
22 echo "os_arch: $OS_ARCH"
23 iptables -t nat -I OUTPUT 1 -p tcp -d ${NEXUS3_IP} --dport 10001 -j DNAT --to-destination ${NEXUS3_IP}:11001
24 iptables -t nat -I OUTPUT 1 -p tcp -d ${NEXUS3_IP} --dport 10002 -j DNAT --to-destination ${NEXUS3_IP}:11002
25 iptables -t nat -I OUTPUT 1 -p tcp -d ${NEXUS3_IP} --dport 10003 -j DNAT --to-destination ${NEXUS3_IP}:11003
26fi
27
28# DON'T fail build if script fails.
29exit 0