Skip to content

Commit a71afd0

Browse files
PaulRalnikovAz3git
andauthored
DOCUMENTATION: configs readme (#444)
closes #443 --------- Co-authored-by: Alexey Zharkov <62723911+Az3git@users.noreply.github.com>
1 parent 3496719 commit a71afd0

6 files changed

Lines changed: 265 additions & 49 deletions

File tree

configuration_examples/README.md

Lines changed: 79 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,99 @@
1-
# Datacenter Topology File Format
1+
# General configs information
22

3-
This document describes the structure of the YAML file used to define datacenter network topologies, including hosts,
4-
switches, and links between them.
3+
## Units data format
54

6-
## Structure Overview
5+
In all configs you may see fields that contains time, size and speed. All of them have same format: `<value><unit>` where `value` is an integer and `unit` is small string suffix. For each unit where are fixed list of available units that you may see below.
76

8-
The topology file is divided into multiple sections, each representing a different network topology. Each topology
9-
consists of:
7+
### Available time units:
108

11-
- `devices`: Defines devices: senders, receivers and switches.
9+
- `ns`: Nanosecond
10+
- `us`: Microsecond
11+
- `ms`: Millisecond
12+
- `s`: Second
1213

13-
- `links`: Specifies connections between devices with network parameters.
14+
### Available size units:
1415

15-
## Sections
16+
- `b`: bit
17+
- `B`: Byte
18+
- `Mb`: Megabit
19+
- `MB`: Megabyte
20+
- `Gb`: Gigabit
21+
- `GB`: Gigabyte
1622

17-
### Devices
23+
### Available speed units:
1824

19-
Each host entry represents a device:
25+
- `Mbps`: Megabits per second
26+
- `Gbps`: Gigabits per second
2027

21-
```yaml
22-
devices:
23-
device_name:
24-
type: [ sender | receiver | switch ]
25-
```
28+
Examples:
29+
- Time: `1ns`, `2s`,
30+
- Size: `1Mb`, `5GB`
31+
- Speed: `2Gpbs`, `3Mbps`
2632

27-
- `device_name`: Unique identifier for the device.
33+
## Presets
2834

29-
- `type`: Defines device type.
30-
31-
### Links
35+
For some config parts you may create presets - common set of fields for the objects. For example, in topology configs it may looks like
36+
```yaml
37+
presets:
38+
links:
39+
best-link:
40+
latency: 1000ns
41+
throughput: 10Gbps
42+
ingress_buffer_size: 4096B
43+
egress_buffer_size: 4096B
44+
switches:
45+
really-best-switch:
46+
ecn:
47+
min: 0.2
48+
max: 0.4
49+
probability: 0.8
50+
bad-switch:
51+
ecn:
52+
min: 1.0
53+
max: 1.0
54+
probability: 0.0
55+
```
3256
33-
Each link defines a connection between two devices:
57+
To use your preset, fill in `preset-name` field in concrete object description:
3458

3559
```yaml
60+
switches:
61+
switch-1:
62+
preset-name: really-best-switch
63+
switch-2:
64+
preset-name: bad-switch
3665
links:
37-
link_id:
38-
from: <source_device>
39-
to: <destination_device>
40-
latency: <value><unit>
41-
throughput: <value><unit>
42-
ingress_buffer_size: <value>B
43-
egress_buffer_size: <value>B
66+
link1-2:
67+
preset-name: best-link
68+
from: switch-1
69+
to: switch-2
70+
link2-1:
71+
preset-name: best-link
72+
from: switch-2
73+
to: switch-1
74+
throughput: 10Gpps # overrides value from preset
4475
```
4576

46-
- `link_id`: Unique identifier for the link.
47-
48-
- `from`: Source device name.
49-
50-
- `to`: Destination device name.
77+
## Default preset
5178

52-
- `latency`: Transmission delay (e.g., 5ns).
79+
To shorten the configs length, you may fill default preset that used for all objects in description of which `preset-name` does not set (or set to `default`):
5380

54-
- `throughput`: Link bandwidth (e.g., 1Gbps).
55-
56-
- `ingress_buffer_size`: Link ingress buffer size in bytes (e.g., 1024B)
57-
58-
- `egress_buffer_size`: Link egress buffer size in bytes (e.g., 1024B)
59-
60-
### Examples images
81+
```yaml
82+
presets:
83+
links:
84+
default:
85+
latency: 1000ns
86+
throughput: 10Gbps
87+
ingress_buffer_size: 4096B
88+
egress_buffer_size: 4096B
89+
links:
90+
link-1:
91+
from: device-1
92+
to: device-2
93+
# other fields takes from default preset
94+
link-1:
95+
preset-name: default # works similarly with link-1
96+
from: device-2
97+
to: device-1
6198
62-
You may generate images of topologies using the [generator](../scripts/generate_image.py) script.
99+
```
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Datacenter Topology Simulation Config Format
2+
3+
This document describes the structure of the YAML file used to define datacenter simulation config format, including connections, flows other settings.
4+
5+
## Structure Overview
6+
7+
The topology file is divided into multiple sections:
8+
9+
- `topology_config_path`: path (absolute or relative) to the topology config.
10+
11+
- `simulation_time`: maximal time of simulation in [time format](../README.md); optional field
12+
13+
- `connections` : Defines connections
14+
15+
## Connections
16+
17+
`connections` sections looks like:
18+
19+
```yaml
20+
connections:
21+
sender_id: <source_device>
22+
receiver_id: <destination_device>
23+
packet_to_send: <count_of_packets>
24+
mpld: round_robin
25+
flows:
26+
# flows section; see it below
27+
```
28+
29+
- `sender_id` and receiver_id should be the names of hosts from topology config.
30+
- `packets_to_send` is an integer
31+
- `mplb` is multipath load ballansing type. The only availabe value is `round_robin`
32+
33+
# Flows section
34+
35+
Each flow describes flow from `source_id` to `receiver_id`:
36+
37+
```yaml
38+
flows:
39+
flow_id:
40+
type: tcp
41+
packet_size: <size>
42+
cc:
43+
# congestion control settings; see it below
44+
```
45+
46+
- `flow_id` is an unique name of flow (names of flows from different connections may be equal)
47+
- `type` is a type of flow. The only avaliable value is tcp
48+
- `packet_size` is an number in [size format](../README.md)
49+
- `cc` describes congestion control module of flow. See more details below
50+
51+
# `cc` section in tcp flow
52+
53+
`cc` module looks like:
54+
55+
```yaml
56+
cc:
57+
type: basic|tahoe|swift
58+
# rest values specific for given congestion control type
59+
```
60+
61+
`type` describes type of congestion control:
62+
63+
- `basic`: no congestion control; no specific values
64+
- `tahoe`: [tcp tahoe](https://www.geeksforgeeks.org/computer-networks/tcp-tahoe-and-tcp-reno/) congestion control; no specific values
65+
- `swift`: [swift](https://2022-cs244.github.io/papers/L5-swift.pdf) congestion control (especialle see pseudocode on page 516); one specific value:
66+
+ `target_delay`: value from paper above in [time format](../README.md)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Datacenter Topology Config Format
2+
3+
This document describes the structure of the YAML file used to define datacenter network topologies, including hosts,
4+
switches, and links between them.
5+
6+
## Structure Overview
7+
8+
The topology file is divided into multiple sections, each representing a different network topology. Each topology
9+
consists of:
10+
11+
- `packet-spraying`: defines packet spraying type and its settings if needed
12+
13+
- `hosts`: Defines hosts
14+
15+
- `switches` : Defines switches
16+
17+
- `links`: Specifies connections between devices (hosts and switches) with network parameters.
18+
19+
## Sections
20+
21+
### Packet spraying
22+
23+
Structure:
24+
```yaml
25+
packet-spraying:
26+
type: random|ecmp|salt|flowlet
27+
```
28+
29+
If type is flowlet, it needs to set field `threshold` in [time format](../README.md)
30+
31+
### Hosts
32+
33+
Each host entry represents a host:
34+
35+
```yaml
36+
hosts:
37+
host_name:
38+
```
39+
40+
`host_name` should be unique
41+
42+
### Switches
43+
44+
Each switches entry represents a switch:
45+
46+
```yaml
47+
switches:
48+
switch_name:
49+
ecn:
50+
min:
51+
max:
52+
probability:
53+
```
54+
- `switch_name` is unique name of switch
55+
- `ecn` is optional and describes settings Explicit Congestion Notification settings. You can see more about it [here](https://man7.org/linux/man-pages/man8/tc-red.8.html)
56+
57+
### Links
58+
59+
Each link defines a connection between two devices:
60+
61+
```yaml
62+
links:
63+
link_id:
64+
from: <source_device>
65+
to: <destination_device>
66+
latency: <value>
67+
throughput: <value>
68+
ingress_buffer_size: <value>
69+
egress_buffer_size: <value>
70+
```
71+
72+
- `link_id`: Unique identifier for the link.
73+
74+
- `from`: Source device name.
75+
76+
- `to`: Destination device name.
77+
78+
- `latency`: Transmission delay in [time format](../README.md)
79+
80+
- `throughput`: Link bandwidth in [speed format](../README.md)
81+
82+
- `ingress_buffer_size`: Link ingress buffer size in [size format](../README.md)
83+
84+
- `egress_buffer_size`: Link egress buffer size in [size format](../README.md)
85+
86+
### Examples images
87+
88+
You may generate images of topologies using the [generator](../../scripts/generate_image.py) script.

scripts/check-md-links.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,22 @@ def check_links_in_markdown(file_path : str):
3535
response = requests.head(link_url, allow_redirects=True)
3636
if response.status_code != 200:
3737
raise requests.exceptions.ConnectionError(f"Can not access to {link_url}")
38-
print(f"{link_url} is link to an avaliable site")
38+
print(f"{link_url} is link to an available site")
3939
except requests.exceptions.RequestException:
40+
print(f"{link_url} is not an available site; returned code {response.status_code}")
4041
incorrect_links.append(link_url)
4142
if len(incorrect_links) == 0:
4243
print()
4344
print("All links are correct!")
4445
return True
45-
print("Found incorrect links. Each of them is neither the correct path to a file nor a link to an avaliable site:", file=sys.stderr)
46+
print("Found incorrect links. Each of them is neither the correct path to a file nor a link to an available site:", file=sys.stderr)
4647
for link in incorrect_links:
4748
print(f"link: {link}", file=sys.stderr)
4849
print("====================", file=sys.stderr)
4950
return False
5051
def main():
5152
parser = argparse.ArgumentParser(
52-
description="Check that all the links in given markdown file are correct pathes to some files or the links to the avaliable sites"
53+
description="Check that all the links in given markdown file are correct pathes to some files or the links to the available sites"
5354
)
5455
parser.add_argument("-f", "--file", help="Path to the file to be checked", required=True)
5556
args = parser.parse_args()

source/parser/parse_utils.cpp

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ static std::pair<uint32_t, std::string> parse_value_unit(
2424

2525
SpeedGbps parse_speed(const std::string &throughput) {
2626
auto [value, unit] = parse_value_unit(throughput);
27-
if (unit == "Gbps") {
28-
return SpeedGbps(value);
29-
}
3027
if (unit == "Mbps") {
3128
return Speed<MBit, Second>(value);
3229
}
30+
if (unit == "Gbps") {
31+
return SpeedGbps(value);
32+
}
3333
throw std::runtime_error("Unsupported throughput unit: " + unit);
3434
}
3535

@@ -38,19 +38,43 @@ TimeNs parse_time(const std::string &time) {
3838
if (unit == "ns") {
3939
return TimeNs(value);
4040
}
41+
if (unit == "us") {
42+
return Time<Microsecond>(value);
43+
}
44+
if (unit == "ms") {
45+
return Time<Millisecond>(value);
46+
}
47+
if (unit == "s") {
48+
return Time<Second>(value);
49+
}
4150
throw std::runtime_error("Unsupported time unit: " + unit);
4251
}
4352

4453
SizeByte parse_size(const std::string &size) {
4554
auto [value, unit] = parse_value_unit(size);
55+
if (unit == "b") {
56+
return Size<Bit>(value);
57+
}
4658
if (unit == "B") {
4759
return SizeByte(value);
4860
}
61+
if (unit == "Kb") {
62+
return Size<KBit>(value);
63+
}
4964
if (unit == "KB") {
5065
return Size<KByte>(value);
5166
}
67+
if (unit == "Mb") {
68+
return Size<MBit>(value);
69+
}
5270
if (unit == "MB") {
5371
return Size<MByte>(value);
5472
}
73+
if (unit == "Gb") {
74+
return Size<GBit>(value);
75+
}
76+
if (unit == "GB") {
77+
return Size<GByte>(value);
78+
}
5579
throw std::runtime_error("Unsupported buffer size unit: " + unit);
5680
}

source/units/time.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Microsecond {
1515
static constexpr uint64_t to_nanoseconds_multiplier = 1'000;
1616
};
1717

18-
struct Milisecond {
18+
struct Millisecond {
1919
static constexpr uint64_t to_nanoseconds_multiplier = 1'000'000;
2020
};
2121

0 commit comments

Comments
 (0)