Skip to content

Commit ce89f93

Browse files
authored
Merge pull request #5 from adnan904/master
Minor refactoring/updates
2 parents 93b26c1 + 553dd6a commit ce89f93

File tree

5 files changed

+74
-13
lines changed

5 files changed

+74
-13
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# baseline-algorithms
2-
Baseline algorithms for coordination of chained VNFs. Includes Non-RL algorithms (Random Schedule, Shortest Path, & Load Balance).
2+
Baseline algorithms for coordination of service mesh consisting of multiple microservices. Includes Non-RL algorithms (Random Schedule, Shortest Path, & Load Balance).
3+
4+
<p align="center">
5+
<img src="https://raw.githubusercontent.com/RealVNF/deep-rl-service-coordination/master/docs/realvnf_logo.png?token=AIDTJSQ4PTVX6A4D6HSPDDC6RNE54" height="150" hspace="30"/>
6+
<img src="https://raw.githubusercontent.com/RealVNF/deep-rl-service-coordination/master/docs/upb.png?token=AIDTJSXSEB2M2BEFGFU4N3S6RNFGA" width="200" hspace="30"/>
7+
<img src="https://raw.githubusercontent.com/RealVNF/deep-rl-service-coordination/master/docs/huawei_horizontal.png?token=AIDTJSSKOEGP7GI6K5YIWUC6RNFH2" width="250" hspace="30"/>
8+
</p>
9+
10+
11+
## Citing this work
12+
13+
If you are using this work in whole or in part in your project, please cite it as follows:
14+
15+
```
16+
@inproceedings{schneider2020coordination,
17+
author = {Schneider, Stefan and Khalili, Ramin and Manzoor, Adnan and Qarawlus, Haydar and Uthe, Sven and Karl, Holger and Hecker, Artur},
18+
booktitle = {ACM SIGCOMM NetAI Workshop 2020 (SIGCOMM NetAI ’20)},
19+
pages = {1--8},
20+
title = {Self-Driving Coordination of Massively Scaled Services Using Deep Reinforcement Learning},
21+
year = {2020},
22+
note = {under review}
23+
}
24+
```
325

426
## Project structure
527

@@ -16,7 +38,7 @@ Baseline algorithms for coordination of chained VNFs. Includes Non-RL algorithms
1638

1739
### Load Balance algorithm
1840

19-
Always returns equal distribution for all nodes and SFs. Places all SFs everywhere.
41+
Always returns equal distribution for all nodes having capacities and SFs. Places all SFs on all nodes having some capacity.
2042

2143
### Shortest Path algorithm
2244

@@ -70,3 +92,12 @@ bash scripts/run_simultaneous
7092
```
7193

7294
This would link the paths in the `network_files`, `config_files`, and `service_files`, as per line number and then run them for all the seeds within the `30seeds` file. E.g: Network file location at line no. 1 of `network_files` + Simulator Config file location at line no. 1 of `config_files` + SFC file location at line no. 1, would be run for all the seeds within the `30seeds` file. Similary for line numbers 2,3, and so on.
95+
96+
## Acknowledgement
97+
98+
This project has received funding from German Federal Ministry of Education and Research ([BMBF](https://www.bmbf.de/)) through Software Campus grant 01IS17046 ([RealVNF](https://realvnf.github.io/)).
99+
100+
<p align="center">
101+
<img src="https://raw.githubusercontent.com/RealVNF/deep-rl-service-coordination/master/docs/software_campus.png?token=AIDTJSQS7WZNSZHFL23FNYS6RNFJK" width="200"/>
102+
<img src="https://raw.githubusercontent.com/RealVNF/deep-rl-service-coordination/master/docs/BMBF_sponsored_by.jpg?token=AIDTJSRMQYSKOC7K3EWIQ5S6RNFKW" width="250"/>
103+
</p>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# module for configuring the simulator
2+
# configuration parameters are loaded and used both when using the simulator via the CLI and via the interface
3+
# all parameters are required, defaults are in comments
4+
5+
inter_arrival_mean: 12.0 # default: 10.0
6+
deterministic_arrival: False
7+
flow_dr_mean: 1.0 # default: 1.0
8+
flow_dr_stdev: 0.0 # default: 0.0
9+
flow_size_shape: 0.001 # default: 0.001
10+
deterministic_size: True
11+
run_duration: 100 # default: 100
12+
13+
# Optional: Trace file trace relative to the CWD.
14+
# Until values start in the trace file, the defaults from this file are used
15+
# trace_path: res/traces/scenario09.csv
16+
17+
# States (two state markov arrival)
18+
# Optional param: states: True | False
19+
use_states: True
20+
init_state: state_1
21+
22+
states:
23+
state_1:
24+
inter_arr_mean: 12.0
25+
switch_p: 0.05
26+
state_2:
27+
inter_arr_mean: 8.0
28+
switch_p: 0.05

src/algorithms/loadBalance.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ def main():
9292
args = parse_args()
9393
if not args.seed:
9494
args.seed = random.randint(1, 9999)
95-
# os.makedirs("logs", exist_ok=True)
9695
logging.basicConfig(level=logging.INFO)
9796
logging.getLogger("coordsim").setLevel(logging.WARNING)
9897

@@ -128,7 +127,6 @@ def main():
128127
log.info(f"Running for {args.iterations} iterations...")
129128
for i in tqdm(range(args.iterations)):
130129
_ = simulator.apply(action)
131-
# log.info("Network Stats after apply() # %s: %s", i + 1, apply_state.network_stats)
132130
# We copy the input files(network, simulator config....) to the results directory
133131
copy_input_files(results_dir, os.path.abspath(args.network), os.path.abspath(args.service_functions),
134132
os.path.abspath(args.config))

src/algorithms/randomSchedule.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
from spinterface import SimulatorAction
1515
from tqdm import tqdm
1616

17-
# select which simulator to use by (un-)commenting the corresponding imports
18-
# from dummy_env import DummySimulator as Simulator
19-
2017
log = logging.getLogger(__name__)
2118
DATETIME = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
2219
PROJECT_ROOT = str(Path(__file__).parent.parent.parent)
@@ -99,7 +96,6 @@ def main():
9996
args = parse_args()
10097
if not args.seed:
10198
args.seed = random.randint(1, 9999)
102-
# os.makedirs("logs", exist_ok=True)
10399
logging.basicConfig(level=logging.INFO)
104100
logging.getLogger("coordsim").setLevel(logging.WARNING)
105101

src/algorithms/shortestPath.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@
1818

1919

2020
def get_closest_neighbours(network, nodes_list):
21-
# Finding the closest neighbours to each node in the network. For each node of the network we maintain a list of
22-
# neighbours sorted in increasing order of distance to it.
21+
"""
22+
Finding the closest neighbours to each node in the network. For each node of the network we maintain a list of
23+
neighbours sorted in increasing order of distance to it.
24+
params:
25+
network: A networkX graph
26+
nodes_list: a list of nodes in the Network
27+
Returns:
28+
closest_neighbour: A dict containing lists of closest neighbour to each node in the network sorted in
29+
increasing order to distance.
30+
"""
31+
2332
all_pair_shortest_paths = network.graph['shortest_paths']
2433
closest_neighbours = defaultdict(list)
2534
for source in nodes_list:
@@ -35,12 +44,13 @@ def get_closest_neighbours(network, nodes_list):
3544

3645
def next_neighbour(index, num_vnfs_filled, node, placement, closest_neighbours, sf_list, nodes_cap):
3746
"""
47+
Finds the next available neighbour to the index node
3848
Args:
3949
index: closest neighbours of 'node' is a list, index tells which closest neighbour to start looking from
4050
num_vnfs_filled: Tells the number of VNFs present on all nodes e.g: every node in the network has atleast 1 VNF,
4151
some might have more than that. This tells us the minimum every node has
4252
node: The node whose closest neighbour is to be found
43-
placement: plaecement of VNFs in the entire network
53+
placement: placeement of VNFs in the entire network
4454
closest_neighbours: neighbours of each node in the network in the increasing order of distance
4555
sf_list: The VNFs in the network
4656
nodes_cap: Capacity of each node in the network
@@ -180,7 +190,6 @@ def main():
180190
args = parse_args()
181191
if not args.seed:
182192
args.seed = random.randint(1, 9999)
183-
# os.makedirs("logs", exist_ok=True)
184193
logging.basicConfig(level=logging.INFO)
185194
logging.getLogger("coordsim").setLevel(logging.WARNING)
186195

@@ -211,7 +220,6 @@ def main():
211220
log.info(f"Running for {args.iterations} iterations...")
212221
for i in tqdm(range(args.iterations)):
213222
_ = simulator.apply(action)
214-
# log.info("Network Stats after apply() # %s: %s", i + 1, apply_state.network_stats)
215223
# We copy the input files(network, simulator config....) to the results directory
216224
copy_input_files(results_dir, os.path.abspath(args.network), os.path.abspath(args.service_functions),
217225
os.path.abspath(args.config))

0 commit comments

Comments
 (0)