Adapter to map the inputs and outputs of the B-JointSP to the simulator interface
B-JointSP should work with the flow-level simulator, ie, be aligned to the interface. This requires mapping the simulator state into something B-JointSP understands and mapping B-JointSP's outputs/placement into something the simulator understands.
BjoinSP-adapter does the conversion in the following order:
-
Calls BjoinSP's
placefunction with the following parameters:network file: path to the filetemplate:path to the file created (just created once and used for every subsequent call toplace) with the following assumptions/adjustments:- Each VNF has no memory (for simplicity)
- An artificial VNF
vnf_sourcehaving novnf_delayis added and connected to the first VNF of the SFC - For each VNF,
vnf_delay=processing_delay_meanfrom theconfigfile - VNFs only have a forward link
- The vnf_links has a very high
max_delay= 1000 source: path to a first source file. Since we at the beginning don't have any traffic information from the simulator we have to create this file statically. Each ingress node in the network is assumed to be a source having a single VNFvnf_sourceand the number of flows is calculated by calculating the number ofoverlappingflows as follows: overlapping_flows = math.ceil((num_flows * (processing_delay + flow_duration))/run_duration)- number of flows: is given by the simulator in the
traffic_info - processing_delay: taken from the service_function file
- flow_duration: (flow_size / flow_dr_mean) * 1000
- run_duration: taken from the config file
- number of flows: is given by the simulator in the
cpu=mem=node_capacityfrom the network file- It gets the NetworkX object from the simulator, including the node and link capacities.
-
The results of the
placecall from step1.above are used to create the placement and schedule for the simulator as follows:placement: The placements are simply obtained from the result ofplacecall.schedule: Since BJointSP does not return any schedule we have create it from the flows information returned byplace. We assume that there is only a single SFC for simplicity.flowskeeps track of the number of flows forwarded by BJointSP from a source_node to a dest_node. The schedule is created for eachsource node, for eachVNFin the SFC, for eachdestination node. If a flow exits inflowsfrom source node to destination node for a requested VNF we add it to the schedule. We use the probabilities normalization functionnormalize_scheduling_probabilitiessuch that for each SF the sum of Probabilities is 1
-
The
scheduleandplacementfrom step2.are used to call theapplyfunction of the simulator. -
The result (traffic info.) of the
applycall from step3.are used to create thesourcesfor the next call to BjoinSP'splacefunction. The sources are created as follows:-
For each ingress node, if the first SF (in our cases
a) has some aggregate dr , we calculate the number of overlapping flows as follows:overlapping_flows = math.ceil((num_flows * (processing_delay + flow_duration))/run_duration)
We then place
overlapping_flowsnumber of flows, each ofdr=flow_dr_meanon that ingress node with a single VNFvnf_source- If traffic_info has no
drforaon any ingress node, then the source file would be empty
-
-
If the
sourceis created in step4.we use it to call BJointSP'splaceand repeat step 2, 3, & 4. -
If the
sourceis not created in step4., the previously calculatedscheduleandplacementis used to make the next call to the simulator'sapply.
Note: By calculating the overlapping_flows we can run the adapter with any run_duration. B-JointSP expects flows that are specified as sources to run in parallel and be competing for resources. A flow is competing for resources while it's being processed by a VNF. So by calculating the number of overlapping_flows we know how many parallel flows that BJointSP needs to cater to.
Install Python 3.6 and venv modules.
Recommended for development: Clone and install coord-sim, common-utils, and BJointSP locally first in the same venv before running the installation of the adapter in the editable mode: pip install -e bjointsp-adapter
# clone this repo and enter dir
git clone [email protected]:RealVNF/bjointsp-adapter.git
cd bjointsp-adapter
# create and activate virtual environment
## On Windows
python -m venv venv
.\venv\Scripts\activate
## On Linux and macOS
python3 -m venv venv
source venv/bin/activate
# install package
pip install -r requirements.txtThis also installs the required coord-sim simulator, common-utils, and BJointSP package.
usage: bjointsp-adapter [-h] [-i ITERATIONS] [-s SEED] -n NETWORK -sf
SERVICE_FUNCTIONS -c CONFIG
BJointSP Adapter
optional arguments:
-h, --help show this help message and exit
-i ITERATIONS, --iterations ITERATIONS
-s SEED, --seed SEED
-n NETWORK, --network NETWORK
-sf SERVICE_FUNCTIONS, --service_functions SERVICE_FUNCTIONS
-c CONFIG, --config CONFIG
Use the following command as an example (from within bjointsp-adapter project folder):
bjointsp-adapter -n "res/networks/triangle.graphml" \
-sf "res/service_functions/abc.yaml" \
-c "res/config/sim_config.yaml" \
-i 50This will run the bjointsp-adapter and call the apply() of the sim-interface and the place() of BJointSP 50 times.
There is script provided in the scripts folder that utilizes the GNU Parallel utility to run multiple experiments at the same time to speed up the process. It can run one algorithm at a time, so you need to choose the algo you wanna run at the beginning of the file.
From scripts directory configure the following files:
- network_files: 1 network file location per line
- config_files: 1 simulator config. file location per line
- service_files: 1 SFC file location per line
- 30seeds: 1 seed per run of the simulator. By default using 30 seeds. Add/Remove as per requirement
From the main directory (where the README.md file is) using a Terminal run:
bash scripts/run_parallelThis project has received funding from German Federal Ministry of Education and Research (BMBF) through Software Campus grant 01IS17046 (RealVNF).




