Skip to content
Snippets Groups Projects
Commit 2fc1ef87 authored by Alex de Cock Buning's avatar Alex de Cock Buning
Browse files

bug fix: switch config file wasnt creating links properly

as some variables were incorrectly unset, it could lead to script issues when the script was used more than one time
parent 19b11c19
No related branches found
No related tags found
1 merge request!15bug fix: switch config file wasnt creating links properly
Pipeline #56451 failed
#!/bin/bash #!/bin/bash
# Unset variables to prevent overlapping issues
unset jsonConfigPath
unset podInfo
unset nodeIPs
unset entry
unset nodeName
unset nodeIP
unset nodesArray
unset linksArray
unset linkPairs
unset srcNode
unset dstNode
unset key1
unset key2
unset configFilePath
unset pods
unset podName
unset pod
unset output_file
unset nodes
unset ip_counter
unset helm_chart_path
unset non_deployments_file
unset deployment_file
unset deployment_count
unset doc
unset in_deployment
unset file_name
cd ../secure-connectivity
# Filename for the JSON config # Filename for the JSON config
jsonConfigPath="./configs/switchConfig.json" jsonConfigPath="./configs/switchConfig.json"
...@@ -40,10 +68,14 @@ for srcNode in "${!nodeIPs[@]}" ...@@ -40,10 +68,14 @@ for srcNode in "${!nodeIPs[@]}"
do do
for dstNode in "${!nodeIPs[@]}" for dstNode in "${!nodeIPs[@]}"
do do
if [[ "$srcNode" != "$dstNode" && -z "${linkPairs["$srcNode|$dstNode"]}" && -z "${linkPairs["$dstNode|$srcNode"]}" ]]; then key1="$srcNode|$dstNode"
key2="$dstNode|$srcNode"
if [[ "$srcNode" != "$dstNode" && -z "${linkPairs[$key1]}" && -z "${linkPairs[$key2]}" ]]; then
linksArray+=("{\"endpointA\": \"$srcNode\", \"endpointB\": \"$dstNode\"}") linksArray+=("{\"endpointA\": \"$srcNode\", \"endpointB\": \"$dstNode\"}")
linkPairs["$srcNode|$dstNode"]=1 linkPairs["$key1"]=1
fi fi
done done
done done
...@@ -59,7 +91,6 @@ echo "{ ...@@ -59,7 +91,6 @@ echo "{
echo "Network topology configuration has been generated at $jsonConfigPath." echo "Network topology configuration has been generated at $jsonConfigPath."
#!/bin/bash
# Unset variables to prevent overlapping issues # Unset variables to prevent overlapping issues
unset configFilePath unset configFilePath
...@@ -105,7 +136,6 @@ done ...@@ -105,7 +136,6 @@ done
echo "Configuration deployment completed." echo "Configuration deployment completed."
#!/bin/bash
# Define the output file path # Define the output file path
output_file="./LPM/chart/values.yaml" output_file="./LPM/chart/values.yaml"
...@@ -142,7 +172,6 @@ cat >> "$output_file" << EOF ...@@ -142,7 +172,6 @@ cat >> "$output_file" << EOF
namespace: he-codeco-netma namespace: he-codeco-netma
EOF EOF
#!/bin/bash
# Define file paths # Define file paths
helm_chart_path="./LPM/chart/" helm_chart_path="./LPM/chart/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment