Skip to content

Commit

Permalink
test fabric modify add + delete nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
abessiari committed Mar 16, 2024
1 parent 84a2dcd commit 01de7b6
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 4 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/ubuntu_22_and_test_modify_fabric_l2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Ubuntu22.04 Test

on:
push:
branches:
- knit8
workflow_dispatch:

env:
FABRIC_TOKEN: ${{ secrets.FABRIC_TOKEN }}
FABRIC_BASTION_KEY: ${{ secrets.FABRIC_BASTION_KEY }}
FABRIC_SLIVER_KEY: ${{ secrets.FABRIC_SLIVER_KEY }}
FABRIC_SLIVER_PUBKEY: ${{ secrets.FABRIC_SLIVER_PUBKEY }}
FABRIC_PROJECT: ${{ secrets.FABRIC_PROJECT }}
FABRIC_USER: ${{ secrets.FABRIC_USER }}

jobs:
UbuntuTest:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Install Fabfed And Requirements
run: |
pip install --upgrade pip
pip install setuptools --upgrade
pip install --no-cache-dir --ignore-requires-python neo4j==5.18.0
pip list -v | grep neo4j
pip install --no-cache-dir --ignore-requires-python -r requirements.txt
python3 -m pip install --no-cache-dir .
pip install --no-cache-dir git+https://gitlab.flux.utah.edu/stoller/portal-tools.git
- name: Save Credentials
run: |
mkdir -p ${{ github.workspace }}/creds
echo ${{ env.FABRIC_TOKEN }} | base64 --decode > ${{ github.workspace }}/creds/token.json
echo ${{ env.FABRIC_BASTION_KEY }} | base64 --decode > ${{ github.workspace }}/creds/bastion
echo ${{ env.FABRIC_SLIVER_KEY }} | base64 --decode > ${{ github.workspace }}/creds/sliver
echo ${{ env.FABRIC_SLIVER_PUBKEY }} | base64 --decode > ${{ github.workspace }}/creds/sliver.pub
- name: Test Fabric Modify with FacilityPort 0 nodes
run: |
export DO_NOT_DESTROY=1
session=cicd-fabric-facility-port
echo "vlan: 3103" > $session-varfile.yml
echo "node_count: 0" >> $session-varfile.yml
${{ github.workspace }}/cicd/run-fabfed.sh cicd/test_configs/fabric_facility_port $session $session-varfile.yml
- name: Test Fabric Modify with FacilityPort Add One Node
run: |
export DO_NOT_DESTROY=1
session=cicd-fabric-facility-port
echo "vlan: 3103" > $session-varfile.yml
echo "node_count: 1" >> $session-varfile.yml
${{ github.workspace }}/cicd/run-fabfed.sh cicd/test_configs/fabric_facility_port $session $session-varfile.yml
- name: Test Fabric Modify with FacilityPort Add Another Node
run: |
export DO_NOT_DESTROY=1
session=cicd-fabric-facility-port
echo "vlan: 3103" > $session-varfile.yml
echo "node_count: 2" >> $session-varfile.yml
${{ github.workspace }}/cicd/run-fabfed.sh cicd/test_configs/fabric_facility_port $session $session-varfile.yml
- name: Test Fabric Modify with FacilityPort Remove One Node
run: |
export DO_NOT_DESTROY=1
session=cicd-fabric-facility-port
echo "vlan: 3103" > $session-varfile.yml
echo "node_count: 1" >> $session-varfile.yml
${{ github.workspace }}/cicd/run-fabfed.sh cicd/test_configs/fabric_facility_port $session $session-varfile.yml
- name: Test Fabric Modify with FacilityPort Remove One Node
run: |
export DO_NOT_DESTROY=1
session=cicd-fabric-facility-port
echo "vlan: 3103" > $session-varfile.yml
echo "node_count: 0" >> $session-varfile.yml
${{ github.workspace }}/cicd/run-fabfed.sh cicd/test_configs/fabric_facility_port $session $session-varfile.yml
- name: Test Fabric Modify with FacilityPort Destroy
run: |
export DO_NOT_DESTROY=0
session=cicd-fabric-facility-port
echo "vlan: 3103" > $session-varfile.yml
echo "node_count: 0" >> $session-varfile.yml
${{ github.workspace }}/cicd/run-fabfed.sh cicd/test_configs/fabric_facility_port $session $session-varfile.yml
8 changes: 8 additions & 0 deletions cicd/run-fabfed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ fabfed workflow -c $conf_dir $options -s $session -show -summary > $session-appl
fabfed workflow -c $conf_dir $options -s $session -show -summary
fabfed sessions -show

DO_NOT_DESTROY="${DO_NOT_DESTROY:=0}"

if [ $DO_NOT_DESTROY -ne 0 ]; then
echo "NOT_DESTROYING:APPLY RESULTS:"
cat $session-apply-state.yaml
exit $ret1
fi

echo "***************** DESTOYING ****************"
echo fabfed workflow -c $conf_dir $options -s $session -destroy
fabfed workflow -c $conf_dir $options -s $session -destroy
Expand Down
7 changes: 5 additions & 2 deletions cicd/test_configs/fabric_facility_port/config.fab
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
variable:
- vlan:
default: 3101
- node_count:
default: 0

provider:
- fabric:
- fabric_provider:
Expand All @@ -20,12 +23,12 @@ resource:
site: UTAH # CLEM # UTAH
image: default_rocky_8
nic_model: NIC_Basic
count: 0
network: '{{ network.fabric_network }}'
count: '{{ var.node_count }}'
- network:
- fabric_network:
provider: '{{ fabric.fabric_provider }}'
layer3: "{{ layer3.my_layer }}"
# interface: '{{ node.fabric_node }}'
device_name: Utah-Cloudlab-Powder
site: UTAH
interface:
Expand Down
1 change: 0 additions & 1 deletion fabfed/provider/fabric/fabric_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def __init__(self, label, provider: FabricProvider, slice_object: Slice, name, r
self.layer3 = resource.get(Constants.RES_LAYER3)
self.peering = resource.get(Constants.RES_PEERING)
self.peer_layer3 = resource.get(Constants.RES_PEER_LAYER3)
self.device = None
self.stitching_net = None
self.label = label
self.net = None
Expand Down
2 changes: 1 addition & 1 deletion fabfed/util/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _validate_variables(variables: List[Variable]):
raise ParseConfigException(f'detected duplicate variables')

for variable in variables:
if not variable.value:
if variable.value is None:
raise ParseConfigException(f'variable {variable .name} is not bound')

@staticmethod
Expand Down

0 comments on commit 01de7b6

Please sign in to comment.