Commit 7d364cb2 authored by Mark Beierl's avatar Mark Beierl
Browse files

Updating PNF Session



Removes the unnecessary src and build steps from
PNF package.

Adds some scripts for participants

Signed-off-by: default avatarMark Beierl <mark.beierl@canonical.com>
parent 7a0cde63
Loading
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
#!/bin/bash 

HFID=$(echo $HOSTNAME | cut -f2 -d-)
IP=$(expr 100 + $HFID)
cd ~/osm-packages
if [ ! -d hackfest_firewall_pnf ] ; then
    echo "It does not look like we are in the osm-packages directory, exiting"
    exit 1
fi

echo "========================================================================"
echo "Building operator charms"
echo "========================================================================"
cd hackfest_firewall_pnf/charms/vyos-config-src
#virtualenv -p python3 venv
#source venv/bin/activate
#pip install -r requirements-dev.txt
#pip install charmcraft
#./venv/bin/charmcraft build
rm -rf venv
charmcraft build
cd -
cd hackfest_firewall_pnf/charms
mkdir -p vyos-config/
rm -rf vyos-config/*
cp -r vyos-config-src/build/* vyos-config/
cd -

echo "========================================================================"
echo "Cleaning out any prior versions of the descriptors from OSM"
echo "========================================================================"
osm nsd-delete hackfest_firewall_pnf_ns
osm vnfd-delete hackfest_firewall_pnf
osm pdu-delete router01
rm -v hackfest_firewall_pnf*.tar.gz

echo "========================================================================"
echo "Building packages"
echo "========================================================================"
osm package-build hackfest_firewall_pnf
osm package-build hackfest_firewall_pnf_ns
osm nsd-delete hackfest_firewall_pnf_ns | grep -v "not found"
osm vnfd-delete hackfest_firewall_pnf | grep -v "not found"
osm pdu-delete router01 | grep -v "not found"

echo "========================================================================"
echo "Uploading packages"
echo "========================================================================"
osm upload-package hackfest_firewall_pnf.tar.gz
osm upload-package hackfest_firewall_pnf_ns.tar.gz
osm upload-package hackfest_firewall_pnf
osm upload-package hackfest_firewall_pnf_ns

VIMID=`osm vim-list | grep osm_ | awk '{ print $4 }'`
echo "========================================================================"
echo "Registering PDU 172.21.19.${HFID} with $VIMID"
echo "Registering PDU 172.21.19.${IP} with OSM"
echo "========================================================================"

cat << EOF > firewall-pdu.yaml
@@ -55,7 +32,7 @@ type: gateway
shared: false
interfaces:
 -  name: gateway_public
    ip-address: 172.21.19.${HFID}
    ip-address: 172.21.19.${IP}
    mgmt: true
    vim-network-name: osm-ext
 -  name: vnf_internal
@@ -64,9 +41,7 @@ interfaces:
    vim-network-name: private
EOF

osm pdu-create --descriptor_file firewall-pdu.yaml \
               --vim_account $VIMID
osm pdu-create --descriptor_file firewall-pdu.yaml --vim_account openstack
echo "========================================================================"
echo "Done"
echo "========================================================================"
+1 −1
Original line number Diff line number Diff line
#!/bin/bash

VIMID=`osm vim-list | grep osm_ | awk '{ print $4 }'`
VIMID=openstack
echo "========================================================================"
echo "Launching network service with VIMID ${VIMID}"
echo "========================================================================"
+8 −0
Original line number Diff line number Diff line
#!/bin/bash

echo "========================================================================"
echo "Launching a workload behind the firewall"
echo "========================================================================"

openstack server create --image=ubuntu20.04 --flavor=m1.medium \
          --network private --key-name hackfest workload
+1 −3
Original line number Diff line number Diff line
@@ -6,9 +6,7 @@ echo "========================================================================"

cat << 'EOF'

DESKTOP_IP=`osm ns-show virtual-desktop --literal | yq e '.vcaStatus.*.machines.0.network_interfaces.ens3.ip_addresses.0' -`

osm ns-action firewall --vnf_name VYOS-PNF --action_name add-port-forward --params "{ruleNumber: '10', sourcePort: '3389', destinationAddress: \"${DESKTOP_IP}\", destinationPort: '3389'}"
osm ns-action firewall --vnf_name VYOS-PNF --action_name add-port-forward --params "{ruleNumber: '10', sourcePort: '5022', destinationAddress: '192.168.239.NN', destinationPort: '22'}"
osm ns-action firewall --vnf_name VYOS-PNF --action_name remove-port-forward --params '{ruleNumber: "10"}'

EOF 
+14 −0
Original line number Diff line number Diff line
#!/bin/bash

echo "========================================================================"
echo "Enabling Debug Mode for LCM"
echo "========================================================================"

cat << 'EOF'

juju config lcm debug-mode=true
juju run-action lcm/0 get-debug-mode-information --wait

Once the debugger has started, go to n2vc/n2vc_juju_conn.py #L 1051

EOF 
Loading