Skip to content

Commit f5dddfe

Browse files
committed
Fix on the yamlinclude library error
1 parent eca3500 commit f5dddfe

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

dhalsim/parser/config_parser.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77

88
import yaml
9-
from yamlinclude import YamlIncludeConstructor
9+
import yaml_include
1010
from schema import Schema, Or, And, Use, Optional, SchemaError, Regex
1111

1212
from dhalsim.parser.input_parser import InputParser
@@ -626,8 +626,12 @@ def __init__(self, config_path: Path):
626626

627627
self.config_path = config_path.absolute()
628628

629-
YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader,
630-
base_dir=config_path.absolute().parent)
629+
#YamlIncludeConstructor.add_to_loader_class(loader_class=yaml.FullLoader,
630+
# base_dir=config_path.absolute().parent)
631+
632+
yaml.add_constructor("!include",
633+
yaml_include.Constructor(base_dir=config_path.absolute().parent),
634+
yaml.FullLoader)
631635

632636
try:
633637
self.data = self.apply_schema(self.config_path)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
inp_file: ctown_map.inp
22
iterations: 2880
3-
#iterations: 70
43
network_topology_type: complex
54
plcs: !include ctown_plcs.yaml
65

76
log_level: debug
87
simulator: epynet
98
demand: pdd
10-
attacks: !include ctown_unconstrained_blackbox_concealment_mitm.yaml
9+
#attacks: !include ctown_unconstrained_blackbox_concealment_mitm.yaml
1110
#attacks: !include ctown_concealment_mitm_value.yaml
1211
#attacks: !include ctown_payload_replay_conceal.yaml
1312
#ma attacks: !include ctown_network_replay_conceal.yaml

0 commit comments

Comments
 (0)