Cast/change to network_address later

This commit is contained in:
Nico Schottelius 2019-03-14 17:03:56 +01:00
parent 532f1be6ba
commit 3d154f0326

View file

@ -113,13 +113,13 @@ class L2Controller(object):
# specific settings -- only need the address (=offset), no mask
for mode in ["range_router"]:
for net in self.v6_routes[mode]:
v6_net = net['net'].network_address
v4_net = self.info['v4_nat64_map'].next().network_address
v6_net = net['net']
v4_net = self.info['v4_nat64_map'].next()
self.nat64_map[mode].append({
"v6_network": v6_net,
"v4_network": v4_net,
"nat64_prefix": self.info['nat64_prefix'].network_address
"nat64_prefix": self.info['nat64_prefix']
})
self.init_boilerplate(sw_name)
@ -215,14 +215,19 @@ class L2Controller(object):
self.static_nat64_mapping(**nat64map)
def static_nat64_mapping(self, nat64_prefix, v6_network, v4_network):
nat64_prefix = str(nat64_prefix)
net_ipv6 = str(v6_network)
net_ipv4 = str(v4_network)
log.info("NAT64 map: {} -> {} -> {}".format(nat64_prefix, v6_network, v4_network))
self.controller.table_add("v6_networks", "nat64_static", [nat64_prefix], [net_ipv6, net_ipv4, nat64_prefix])
self.controller.table_add("v4_networks", "nat46_static", [net_ipv4], [net_ipv6, net_ipv4, nat64_prefix])
self.controller.table_add("v6_networks", "nat64_static", [str(nat64_prefix)],
[str(net_ipv6.network_address),
str(net_ipv4.network_address),
str(nat64_prefix.network_address)]
)
self.controller.table_add("v4_networks", "nat46_static", [str(v4_network)],
[str(net_ipv6.network_address),
str(net_ipv4.network_address),
str(nat64_prefix.network_address)]
)
def config_hosts(self):