Refactor #n: go back to generic entry point, use if in apply{}

This commit is contained in:
Nico Schottelius 2019-03-30 14:59:46 +01:00
commit f32ad44e0b
6 changed files with 210 additions and 79 deletions

View file

@ -284,45 +284,60 @@ class L2Controller(object):
v6_src, v6_dst, v4_dst,
v4_src, v4_dst, v6_src))
self.controller.table_add("nat64_icmp6",
"nat64_icmp6_echo_request",
[str(v6_dst),
str(table_proto['ICMP6_ECHO_REQUEST'])
],
self.controller.table_add("nat64",
"nat64_static",
[str(v6_dst)],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
self.controller.table_add("nat46",
"nat46_static",
[str(v4_dst)],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
self.controller.table_add("nat64_icmp6",
"nat64_icmp6_echo_reply",
[str(v6_dst),
str(table_proto['ICMP6_ECHO_REPLY'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
# self.controller.table_add("nat64_icmp6",
# "nat64_icmp6_echo_request",
# [str(v6_dst),
# str(table_proto['ICMP6_ECHO_REQUEST'])
# ],
# [str(v6_src.network_address),
# str(v4_dst.network_address),
# str(v6_dst.network_address)]
# )
self.controller.table_add("nat46_icmp",
"nat46_icmp_echo_reply",
[str(v4_dst),
str(table_proto['ICMP_ECHO_REPLY'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
# self.controller.table_add("nat64_icmp6",
# "nat64_icmp6_echo_reply",
# [str(v6_dst),
# str(table_proto['ICMP6_ECHO_REPLY'])
# ],
# [str(v6_src.network_address),
# str(v4_dst.network_address),
# str(v6_dst.network_address)]
# )
self.controller.table_add("nat46_icmp",
"nat46_icmp_echo_request",
[str(v4_dst),
str(table_proto['ICMP_ECHO_REQUEST'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
# self.controller.table_add("nat46_icmp",
# "nat46_icmp_echo_reply",
# [str(v4_dst),
# str(table_proto['ICMP_ECHO_REPLY'])
# ],
# [str(v6_src.network_address),
# str(v4_dst.network_address),
# str(v6_dst.network_address)]
# )
# self.controller.table_add("nat46_icmp",
# "nat46_icmp_echo_request",
# [str(v4_dst),
# str(table_proto['ICMP_ECHO_REQUEST'])
# ],
# [str(v6_src.network_address),
# str(v4_dst.network_address),
# str(v6_dst.network_address)]
# )
def config_hosts(self):