Update platform parser

This commit is contained in:
Loic Guegan 2022-09-10 14:12:25 +02:00
parent 42a4975665
commit 6a2319e07c

View file

@ -1,5 +1,6 @@
import yaml, os
import numpy as np
class YAMLPlatformFile:
@ -84,6 +85,7 @@ class YAMLPlatformFile:
def parse_interfaces(self):
interfaces=self.platform["interfaces"]
node_count=self.default["node_count"]
for i in interfaces:
is_wired=interfaces[i]["wireless"]
links=list()
@ -94,7 +96,17 @@ class YAMLPlatformFile:
links.append(self.parse_link(interfaces[i]["links"]))
##### Create network matrix
for link in links:
print(link)
BW=np.full((node_count,node_count),0)
LAT=np.full((node_count,node_count),0)
for n1 in link[0]:
for n2 in link[3]:
BW[n1][n2]=link[1]
LAT[n1][n2]=link[2]
self.default["interfaces"][i]={
"is_wired": is_wired,
"bandwidth": BW,
"latency": LAT
}
def parse_nodes(self):
nodes=self.platform["nodes"]