Skip to content
Snippets Groups Projects
Commit 6dd43834 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

Resolve "Access to scrambled ports not working"

parent f803010d
No related branches found
No related tags found
9 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!195DO NOT MERGE 2,!194DO NOT MERGE! just for testing,!165Resolve "Access to scrambled ports not working",!138Develop
......@@ -16,7 +16,7 @@ import (
const unreachable = "203.0.113.10:6030"
const testPath = "/system/config/hostname"
var testAddress = testIP + ":" + testPort
var testAddress = "141.100.70.170:6030"
var testAPIEndpoint = "gosdn-latest.apps.ocp.fbi.h-da.de"
var testUsername = "admin"
var testPassword = "arista"
......@@ -29,16 +29,16 @@ func TestMain(m *testing.M) {
}
func testSetupIntegration() {
viper.SetConfigFile(".k8s.toml")
if err := viper.ReadInConfig(); err != nil {
log.Error(err)
}
if os.Getenv("GOSDN_LOG") == "nolog" {
log.SetLevel(log.PanicLevel)
}
api := viper.GetString("GOSDN_TEST_API_ENDPOINT")
addr := os.Getenv("GOSDN_TEST_ENDPOINT")
if addr != "" {
testAddress = addr
log.Infof("GOSDN_TEST_ENDPOINT set to %v", testAddress)
}
api := os.Getenv("GOSDN_TEST_API_ENDPOINT")
if api != "" {
testAPIEndpoint = api
log.Infof("GOSDN_TEST_API_ENDPOINT set to %v", testAPIEndpoint)
......
services:
- name: docker:19.03.12-dind
command: ["--registry-mirror", "http://141.100.70.170:6000"]
variables:
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_IMAGE_SHA: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
......@@ -11,6 +7,10 @@ variables:
before_script:
- echo "override global before script"
image: docker:19.03.12
services:
- name: docker:19.03.12-dind
command: ["--registry-mirror", "http://141.100.70.170:6000", "--dns", "1.1.1.1"]
stage: build
tags:
- dind
......
variables:
TF_ROOT: ${CI_PROJECT_DIR}/test/terraform
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/integration
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${CI_PIPELINE_ID}
cache:
key: ${CI_PIPELINE_ID}
......@@ -13,7 +13,8 @@ cache:
variables:
CI_DEBUG_TRACE: "false"
before_script:
- ./build/ci/generate_port2.sh $CI_PIPELINE_ID >> ${TF_ROOT}/port
- ./build/ci/generate_octet.sh $CI_COMMIT_SHA >> ${TF_ROOT}/firstOctet
- ./build/ci/generate_octet.sh $CI_PIPELINE_ID >> ${TF_ROOT}/secondOctet
- cd ${TF_ROOT}
- export TF_VAR_integration_username=terraform
- export TF_VAR_integration_access_token=${TERRAFORM_API_TOKEN}
......@@ -21,7 +22,8 @@ cache:
- export TF_VAR_tls_key=${DOCKER_TLS_KEY}
- export TF_VAR_tls_cert=${DOCKER_TLS_CERT}
- export TF_VAR_tls_ca_cert=${DOCKER_TLS_CA}
- export TF_VAR_ceos_address=172.24.$(cat firstOctet).$(cat secondOctet)
- export TF_VAR_gosdn_address=172.24.$(cat secondOctet).$(cat firstOctet)
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'develop')
variables:
......
......@@ -7,8 +7,6 @@
variables:
GOSDN_LOG: "nolog"
GOSDN_TEST_API_ENDPOINT: gosdn-$CI_COMMIT_SHA.apps.ocp.fbi.h-da.de
GOSDN_TEST_ENDPOINT_IP: 141.100.70.171
GOSDN_CHANGE_TIMEOUT: "100ms"
rules:
- if: $CI_NIGHTLY
......@@ -25,8 +23,9 @@
integration-test:nucleus:
<<: *integration-test
script:
- ./build/ci/generate_port.sh $CI_PIPELINE_ID >> port
- export GOSDN_TEST_ENDPOINT_PORT=$(cat port)
- ./build/ci/generate_octet.bash $CI_COMMIT_SHA >> firstOctet
- ./build/ci/generate_octet.bash $CI_PIPELINE_ID >> secondOctet
- export GOSDN_TEST_ENDPOINT=172.24.$(cat firstOctet).$(cat secondOctet):6030
- cd ./test/integration
- go test -race -v -run TestGnmi_SetIntegration
- go test -race -v -run TestGnmi_GetIntegration
......@@ -44,6 +43,9 @@ integration-test:api:
- job: "build:k8s-bot"
artifacts: true
script:
- ./build/ci/generate_octet.bash $CI_COMMIT_SHA >> firstOctet
- ./build/ci/generate_octet.bash $CI_PIPELINE_ID >> secondOctet
- export GOSDN_TEST_API_ENDPOINT=172.24.$(cat secondOctet).$(cat firstOctet):55055
- cd ./api
- go test -race -v -run TestApiIntegration
......
......@@ -8,7 +8,6 @@ hashed_value=$(echo $input | sha256sum | awk '{print $1}' )
decimal_value=$((16#$hashed_value))
decimal_value=${decimal_value/-/}
port=$(((decimal_value % 10000)+50000))
octet=$(((decimal_value % 255)))
#echo -n $(($port*1))
echo -n $port
\ No newline at end of file
echo -n $octet
\ No newline at end of file
......@@ -8,7 +8,6 @@ hashed_value=$(echo $input | sha256sum | awk '{print $1}' )
decimal_value=$((16#$hashed_value))
decimal_value=${decimal_value/-/}
port=$(((decimal_value % 10000)+50000))
octet=$(((decimal_value % 255)))
#echo -n $(($port*1))
echo -n $port
\ No newline at end of file
echo -n $octet
\ No newline at end of file
......@@ -2,7 +2,6 @@ package integration
import (
"context"
"fmt"
"os"
"reflect"
"sort"
......@@ -25,10 +24,7 @@ import (
const unreachable = "203.0.113.10:6030"
const testPath = "/system/config/hostname"
var testIP = "141.100.70.171"
var testPort = "6030"
var testAddress = testIP + ":" + testPort
var testAPIEndpoint = "gosdn-latest.apps.ocp.fbi.h-da.de"
var testAddress = "141.100.70.170:6030"
var testUsername = "admin"
var testPassword = "arista"
var opt *tpb.TransportOption
......@@ -44,23 +40,10 @@ func testSetupIntegration() {
log.SetLevel(log.PanicLevel)
}
a := os.Getenv("GOSDN_TEST_ENDPOINT_IP")
if a != "" {
testIP = a
log.Infof("GOSDN_TEST_ENDPOINT_IP set to %v", testIP)
}
port := os.Getenv("GOSDN_TEST_ENDPOINT_PORT")
if port != "" {
testPort = port
log.Infof("GOSDN_TEST_ENDPOINT_PORT set to %v", testPort)
}
testAddress = testIP + ":" + testPort
fmt.Printf("Testadress: %s, Testport: %s, Port: %s", testAddress, testPort, port)
api := os.Getenv("GOSDN_TEST_API_ENDPOINT")
if api != "" {
testAPIEndpoint = api
log.Infof("GOSDN_TEST_API_ENDPOINT set to %v", testAPIEndpoint)
addr := os.Getenv("GOSDN_TEST_ENDPOINT")
if addr != "" {
testAddress = addr
log.Infof("GOSDN_TEST_ENDPOINT set to %v", testAddress)
}
u := os.Getenv("GOSDN_TEST_USER")
if u != "" {
......
......@@ -6,17 +6,9 @@ resource "docker_container" "gosdn" {
restart = "always"
networks_advanced {
name = "bridge"
name = "ci"
ipv4_address = var.gosdn_address
}
ports {
internal = 8080
external = 8080
}
}
data "local_file" "port" {
filename = "port"
}
# create arista container
......@@ -26,13 +18,9 @@ resource "docker_container" "ceos" {
image = docker_image.ceos.name
restart = "always"
ports {
internal = 6030
external = data.local_file.port.content
}
networks_advanced {
name = "bridge"
name = "ci"
ipv4_address = var.ceos_address
}
command = ["/sbin/init",
......
......@@ -29,4 +29,12 @@ variable "container_tag" {
variable "network_name" {
type = string
default = ""
}
variable "ceos_address" {
type = string
}
variable "gosdn_address" {
type = string
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment