def test_include1(self): """{}: general config, 1 !include statement""" cfg = ConfigParserGeneral() cfg.file_dir = os.path.dirname(__file__) cfg._load_from_yaml("cfg:\n" " rs_as: 999\n" " router_id: 192.0.2.2\n" " !include yaml_include1.yml\n") cfg.parse() self.assertEqual(cfg["blackhole_filtering"]["policy_ipv6"], "propagate-unchanged")
def test_include2_2levels(self): """{}: general config, 3 !include statements, 2 levels""" cfg = ConfigParserGeneral() cfg.file_dir = os.path.dirname(__file__) cfg._load_from_yaml("cfg:\n" " rs_as: 999\n" " router_id: 192.0.2.2\n" " !include yaml_include1.yml\n" " !include yaml_include2.yml\n" " !include yaml_include3.yml\n") cfg.parse() self.assertEqual(cfg["blackhole_filtering"]["policy_ipv6"], "propagate-unchanged") self.assertEqual(cfg["filtering"]["next_hop"]["policy"], "same-as") self.assertEqual(cfg["filtering"]["ipv4_pref_len"]["min"], 1) self.assertEqual(cfg["filtering"]["ipv4_pref_len"]["max"], 2) self.assertEqual(cfg["filtering"]["ipv6_pref_len"]["min"], 1) self.assertEqual(cfg["filtering"]["ipv6_pref_len"]["max"], 2)